[PHP] help on using 'request_uri' to make a front-end site
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] [home.php] home link to use1 [use1.php] use1 Back 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
[PHP] Re: help on using 'request_uri' to make a front-end site
Shawn McKenzie wrote: > Use /index.php instead of index.php maybe... I assume you meant in the tag. I tried that and the URL (when you mouse-over the link) becomes [http://localhost/index.php] which is not anywhere near where the files live. I must say I am rather confused by this situation, but I can fix it by always using absolute urls - which is a bit of a pain. \d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: help on using 'request_uri' to make a front-end site
Shawn McKenzie wrote: > Does seem strange. Try: > > http://localhost/~donn/blah/index.php"; /> > > Then just use /home, /use1 etc... Might work. Right, I'll give it a go. It's not much different from wiring-in a php var naming the base with {$base}/use1 being the form. The thing that would help here is if I could get a reliable way to extract the working 'path' (from an http:// pov) from the $_SERVER array somehow. Each of them gives a result tantalizingly close to the base, but they get it wrong in various ways. Well, thanks for your help. \d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re: help on using 'request_uri' to make a front-end site
Richard Heyes wrote: > The forward slash at the start causes your browser to ignore whatever > your current path is, albeit remain on the current domain. Okay, I think I am getting confused by this ~donn/ virtual path thing. I will try your suggestion it looks good. Thanks. \d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question about direct access to url
Use sessions or (not as secure) pass a hidden form field along from form.php to thankyou.php. You can look for it in thankyou.php and if it's not there then you know something's wrong. You'd check the $_POST array for your secret field and value. \d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php