Welcome to TalkGraphics.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2000
    Location
    London, UK
    Posts
    1,436

    Default

    The environment: I am using PHP, MySQL under Windows 98 running PWS.

    The background: I am generating an HTML page using PHP. I call a function in a second php file which reads an HTML template record from a table, and returns it as a string. I then do a replace in the string with the generated content, and then use print($Output) to spit the page to the browser.

    The problem: Once I have retrieved the template in its string it would be sensible to hold it as a global variable so I can re-use it. At the moment the key lines are:

    include("GetTemplate.php");
    $Template = GetTemplate("other2");

    //then in GetTemplate.php
    function GetTemplate ($TemplateReq) {
    ....
    return $Template;
    }

    //back in calling php
    $Output = eregi_replace('{body}',$Output,$Template);
    print ($Output);


    What do I remove and replace with 'global ($Template);'?

    Many thanks.

    By the way, with a little VB experience, a couple of PHP books, and the MySQL help file, it looks like a lot is possible!

    www.thelondonhouse.co.uk
    Simon
    ------------------------------
    www.tlaconsultancy.co.uk
    www.bricksandbrass.co.uk
    IP

  2. #2
    Join Date
    Sep 2000
    Location
    London, UK
    Posts
    1,436

    Default

    The environment: I am using PHP, MySQL under Windows 98 running PWS.

    The background: I am generating an HTML page using PHP. I call a function in a second php file which reads an HTML template record from a table, and returns it as a string. I then do a replace in the string with the generated content, and then use print($Output) to spit the page to the browser.

    The problem: Once I have retrieved the template in its string it would be sensible to hold it as a global variable so I can re-use it. At the moment the key lines are:

    include("GetTemplate.php");
    $Template = GetTemplate("other2");

    //then in GetTemplate.php
    function GetTemplate ($TemplateReq) {
    ....
    return $Template;
    }

    //back in calling php
    $Output = eregi_replace('{body}',$Output,$Template);
    print ($Output);


    What do I remove and replace with 'global ($Template);'?

    Many thanks.

    By the way, with a little VB experience, a couple of PHP books, and the MySQL help file, it looks like a lot is possible!

    www.thelondonhouse.co.uk
    Simon
    ------------------------------
    www.tlaconsultancy.co.uk
    www.bricksandbrass.co.uk
    IP

 

 

Bookmarks

Posting Permissions

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