dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: website title bar php and html

  1. #1
    Join Date
    Jan 2010
    Posts
    161

    website title bar php and html

    hello everyone
    i hope someone can help me, I am a newbie, I mean i do know programming languages such as java,c++ but recently i am trying to make a webstite and instead of writing every single thing again and again on every single page i wanted to know how to use functions and variables to make it more automatic and easy to modify in future.

    So here is what I am trying to do right now.
    i dont want to use <title>This is the title</title> in html to put the tile on the title bar on the very top left of the browser so,i was thinking if there was a way to call this title using some kind of function to call a file containing this string and just by calling that variable I can show the title bar.
    By doing this,in future if I need to change the title bar, all i need to do is to change the string inside the variable.
    I hope someone can help me
    thank you

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,943

    Re: website title bar php and html

    That is what PHP templating is for.

    template.php
    PHP Code:
    <?php
    if (!isset($rel)) {$rel './';}
    if (!isset(
    $header)) {
      
    $header true;
    ?><html>
      <head>
        <title><?php echo $pageTitle?></title>
      </head>
    <body>

    <?php } else { ?>

    </body>
    </html><?php ?>
    home.php
    PHP Code:
    <?php
      $rel 
    './'// location of page relative to template.php
      
    $pageTitle 'This is my page title!';
      include 
    $rel 'template.php';
    ?>

    Page content here

    <?php include $rel 'template.php'?>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jan 2010
    Posts
    161

    Re: website title bar php and html

    Hi,
    thank you for the code
    but I think I am missing something important and stupid at the same time
    I have windows 7 and I am trying to play around with php html,now html works but codes that I use in php are not shown on the browser.
    Do i need to do something to make php work on the computer?
    thank you

  4. #4
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,943

    Re: website title bar php and html

    PHP must be run through a web server with PHP installed. Look into XAMPP or WAMP.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,943

    Re: website title bar php and html

    [ moved thread ]
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)