smartguyin Posted September 9, 2006 Share Posted September 9, 2006 I want to use the part from url like http://www.domain.com/product.phpSoo 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.... Quote Link to comment Share on other sites More sharing options...
Pezzoni Posted September 9, 2006 Share Posted September 9, 2006 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. Quote Link to comment Share on other sites More sharing options...
smartguyin Posted September 9, 2006 Author Share Posted September 9, 2006 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. Quote Link to comment Share on other sites More sharing options...
Orio Posted September 9, 2006 Share Posted September 9, 2006 [code]<?php$filename = substr(basename($_SERVER['PHP_SELF']),0,-4);?>[/code]Orio. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.