Results 1 to 6 of 6

Thread: [Resolved]Getting <title> to use in HTML file,

  1. #1

    Thread Starter
    Lively Member Neo-dark's Avatar
    Join Date
    Oct 2004
    Location
    The neather world
    Posts
    114

    Resolved [Resolved]Getting <title> to use in HTML file,

    Hello all,

    Another small question! This time it might be difficult to explain but I'll try my best and ask question when you have any.

    I want to get the HTML <title> value from a variable called &file,

    Example:

    The title of the current page is "Home"
    I want to get title of File.php which is "Not Home" and show it in the content on home.php somewhere(By example via an Echo)
    File.php gets included in the main content screen using a PHP Include.

    I hope this makes it clear what I want to do and that I can get some help

    Thank already!
    Last edited by Neo-dark; Aug 29th, 2007 at 06:00 AM. Reason: Resolved
    i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD

    Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Getting <title> to use in HTML file,

    declare it as a variable.

    $title = "Home";

    echo $title;
    My usual boring signature: Something

  3. #3

    Thread Starter
    Lively Member Neo-dark's Avatar
    Join Date
    Oct 2004
    Location
    The neather world
    Posts
    114

    Re: Getting <title> to use in HTML file,

    That would mean declaring it in each file, Which might not be possible
    i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD

    Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis

  4. #4
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Getting <title> to use in HTML file,

    well if you have a main include file (say 'settings.php') all you need to do is include that on the top of every page.

    and inside of settings.php have $title = "Home";

    and on each page have echo $title;
    My usual boring signature: Something

  5. #5
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: Getting <title> to use in HTML file,

    PHP Code:
    <?
        $filename = "index.php";
        $fhnd = fopen($filename, "r");
        $fstr = fread($fhnd, filesize($filename));
        fclose($fhnd);

        $fstrA = split("<title>", $fstr);
        $fstrB = split("</title>", $fstrA[1]);
        $fstr = $fstrB[0]; 

        echo $fstr;
    ?>
    This should do the trick.



    EDIT:

    Tested it and made a slight change.
    Works for me now.
    Last edited by TheBigB; Aug 27th, 2007 at 12:20 PM.
    Delete it. They just clutter threads anyway.

  6. #6

    Thread Starter
    Lively Member Neo-dark's Avatar
    Join Date
    Oct 2004
    Location
    The neather world
    Posts
    114

    Re: Getting <title> to use in HTML file,

    Quote Originally Posted by TheBigB
    PHP Code:
    <?
        $filename = "index.php";
        $fhnd = fopen($filename, "r");
        $fstr = fread($fhnd, filesize($filename));
        fclose($fhnd);

        $fstrA = split("<title>", $fstr);
        $fstrB = split("</title>", $fstrA[1]);
        $fstr = $fstrB[0]; 

        echo $fstr;
    ?>
    This should do the trick.



    EDIT:

    Tested it and made a slight change.
    Works for me now.

    And it does the trick wonderfully,Thank you.
    i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD

    Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width