Results 1 to 2 of 2

Thread: BASIC PHP Template using SSI?

  1. #1
    Join Date
    Feb 2006
    Posts
    1

    BASIC PHP Template using SSI?

    How do I make a php template that controls variables for every page that uses it?

    Example: Global Artist Profile Template

    <% Name %> <br/>
    <% Picture %> <br/>
    <% Bio %> <br/>
    <% Audio %> <br/>
    <% Lyrics %> <br/>
    <% External Links %> <br/>
    <% Artist Page Ad %> <br/>

    -----Becomes-----

    MC Tech
    This guy is blah blah...
    Song 1, Song 2...
    Lyric 1, Lyric 2...
    www.link1.com, www.link2.com
    "Buy CDs from amazon.com!"

    I need to be able to add <% Videos%> for example down the road to the global template and it effects every page that uses it.

    A. How do you do this?

    B. Do I have to store the data in a mySQL database?

    Thanks.

  2. #2
    Join Date
    Apr 2005
    Location
    Florida
    Posts
    213
    you can use the pregreplace syntax to do that...

    PHP Code:
    <?php
    // This is taken from somewhere and written in PHP
    $str 'Hello, [name]
    This is my phone number [phone]-[number]'
    ;

    // Those are the variables to be replaced with inside []
    $name 'Mike';
    $phone '+39';
    $number '555...';

    $msg preg_replace("/\[(\w+)\]/e""\$\\1"$str);
    print 
    $msg;
    ?>
    ProHostCP - All-In-One Web Host Billing, Support, and Live Chat Solution -- Entering Soon!Public Beta

Posting Permissions

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