Jump to content

Php "take A Tour" Script


Norman
 Share

Recommended Posts

Hello, I would like to have an example (the best would be a precompiled php script) for "tours". You know, when you go trought a web site an you see "Tour"; you get a page where you can go on with the tour in order to see the site goals, resources, etc.. and a final link to the registration form.

Link to comment
Share on other sites

I don't see what sort of a premade script that would be...I mean, you can simply have a whole "tour" section of your website, and in it, have a few pages, each linking to the next (and previous, ideally). PHP is as useful there as in any other part of the web site - to create a common layout, etc.eg. 1.html:

<p>bla bla bla, feature x</p><a href="2.html">Next</a>

2.html

<p>bla bla bla, feature y</p><a href="3.html">Next</a>

etc.Automating the above would be the same as having a "pagination" script, only you'll have one "item per page", and the item in question will be the feature you're about to describe.

Link to comment
Share on other sites

Yup, I know that.. but I mean something like this:mysite.com/tour/index.php"welcome to the tour.. "[go to the second part: link -> mysite.com/tour/do=tour&why=1]mysite.com/tour/do=tour&why=1"bla bla bla".. and so on.

Link to comment
Share on other sites

A tour is just a set of special pages that link to each other and maybe a home page so you can leave the tour at any time. You would use plain HTML or PHP to generate the pages in the usual fashion. I guess I don't understand the question.

Link to comment
Share on other sites

How does it will word? I haven't understood.
Here's a commented verison:
<?php  $file=array('abc.php', 'def.php', 'ghi.php', 'jkl.php'); /* Place all files in a numeric array $file. In it, 0 => 'abc.php', 1=> 'def.php', etc. */  $page=(int)$_GET['page']; /* get the "page" query string parameter. In your earlier URL samples, this is equivalent to the "why" parameter. */  if(array_key_exists($page, $file)) { /* Check if the $page exists as a key in the $file array. If it's "0" for example, this will return true, since there is such a key (with the corresponding value of 'abc.php' in this case) */	include($file[$page]); /* If there is such a key, include a file that has a name like in value in the $page key of the $file array. If it's "0" for example, this would mean that 'abc.php' is going to get included. */  }?>

Link to comment
Share on other sites

Thank you boen robot. This has helped me a lot. Then, using this code I can create my index.php (with it) and in the same folder (as per example) the abc.php def.php, etc. files in order to call them with my script. And this will be executed like this..index.php?page=abcindex.php?page=defright?And, pratically how do I execute it?

Link to comment
Share on other sites

Thank you boen robot. This has helped me a lot. Then, using this code I can create my index.php (with it) and in the same folder (as per example) the abc.php def.php, etc. files in order to call them with my script. And this will be executed like this..index.php?page=abcindex.php?page=defright?And, pratically how do I execute it?
Um, no. The URLs would go like:index.php?page=0 (the same as having just index.php)index.php?page=1etc.Or in other words, as the array index.In each of the included files, you must place a link for the next file. Or, this script could easily be extended to include a link for the next page:(place at the end of index.php)
echo '<a href="?page=', $page - 1, '">Previous</a>|<a href="?page=', $page + 1, '">Next</a>';

Placing those links only if the page actually exists is slightly more complicated, but hey, it's about time you try doing something yourself. I don't want to chew everything for you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...