random pages... 
Author Message
 random pages...

Hello...

I'm working on a site and I have 50 pages but I want them to pop up
randomly and I  also want a set of 6 different pages every 100 times
someone clicks a link on the site.  Can someone help me with this?
All help is greatly appreciated.



Fri, 14 May 2004 22:20:18 GMT  
 random pages...

Quote:
> I'm working on a site and I have 50 pages

Perl doesn't have a concept of pages

Quote:
> but I want them to pop up
> randomly

perldoc -f rand
You may want to multiply the result with 50 to get the full range of your 50
pages.

Quote:
> and I  also want a set of 6 different pages every 100 times
> someone clicks a link on the site.  Can someone help me with this?

Perl doesn't have a concept of clicks and sites

Quote:
> All help is greatly appreciated.

You may be better off asking this type of question in a newsgroup, that
actually cares about web authoring.

jue



Fri, 14 May 2004 22:39:17 GMT  
 random pages...
Like Jue suggested, research a bit into rand....

But to answer your Perl question.....
Given a list of file names in an array, for instance, you can choose a file
at random.  Then print the contents of that file through $_.

What do you mean by "6 different pages every 100 times"?

PAW

Quote:
> Hello...

> I'm working on a site and I have 50 pages but I want them to pop up
> randomly and I  also want a set of 6 different pages every 100 times
> someone clicks a link on the site.  Can someone help me with this?
> All help is greatly appreciated.



Fri, 14 May 2004 23:08:29 GMT  
 random pages...

Quote:

> Hello...

Hi

Quote:
> I'm working on a site and I have 50 pages

Wrong newsgroup.

Quote:
> but I want them to pop up randomly

OK. This is the code I use for a set of 5 pages. In your case, I would
throw all the files into a directory and get Perl to slurp up the
directory contents into an array. It would be far more preety than
writing out an array with 50 elements - although there's nothing wrong
with this approach.

#!/usr/local/bin/perl

    use CGI;
    $query = CGI::new();

    print $query->header();


                     'index.2.html',
                     'index.3.html',              
                     'index.4.html',  
                     ...
                    );


        open (HTMLDAT, "</path/to/dir/$randhtml");

        close HTMLDAT;


Quote:
> and I  also want a set of 6 different pages every 100 times
> someone clicks a link on the site.  Can someone help me with this?

I've lost you there.

Wil



Sat, 15 May 2004 10:41:10 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Random call to random page

2. random link from web page

3. random picture for web page

4. Random number isn't random.

5. More random then other random

6. Random Text from Random File needed

7. Random function not so random under NT

8. Where to start: Need to get page titles from home page and write to txt file

9. Man pages or Man page for TK widgets

10. pages within pages...

11. edit file page by page

12. Security:HowTo not pass UserID/Password as hidden variables from page to page

 

 
Powered by phpBB® Forum Software