Jump to content

$GLOBALS


newhip

Recommended Posts

Ok I've seen urls like www.domain.com/title-of-page-blah-blah and i understand how to make the url with the dash.

My question is how to I set that on the index page? I know how to do that after a set a $GLOBALS['q']['view'] and get the page like 

www.domain.com/view/title-of-page-blah-blah but not without the "view" or wtv i would set it to. Please help.

Link to comment
https://forums.phpfreaks.com/topic/282505-globals/
Share on other sites

Your question doesn't make sense.

 

Your php app is most probably using mod_rewrite.

For example the url

     domain.com/view/title-of-page-blah-blah is actually being mapped to the following url domain.com/page.php?q=view&title=title-of-page-blah-blah You'd access view and title using $_GET['q] and $_GET['title] variable. Not $GLOBALS.

Link to comment
https://forums.phpfreaks.com/topic/282505-globals/#findComment-1451571
Share on other sites

What I do is rewrite every URL that is not an images/folder etc to index.php and use $_SERVER to look at the URL and decide how to route the request.

 

I've seen may people get into very deep doodoo trying to create a new rewrite for every different URL structure they have, especially when the original request also contained a parameter that you use in the rewrites.

Link to comment
https://forums.phpfreaks.com/topic/282505-globals/#findComment-1451587
Share on other sites

Ok i got a new problem regarding this same topic... 

 

I got everything working and I'm able to read off the the url with $_SERVER but now it's looking for a file on my server.  How do i make it not look for a file and just know that it's actually just data that i've injected into the url?

Link to comment
https://forums.phpfreaks.com/topic/282505-globals/#findComment-1451801
Share on other sites

 

I got everything working and I'm able to read off the the url with $_SERVER but now it's looking for a file on my server.

What is looking for a file? 

 

 

 

How do i make it not look for a file and just know that it's actually just data that i've injected into the url?

You need to apply logic for your script for to do that. 

Link to comment
https://forums.phpfreaks.com/topic/282505-globals/#findComment-1451816
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.