Hi, Has anyone managed to use the page attachments extension to display all attachments relating to a page by using <r:attachments:each>? Seems as though it can only be used if you can specify the name at the moment? Has anyone got any example code for this? Keith
on 2007-07-29 14:19
on 2007-07-29 21:46
Keith, I quietly added that feature the other day. It is kind of untested. However, because of the assignment of tag.locals.attachment inside the loop, it should work properly, but only for the current page. It will not cascade to parent pages. Here's a snippet of how it should work: <r:attachment:each> <p><r:link /> - <r:date /></p> </r:attachment:each> That would conceivably print a link to each attachment in a paragraph with its upload date. Sean P.S. I just found and fixed a minor bug in the order clause. I hope that wasn't your problem!
on 2007-07-29 21:54
Sean, Yeah - I started off by trying that - only I get the following Mysql error in the area of the page I'd expect to see the links printed. Any ideas?? *Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'asc id' at line 1: SELECT * FROM page_attachments WHERE (page_attachments.page_id = 8) ORDER BY asc id*
on 2007-07-29 21:56
Yes, that's the bug I just fixed. Please run `svn up` or export the extension again. Sean
on 2007-07-29 22:22
Just tried that but I get the same error? Any ideas?
on 2007-07-30 15:42
If it's the exact same error, then you didn't get the latest update. Notice that the terms in the ORDER BY clause are transposed; I fixed that in that in the latest revision. It should read "id asc". Sean
on 2007-07-30 15:53
Thanks Sean, I've fixed that error - I believe - now when I use the following code I simply get a # sign in the place of each attachment. I am using the following code within a snippet that is used on five child pages within a branch of the site (HOME > PRODUCTS > *5 PRODUCT PAGES*: <r:attachment:each order="asc"> <p><r:link /> - <r:date /></p> </r:attachment:each> Any ideas? Keith