Jump to content

Can we use the part from url and set it as variable


smartguyin

Recommended Posts

I want to use the part from url like http://www.domain.com/product.php

Soo i want to set the variable to catch only "product" and leaving the other content in the url...

Soo in this example i have to exclude 22 character ( http://www.domain.com/ ) from start and 4 characters ( .php ) from End.

I know this is possible have any one tried this one.... If yes please let me know..... waiting for your replies....
Link to comment
Share on other sites

Would it not be simpler to just set a variable for each page? So for example, at the top of index.php, you have a line saying:

[code]$page = 'index';[/code]

And at the top of product .php, you have a line that says:

[code]$page = 'product';[/code]

You could do it in the way you are suggesting, but it would be needlessly complex.
Link to comment
Share on other sites

no coz the website is already with many pages and its difficult to set var.. to every page.

Soo i am trying to do this. Actually i want that variable to echo in my title tag and some parts of the body soo i want to try it out this one. have u ever tried it please give me ints and i'll foloow up.
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.