[PHP] Re: Customise Index page using PHP????

2002-07-11 Thread Craig

I want to acheive something like this

http://www.claviga.com/index.php?pageid=18



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Customise Index page using PHP????

2002-07-11 Thread Martin Clifford

The easiest way to accomplish that is by using switches.  Here is an example:

switch($pageid) {
default:
include(default_page.inc);
break;
case 18:
include(page_18.inc);
break;
}

With that in your index.php page, it will look for the variable $pageid, and depending 
on what it is set to, display the appropriate information.  In this instance, it will 
display the default index page by default (if $pageid is empty), or page_18.inc if 
$pageid = 18.

Hope that helps :o)

 Craig [EMAIL PROTECTED] 07/11/02 10:42AM 
I want to acheive something like this

http://www.claviga.com/index.php?pageid=18 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: Customise Index page using PHP????

2002-07-11 Thread Jay Blanchard

[snip]
Is there a way to create a customised version of the index directory
structure using php?

Eg listing all the pages in the specific directory when an index page isnt
created?

I want to acheive something like this

http://www.claviga.com/index.php?pageid=18
[/snip]

Yes you can do this. Start with your requirements, then do a flow chart.
From there you can design each process that you need. For customization you
will have to set a cookie for each user holding their customized options so
that the proper information will be displayed when they visit the site.

Search Google for Building Custom PHP Pages;
http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=Building+Custom+PHP+P
agesbtnG=Google+Search

HTH!

Jay

Learn to think through processes step by step, learn to diagram, then write
code, and then write more code. Once you have accomplished this you will be
well on your way to learning how to program. -- professor of computer
science (name forgotten), a long time ago, L.S.U.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Customise Index page using PHP????

2002-07-11 Thread Justin French

I'd say there's an easier way than switches...

?
if(!empty($_GET['page_id']  is_int($_GET['page_id']))
{
$page_id = $_GET['page_id'];
}
else
{
// default if no id was passed, or it wasn't an integer
$page_id = 1;
}

$file = inc/page_ . $page_id . .inc; // eg page_18.inc

if(file_exists($file))
{
include($file);
}
else
{
include('inc/page_missing.inc');
}
?

The difference being that there's no extra code (case statements) for 1000
different page_id's, or just 5 page_id's, and I've included pretty much all
the fallbacks for missing page_id, missing include files, etc etc.

You just need a /inc/ dir full of page_n.inc files.


Good luck!

Justin French





on 12/07/02 12:43 AM, Martin Clifford ([EMAIL PROTECTED]) wrote:

 The easiest way to accomplish that is by using switches.  Here is an example:
 
 switch($pageid) {
 default:
 include(default_page.inc);
 break;
 case 18:
 include(page_18.inc);
 break;
 }
 
 With that in your index.php page, it will look for the variable $pageid, and
 depending on what it is set to, display the appropriate information.  In this
 instance, it will display the default index page by default (if $pageid is
 empty), or page_18.inc if $pageid = 18.
 
 Hope that helps :o)
 
 Craig [EMAIL PROTECTED] 07/11/02 10:42AM 
 I want to acheive something like this
 
 http://www.claviga.com/index.php?pageid=18
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php