Hi,
 I have been trying to get a little templating thing going and I want
everything to pass through a single index.php file which then decides what
page is wanted and includes them.

The scheme is to go to a url like [http://localhost/~donn/blah/] which
serves index.php in that dir. That includes 'home.php'

home.php has a link to 'use1.php'

The problem I am having is that as I click back and forth between home and
use1 the url starts growing...

I get things like [http://localhost/~donn/blah/index.php/index.php/use1] and
it just keeps getting longer.

I include my code below, very much shortened. I am sure I am missing some
obvious way to control links in this weird situation where every page is
*really* index.php but I still need to link from page to page.

[code]
[index.php]
<?php
$expl = explode("/",$_SERVER["REQUEST_URI"]);
$resource = $expl[count($expl)-1];
if ($resource=="") $resource="home";

if (file_exists($resource.".php") ) {
        include $resource.".php";
} else  {
        echo "No such file.";
}       
?>

[home.php]
<h1>home</h1>
<a href="index.php/use1">link to use1</a>

[use1.php]
<h1>use1</h1>
<a href="index.php/home">Back</a>

The overall idea is to have clean urls without a bunch of htaccess stuff
(which mystifies me). I want to be able to bookmark
[http://localhost/~donn/blah/index.php/somepage] and have stuff like
[http://localhost/~donn/blah/index.php/gallery:showpic1]

Thanks for reading.
\d




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

Reply via email to