Reputation: 35
is it possible to echo (hope this is the right term) the content of the h1 tag to the title tag on a non database driven xhtml strict site? Example:
<h1>Green Soup</h1>
would automatically displayed in the
title tag <title>Today's Menu: [echo h1 tag]</title>
with the result title>Today's Menu: Green Soup</title>
The site I'm working on has a php script that rotates content on a daily base, ie. today is "green soup" and tomorrow "BLT Sandwiches", etc ... with a static header and so far statc title.
Sorry if this is a basic question, I'm just getting started in the php world. Thank you in advance
Upvotes: 2
Views: 15555
Reputation: 13630
Well, it depends on where you create that <h1>
tag and where you have the <title>
tag echoed out. If you can get the content for the <h1>
tag before you echo the <title>
tag, then you can echo that out.
Upvotes: 1
Reputation: 41551
Just define a variable and echo it out in PHP.
<?php $title="Green Soup"; ?>
<title>Today's Menu: <?php echo $title; ?></title>
<h1><?php echo $title; ?></h1>
It sounds like you're already using PHP on this page, correct?
Upvotes: 6