Good morning,
Is there a php function that will take the text out of a tag in a variable that has HTML in it? What I want to do is get the text from in-between the <h1> tags and use it as a title in my meta tags.
Let's say I have all my content in separate .php files like this
<?php
$y ="<h1>some content</h1> this is about some content";
?>
Now in the php page I have
<?php include("phpfile1.php"); ?>
//this includes the doctype and the <html> and <head> tag
<?php include("content.php"); ?>
<?php $t=strip_tags($y);
echo "<meta=\"description\" description=\"".$t."\">";
?>
//this puts a description of my content
<?php include("top.php"); ?>
//this includes the </head>, <body> and header html and what not
<?php echo $y; ?>
<?php include("footer.php"); ?>
// this includes the footer html and the </body and </html>tags
Is their any easier way? Or is this a decent way? Just trying to make it easier to add new content to my pages. thanks