Parse template to variable

  • Hmm

    Hmm - 2005-07-07

    I need to open a templatefile, and save the parsed results in a variable.

    Can anybody help me with an example?

    • Sven Eichler

      Sven Eichler - 2005-07-07

      example is based of the article from

      $my_color = "blue"; // we'll use this later

      $t = new Template("/home/mydir/mytemplates/");
          // create a template object named $t
          // set MyFileHandle = our template file
          // set template variable some_color = $my_color value

      // save the parsed output in the variable $myvar
      $myvar = $t->parse("MyOutput","MyFileHandle");
          // set template variable MyOutput = parsed file


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks