Log in

View Full Version : File name as title



Valor Studios
02-16-2008, 05:17 PM
I am looking for a script where it (the php script) reads the name of the file and inserts it into the title.

For example, if the file name was index.php, then it would look like so:
<title>Some Text Here <?php "SOME PHP TO PASTE FILENAME"?></title>

Resulting in Some Text Here Index

I'm not sure whether i've clarified it enough but hopefully you get what I mean.

Twey
02-16-2008, 06:41 PM
<?php echo basename(__FILE__); ?>

fileserverdirect
02-17-2008, 01:35 AM
or

<?php echo $_SERVER['PHP_SELF']; ?>

Valor Studios
02-17-2008, 09:33 PM
Thanks alot. One question though, is there a way to have it without .php extension?

Twey
02-17-2008, 09:43 PM
<?php echo basename(__FILE__, '.php'); ?>

Valor Studios
02-18-2008, 02:54 PM
Thanks alot. Really appreciated.:D