![]() |
|
|
|||||||
| VCL4PHP VCL for PHP. Questions or comments about the Visual Component Library for PHP, post them here! |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi all, im very new to the Delphi4php so please bare with me if what i'm asking sounds like a really stupid question.
I have my application using smarty templates which is all fine and dandy, the components work and im happy with it. The problem is i need to have some php code on some of the pages to get my $_GETs which would allow me to show certain sections of my page. Here is my template code for header.tpl Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>TimeDesign 1.0</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/css/default.css" type="text/css">
<link rel="stylesheet" href="/css/components.css" type="text/css">
{%$HeaderCode%}
</head>
<body>
{* this template includes a {php} block that assign's the variable $varX *}
{php}
global $foo, $bar;
if($foo == $bar){
echo 'This will be sent to browser';
}
// assign a variable to Smarty
$this->assign('varX','Toffee');
{/php}
{* output the variable *}
<strong>{$varX}</strong> is my fav ice cream :-)
{%$StartForm%}
<div id="wrapper">
<div id="title">My Test System</div>
<div id="navigation">
<div id="navbar">{%$mnu_Navbar%}</div>
<!-- TODO make this a component -->
<div id="pagebar">
<ul>
<li><a href="">Master Table</a></li>
<li><a href="">Educators</a></li>
<li><a href="">Classes</a></li>
<li><a href="">Rooms</a></li>
<li><a href="">Rooms</a></li>
<li><a href="">Subjects</a></li>
<li><a href="">Layout</a></li>
<li><a href="">Groups</a></li>
<li><a href="">Solve It</a></li>
<li><a href="">Reports</a></li>
<li><a href="">Substitutions</a></li>
</ul>
</div>
</div>
<div id="header">
<div id="left"> </div>
<div id="right">
<table cellspacing="10">
<tr>
<td>{%$btn_Unlock_Headings%}</td>
<td>{%$btn_Add_Period%}</td>
<td>{%$btn_Add_Day%}</td>
</tr>
<tr>
<td>{%$btn_Relabel_Headings%}</td>
<td>{%$btn_Remove_Period%}</td>
<td>{%$btn_Remove_Day%}</td>
</tr>
</table>
</div>
</div>
<div id="middle_wrapper">
{%include file="templates/sidebar.tpl"%}
<div id="content">
I did research on how to include php code in template files and was lead here Smarty It didn't work so I thought it was my smarty template version that was out of date so updated it... same problem. ![]() My question to all you gurus out there is what am I doing wrong and how can I fix this so I may use php in my template files? Really appreciate your help thanks. |
| Sponsored Links |
|
|
|
|||
|
Thanks, another problem I have though:
I am trying to include a smarty template file but using a php variable instead of a set name. This is of course in a smarty template file (header.tpl): Code:
{%include file="templates/$page_name.tpl"%}
Code:
{%include file="templates/$_GET['page'].tpl"%}
Code:
{%include file="templates/$_GET.page.tpl"%}
What am i doing wrong though? EDIT: Found solution on: Looking for a tutorial to use Smarty templates with D4PHP? Last edited by Dorac; 24th May 2009 at 17:44. Reason: Found solution on another post |
|
|||
|
I'm find explain:
Component Writer's Guide :: Template Engines - Delphi for PHP Documentation Wiki Guy |