Welcome to WebmasterWorld Guest from 35.172.100.232

Forum Moderators: mack

Message Too Old, No Replies

Should I use PHP, Javascript or ___ for this?

     
9:52 pm on Dec 28, 2005 (gmt 0)

New User

10+ Year Member

joined:Jan 10, 2005
posts:30
votes: 0


(I didn't mean to start duplicate threads. This question is about the best overall way, and a thread in the PHP section asks how (with PHP)?

I need the name of individual web pages %title% (?) to appear at the top of a section. When the simple two or three word page title gets changed the top section title will automatically match.

Exactly, how do I do this, please, and what is the precise variable name for the title of a Dreamweaver made page?

Thank you.

1:37 pm on Jan 2, 2006 (gmt 0)

Moderator This Forum from GB 

WebmasterWorld Administrator mack is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:June 15, 2001
posts:7844
votes: 93


If your pages are wreitten in php then the following should work to display the page title within a webpage...

echo $PHP_SELF

Mack.

seopod

12:48 am on Jan 5, 2006 (gmt 0)

Inactive Member
Account Expired

 
 


Are you meaning the page name ex. widget.php or an actual page title ex. "The World of Widgets"?

If the page name is what you are after then Mack is right, however, if you are after the actual title then you will have to go a different route.

In this case both PHP and JavaScript will both be efficient at this task.

PHP


<?php
$title="The World of Widgets";
echo $title;
?>

JavaScript

Use this in the <head>


<script language="JavaScript">
function title() {
var title = "The World of Widgets"
document.write(title)
}
</script>

Use this where you want the title to show up


<script language="JavaScript">
title()
</script>
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members