Jump to content


Photo

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


  • Please log in to reply
3 replies to this topic

#1 smartguyin

smartguyin
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts

Posted 09 September 2006 - 10:43 AM

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....
One of my php project >> http://www.mumbaipropertysite.com

#2 Pezzoni

Pezzoni
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 09 September 2006 - 11:01 AM

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:

$page = 'index';

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

$page = 'product';

You could do it in the way you are suggesting, but it would be needlessly complex.

#3 smartguyin

smartguyin
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts

Posted 09 September 2006 - 11:19 AM

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.
One of my php project >> http://www.mumbaipropertysite.com

#4 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 09 September 2006 - 12:50 PM

<?php

$filename = substr(basename($_SERVER['PHP_SELF']),0,-4);

?>

Orio.
Think you're smarty?

(Gone until 20 to November)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users