Page 1 of 1

Including a .php Into an already Templated Page

Posted: Wed Jun 30, 2004 12:14 pm
by NewfieBilko
Say I got index.php, in which calls for the template index.tpl. And in that index.tpl is all your headers, and footers and such, html code. Say I wanted to have that template have a page include into the top of it. I tried <? PHP include('anewfile.tpl') ?> i've tried just using { } , i've tried linking a .php. Nothing seems to work... here is the code:

Code: Select all

<?php
  <td width="100%" valign="top" align="left">
    <table border="0">
    <!-- title -->
    <tr>
       <td height="21"><div class="titlePage">Client Information System</div></td>
    </tr>	
	<tr><td><?PHP include 'thebar.php'; ?><A href="/index.php" class="link">Home </A> ->  {if $p_admin eq 'y'}<a href="frmAdmin.php" class="link">Admin </a> -> <a href="/frmUsersGrid.php" class="link">Users</a>{/if}</td></tr>
    </table>

  </td>
  <!-- Login box -->


?>

Posted: Wed Jun 30, 2004 12:23 pm
by redmonkey
Many templating systems don't allow you to directly place PHP code into the template file. As templating system invariably have different feature sets and implementations, you should consult the documentation specific to you template engine to see if A) That particular feature is available and B) If so how.

In many cases you will have to grab the contents of the file and assign it to a variable then pass the variable to your template for inclusion.

Posted: Wed Jun 30, 2004 12:37 pm
by NewfieBilko
right, this system hasn't let me include any php code, besides code like:

{if permission eq y}show this html code{/if}

it will allow simple things like that. And some loops...

but i dont think it willl allow advanced functions like includes.. i guess.

Posted: Wed Jun 30, 2004 12:38 pm
by NewfieBilko
see im still just divulging around how im gonna get my dynamic links at the top to pull in what page its on.... note, my other post...