I have several attachments for my links and I want to display one random attachment at a time on the main page. I am still testing this, so I have only one link with four images attached. The toplist code is the following:
<!-- BEGIN TOPLIST 5 --> <CONFIG>attachments,id,1,ascending,,,,0,0,0,0</CONFIG> <img src="download.php?id={LINKID}&attachid={ATTACHID}"><bR><a href="{TRACKLINKURL} target="_blank">{LINKTITLE}</a> <!-- END TOPLIST 5 -->
It is displayed correctly, however I get only attachment no. 1, no matter how often I reload...
tried both. with the first version it's showing only the first graphic of either link, with the second version it is only showing the first graphic of id=1
I used this with a test links 3.3.4B I have and it has shown all separate images -- it takes more reloads of the page than link or image count. IE: the randomness will sometimes match the previous random number.
My little test was with one category, 2 links -- one link with 3 images and the other with 2 images attached.
<!-- BEGIN TOPLIST 5 --> <CONFIG>attachments,rand(),1,ascending,,,,0,0,0,0;</CONFIG> <img src="download.php?id={LINKID}&attachid={ATTACHID}"><br> <a href="{TRACKLINKURL} target="_blank">{LINKTITLE}</a> <!-- END TOPLIST 5 -->
BTW, Paul it's kind of confusing with the forum interpreting the codes here with the previews.. Shouldn't the WSN Code, "code" keep the template vars and so forth from being expanded in the preview?
very weird, but all of the sudden it's working fine with the code zippo posted last (THANK YOU). Although I've tried it before without any changes. But I don't care right now
BTW, I made the first toplist code with the generator set to 'random' and it still posted the <config> code with 'id'.
zippo wrote: BTW, Paul it's kind of confusing with the forum interpreting the codes here with the previews.. Shouldn't the WSN Code, "code" keep the template vars and so forth from being expanded in the preview?
Please specify. Quoteing your post and previewing it I don't see anything amiss. Template vars showing values would be a serious issue with possible security implications, but obviously I haven't seen it.
Well, I tested this again and it's not quite what I thought at the time of the comment.
At anyy rate if the following is put into the quick-reply and then click advanced:
<!-- BEGIN TOPLIST 5 --> <CONFIG>attachments,rand(),1,ascending,,,,0,0,0,0;</CONFIG> <img src="download.php?id={LINKID}&attachid={ATTACHID}"><br> <a href="{TRACKLINKURL} target="_blank">{LINKTITLE}</a> <!-- END TOPLIST 5 -->
..the <img src=..> is expanded:
<!-- BEGIN TOPLIST 5 --> <CONFIG>attachments,rand(),1,ascending,,,,0,0,0,0;</CONFIG> <img src="https://www.webmastersite.net/forums/download.php?id={LINKID}&attachid={ATTACHID}"><br> <a href="{TRACKLINKURL} target="_blank">{LINKTITLE}</a> <!-- END TOPLIST 5 -->
It'll do the same thing with preview. The only way I can keep the first quote intact without the <img=..> expansion is to submit without going from quick-reply to advanced or using preview in the advanced editor.
I've encountered some other things that seemed to get represented differently in the preview than I expected, just have to make notes next time.
I have a similar problem now with an attachment toplist.
In one of my directories I have a links field called "spotlight", which can be set to 'yes' and 'no' by the admin. Not all links have buttons attached. A few versions ago I used to have a random button displayed out of these links with spotlight=yes. Now with the new attachment system I have a lot of broken images, so I thought I should try and turn this into a random attachment instead of random link. However, is it possible to use the filter "spotlight='yes'" for the attachments? I've tried it, but I'm not sure if it's not working because the filter doesn't work, or because the images are broken...
Comments on Random Attachment Toplist
Forum Regular
Usergroup: Customer
Joined: May 11, 2003
Total Topics: 64
Total Comments: 199
I have several attachments for my links and I want to display one random attachment at a time on the main page.
I am still testing this, so I have only one link with four images attached. The toplist code is the following:
<!-- BEGIN TOPLIST 5 -->
<CONFIG>attachments,id,1,ascending,,,,0,0,0,0</CONFIG>
<img src="download.php?id={LINKID}&attachid={ATTACHID}"><bR><a href="{TRACKLINKURL} target="_blank">{LINKTITLE}</a>
<!-- END TOPLIST 5 -->
It is displayed correctly, however I get only attachment no. 1, no matter how often I reload...
Forum Regular
Usergroup: Customer
Joined: Jan 11, 2006
Total Topics: 48
Total Comments: 166
I've not tried making a toplist yet but what about:
..in place of the line you have above.
..or maybe ..if the ID is needed in there.
Forum Regular
Usergroup: Customer
Joined: May 11, 2003
Total Topics: 64
Total Comments: 199
tried both. with the first version it's showing only the first graphic of either link, with the second version it is only showing the first graphic of id=1
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
zippo's first is of course the only one of those posted that actually instructs it to show a random item.
Note you need a type='link' condition if it's only supposed to be link attachments.
Does it always have the same {ATTACHID} value?
Forum Regular
Usergroup: Customer
Joined: Jan 11, 2006
Total Topics: 48
Total Comments: 166
I used this with a test links 3.3.4B I have and it has shown all separate images -- it takes more reloads of the page than link or image count. IE: the randomness will sometimes match the previous random number.
My little test was with one category, 2 links -- one link with 3 images and the other with 2 images attached.
BTW, Paul it's kind of confusing with the forum interpreting the codes here with the previews.. Shouldn't the WSN Code, "code" keep the template vars and so forth from being expanded in the preview?
Forum Regular
Usergroup: Customer
Joined: May 11, 2003
Total Topics: 64
Total Comments: 199
very weird, but all of the sudden it's working fine with the code zippo posted last (THANK YOU). Although I've tried it before without any changes. But I don't care right now
BTW, I made the first toplist code with the generator set to 'random' and it still posted the <config> code with 'id'.
Forum Regular
Usergroup: Customer
Joined: Jan 11, 2006
Total Topics: 48
Total Comments: 166
Glad it's working for you, Jenny. It's a pretty neat idea, thanks for sharing it.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
BTW, Paul it's kind of confusing with the forum interpreting the codes here with the previews.. Shouldn't the WSN Code, "code" keep the template vars and so forth from being expanded in the preview?
Please specify. Quoteing your post and previewing it I don't see anything amiss. Template vars showing values would be a serious issue with possible security implications, but obviously I haven't seen it.
Forum Regular
Usergroup: Customer
Joined: Jan 11, 2006
Total Topics: 48
Total Comments: 166
Well, I tested this again and it's not quite what I thought at the time of the comment.
At anyy rate if the following is put into the quick-reply and then click advanced:
<CONFIG>attachments,rand(),1,ascending,,,,0,0,0,0;</CONFIG>
<img src="download.php?id={LINKID}&attachid={ATTACHID}"><br>
<a href="{TRACKLINKURL} target="_blank">{LINKTITLE}</a>
<!-- END TOPLIST 5 -->
..the <img src=..> is expanded:
<CONFIG>attachments,rand(),1,ascending,,,,0,0,0,0;</CONFIG>
<img src="https://www.webmastersite.net/forums/download.php?id={LINKID}&attachid={ATTACHID}"><br>
<a href="{TRACKLINKURL} target="_blank">{LINKTITLE}</a>
<!-- END TOPLIST 5 -->
It'll do the same thing with preview. The only way I can keep the first quote intact without the <img=..> expansion is to submit without going from quick-reply to advanced or using preview in the advanced editor.
I've encountered some other things that seemed to get represented differently in the preview than I expected, just have to make notes next time.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Ah, the mod_rewrite matter.
Forum Regular
Usergroup: Customer
Joined: May 11, 2003
Total Topics: 64
Total Comments: 199
I have a similar problem now with an attachment toplist.
In one of my directories I have a links field called "spotlight", which can be set to 'yes' and 'no' by the admin. Not all links have buttons attached.
A few versions ago I used to have a random button displayed out of these links with spotlight=yes.
Now with the new attachment system I have a lot of broken images, so I thought I should try and turn this into a random attachment instead of random link. However, is it possible to use the filter "spotlight='yes'" for the attachments? I've tried it, but I'm not sure if it's not working because the filter doesn't work, or because the images are broken...
Does this make sense to anyone?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
There's no way to use a condition that's for a different table than the one at hand. You have to make it a links toplist.