Gossamer Forum
Home : Products : Links 2.0 : Discussions :

unique ID for every category

Quote Reply
unique ID for every category
I have a problem using a AdLink-Exchange-Services with the Links2.0 Templates.

The Service uses a Perl-script which I have to request like an image via the <img>-Tag. In addidtion I have to request the Image with my personal ID and a unique 2-digit PageID (to load different Ads for every page)
HTML-Code looks like this:
<a href="http://www.linkstation.de/cgi-bin/click/%MyID%%PageID%"><img src="http://www.linkstation.de/cgi-bin/click/%MyID%%PageID%"></a>

PageID is a two-digit ID containing everything from a..z and 0..9

Is there any variable for the template category.html to build category-pages with different PageIDs? At the moment every category page/subpage shows the same Ad (same PageID which i definded in the template). Or are there any mods available to generate such unique IDs?

Thanks for your help!

Quote Reply
Re: unique ID for every category In reply to
You could generate a random string to do this:

sub random_string
{
my @chars = ('a'..'z','0'..'9');
my $random_string = $chars[rand(37)] . chars[rand(37)];
return $random_string
}

Then you could have something like this in site_html_templates.pl:

return &load_template ('home.html', {
category => $category,
grand_total => $grand_total,
random_string => &random_string,
%globals
});

I think this should work; haven't tried it though! Wink

Martin Webster
--
Cebidae's UK Internet Resource
http://www.cebidae.co.uk/
Quote Reply
Re: unique ID for every category In reply to
See my method at http://gossamer-threads.com/p/26280. I think it can do what you want it to do.

I hope this helps.

- Bobsie
bobsie@orphanage.com
http://goodstuff.orphanage.com/