Jump to content

$GLOBALS


newhip
Go to solution Solved by vinny42,

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
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.

Edited by Ch0cu3r
Link to comment
Share on other sites

  • Solution

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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.