#3 Using PHP code in main.tpl

open
nobody
None
5
2002-01-29
2002-01-29
No

Adding the possibility to use PHP code in main.tpl
would be really useful.

My site is using includes to set common headers, menus
and banners. Since main.tpl is the template that gives
the general structure of the page I need a way to at
least pull in some includes.

The way I solved the problem is by adding another flag
to the $config array which tells if there is PHP code
in main.tpl. If there is, then after parsing the
template it won't be just printed out, but first it
will be run through the 'eval' function.

See the attached files.

Regards,
Marius

Discussion

  • Lars

    Lars - 2002-06-08

    Logged In: YES
    user_id=487913

    well, i can't get it to work, i get a error
    Fatal error: Call to a member function on a non-object in
    c:\phpdev\www\link\lib\lib_main.php on line 25

     

Log in to post a comment.