Webmastersite.net
Register Log In

Random Attachment Toplist

Comments on Random Attachment Toplist

Jenny
Forum Regular

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 64
Total Comments: 199
Jenny
Posted Feb 20, 2006 - 12:07 AM:

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...
zippo
Forum Regular

Usergroup: Customer
Joined: Jan 11, 2006

Total Topics: 48
Total Comments: 166
zippo
Posted Feb 20, 2006 - 12:37 AM:

I've not tried making a toplist yet but what about:
<CONFIG>attachments,rand(),1,ascending,,,,0,0,0,0</CONFIG>

..in place of the line you have above. wink

..or maybe
<CONFIG>attachments,id;rand(),1,ascending,,,,0,0,0,0</CONFIG>
..if the ID is needed in there.
Jenny
Forum Regular

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 64
Total Comments: 199
Jenny
Posted Feb 22, 2006 - 5:11 PM:

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 sad
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Feb 22, 2006 - 8:57 PM:

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?
zippo
Forum Regular

Usergroup: Customer
Joined: Jan 11, 2006

Total Topics: 48
Total Comments: 166
zippo
Posted Feb 22, 2006 - 10:50 PM:

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?
Jenny
Forum Regular

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 64
Total Comments: 199
Jenny
Posted Feb 23, 2006 - 11:50 AM:

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 smiling face

BTW, I made the first toplist code with the generator set to 'random' and it still posted the <config> code with 'id'.
zippo
Forum Regular

Usergroup: Customer
Joined: Jan 11, 2006

Total Topics: 48
Total Comments: 166
zippo
Posted Feb 23, 2006 - 12:34 PM:

Glad it's working for you, Jenny. It's a pretty neat idea, thanks for sharing it.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Feb 24, 2006 - 11:04 PM:

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.
zippo
Forum Regular

Usergroup: Customer
Joined: Jan 11, 2006

Total Topics: 48
Total Comments: 166
zippo
Posted Feb 26, 2006 - 1:27 AM:

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.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
#10 - Quote - Permalink
Posted Feb 28, 2006 - 12:52 AM:

Ah, the mod_rewrite matter.
Jenny
Forum Regular

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 64
Total Comments: 199
Jenny
#11 - Quote - Permalink
Posted Mar 06, 2006 - 9:58 AM:

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? smiling face
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
#12 - Quote - Permalink
Posted Mar 07, 2006 - 7:26 AM:

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.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.