PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

How to Tips- Page title with h1 tags

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Tips- Page title with h1 tags

    NOT AFFILIATED WITH WRENSOFT USE AT YOU OWN RISK...



    <?php
    (preg_match("/(?<=h1>).*(?=<\/h1)/i", file_get_contents(__FILE__), $reg)) ? $newtitle = $reg[0] : $newtitle = "title not found";
    ?>

    <html>

    <title><?php echo $newtitle ?></title>


    <body>
    <h1>John Doe</h1>
    <img src="johndoe.jpg" alt="<?php echo $newtitle ?>">

    <?php echo $newtitle ?>
    <a href="johndoe.php"><?php echo $newtitle ?></a>
    </body>


    ## SAVE ABOVE AS 1.php upload to server and navigate with your browser to the page.
    Should have something like.
    John Doe
    John Doe
    #############END PAGE ##############
    MUST HAVE PHP INSTALLED
    INFO####

    This script finds the text between the <h1> and </h1> and pastes it where you place the <?php echo $newtitle ?>.

    This is an easy way to give your PHP page a new title,
    img alt or any other place you would like to add the
    extracted text.

    WHerever this line is place is where PHP will place the text found between the h1 tags
    <?php echo $newtitle ?>


    <!-- get the title from here -->
    <h1>John Doe</h1>


    h1 can be replace with h2,h3,h4 and many more tags.


    ANy text between the <!-- and the -> can be removed

    ANy questions. I check back at least 1 time a week.
Working...
X