Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Banner rotation /random numbers (and bug)

Quote Reply
Banner rotation /random numbers (and bug)
One of the new features of the new version is the addition of <%random%> and <%random1%> <%random2%> and <%random3%>

The difference is, <%random%> returns a different random number each time it's called in the template.

<%random1%>, <%random2%>, <%random3%> are initialized when the page is called, and are the samefor each use on the page, so if an advertiser (such as LinkExchange, ValueClick, or DataComm, etc) requires the same 'ad number' in 2 or more places for the ad, you can do that using the <%random1%>.. variables.

If you just want a random number, you can use<%random%>

BUG:: The code in nph-build is:

Code:
$OUT{random} = rand (10000);
$OUT{random1} = rand (10000);
$OUT{random2} = rand (10000);
$OUT{random3} = rand (10000);

It should be changed to:

Code:
$OUT{random} = int(rand (10000));
$OUT{random1} = int(rand (10000));
$OUT{random2} = int(rand (10000));
$OUT{random3} = int(rand (10000));

The number inside can be set to the limits of your needs -- 10, 99, or 64000.
Quote Reply
Re: Banner rotation /random numbers (and bug) In reply to
Hello Mr. Pataki!

funny, it did not work with me earlier. But now it does.

Thanks for the hint.



[This message has been edited by rajani (edited October 31, 1999).]
Quote Reply
Re: Banner rotation /random numbers (and bug) In reply to
What is this new version I see people talking about? Is it a beta? We just bought ours less than 2 weeks ago and it doesnt have alot of these things I see people talking about.

Chris
Quote Reply
Re: Banner rotation /random numbers (and bug) In reply to
You have 1.02? I beleive they are talking about Links SQL 1.1 BETA.. Which is going to be released as Links SQL 1.2..

Anyways, I don't have it either, but I requested it.

jerry
Quote Reply
Re: Banner rotation /random numbers (and bug) In reply to
Hello!

Links SQL is getting much better day by day Smile. I am looking forward to 1.2 version.

Mr. Pataki!

What I could not get it working is what I now understand. I could get a random no. in the bannor codes of categories BUT not in the header/footer.txt!

Did you manage that also?

In the category build subroutines of nph-build.cgi, it captures ONE random and stay with it. If I try to make sub random = int rand... and insert <%random> codes it would not capture one and publish at three places the SAME ones but DIFFERENT ones. Thats my problem.
Quote Reply
Re: Banner rotation /random numbers (and bug) In reply to
That's the function of <%random%> ... see my original explanation of how to use the codes. <%random1%> will generate a single random number and re-use it each time on the same page. <%random2%> and <%random3%> are also defined.
Quote Reply
Re: Banner rotation /random numbers (and bug) In reply to
Hello Mr. Pataki!

Using 1.1b.

May be I did not explain the problem correct or I was wrong.

Using <%random1> on category pages works SUPERB. Those category pages + homepage uses built-in html information.

All other pages like add.html/sucess, error, etc pages use header/footer.txt. Using <%random1> on this pages does not work. This is because this {$OUT}random is defined only in category build of nph-build.cgi. So I could not get a same & single random number in the threee lines of of banner codes on this pages.

So its not a bug as I thought but its just missing during the build of header & footer. Thats the question. If you use the header and footer with <%random1..3> it will show tag unknown!

Quote Reply
Re: Banner rotation /random numbers (and bug) In reply to
I reported this several days ago, when I was working with the <%include%> tag.

The random numbers are also not generated in the search, add and modify .cgi files.

Hopefully Alex is working to centralize the parameters that are being passed. Everything should be avilable to every procedure, and at worst return a NUL value, not an 'undefined'

I've moved as many parameters to my HTML_Templates.pm file, but some need to be defined in the source where they are used -- such as the <%random %>

The problem, if you will, is they need to be defined and intialized at the point they are being used. Maybe defining them once globally, then just reinitializing them as necessary would work.