473,395 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How should I add php code in a smarty template?


I added the following to the sample.tpl.html, but no "haha" was printed!

<?php echo "<p>haha"; ?>

--
iTech Consulting Services Limited
Expert of ePOS solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
Apr 24 '07 #1
10 6317
Sorry, found the solution, but how could I do this?

{php} $pos="C{$smarty.section.j}R{$smarty.section.k}"; echo "<li>$pos";
{/php}

--
iTech Consulting Services Limited
Expert of ePOS solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
Apr 24 '07 #2
The full section of codes I was trying to do:

{assign var=ii value=0}
{assign var=ileft value=0}
{assign var=iright value=10}
{section name=j start=0 loop=$cols_per_page step=1}
{section name=k start=0 loop=$rows_per_page step=1}
{php} $pos="C{$smarty.section.j}R{$smarty.section.k}"; echo
"<li>$pos"; {/php}
{if ($ii % 2 == 0)}
<tr>
<td><input type="textbox" id="txtItem_no<?php echo $pos; ?>"
name="txtItem_no<?php echo $pos; ?>" value="{$dtl_array.$ileft.item_no}"
size=10>
<td>{$dtl_array.$ileft.s_desc}
<td><input type="textbox" id="txtUom<?php echo $pos; ?>"
name="txtUom<?php echo $pos; ?>" value="{$dtl_array.$ileft.uom}" size=10>
<td><input type="textbox" id="txtQty<?php echo $pos; ?>"
name="txtQty<?php echo $pos; ?>" value="{$dtl_array.$ileft.qty}" size=15>
{assign var=ileft value=$ileft+1}
{else}
<td>
<td><input type="textbox" id="txtItem_no<?php echo $pos; ?>"
name="txtItem_no<?php echo $pos; ?>"
value="{$dtl_array.$iright.item_no}" size=10>
<td>{$dtl_array.$iright.s_desc}
<td><input type="textbox" id="txtUom<?php echo $pos; ?>"
name="txtUom<?php echo $pos; ?>" value="{$dtl_array.$iright.uom}" size=10>
<td><input type="textbox" id="txtQty<?php echo $pos; ?>"
name="txtQty<?php echo $pos; ?>" value="{$dtl_array.$iright.qty}" size=15>
</tr>
{assign var=iright value=$iright+1}
{/if}
{assign var=ii value=$ii+1}
{/section}
{/section}
--
iTech Consulting Services Limited
Expert of ePOS solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
Apr 24 '07 #3
On Tue, 24 Apr 2007 10:37:02 +0200, Man-wai Chang
<to***********@gmail.comwrote:
>
I added the following to the sample.tpl.html, but no "haha" was printed!

<?php echo "<p>haha"; ?>

use {php}<p>haha{/php}

see the smarty manual.
Apr 24 '07 #4
Problem fixed. sorry for the %$%@$%@@$^^%&%&**&. :)

--
iTech Consulting Services Limited
Expert of ePOS solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
Apr 24 '07 #5
Man-wai Chang wrote:
Problem fixed. sorry for the %$%@$%@@$^^%&%&**&. :)

Website: http://www.itech.com.hk (IE only)
^^^^^^^
IE only? And you're advertising that? What happened to browser
compatibility or web standards? Too bad I won't be seeing your site then.

Sh.
Apr 24 '07 #6
>Website: http://www.itech.com.hk (IE only)
^^^^^^^
IE only? And you're advertising that? What happened to browser
compatibility or web standards? Too bad I won't be seeing your site then.
(sh.... that's my boss' decision, not me. :)

--
iTech Consulting Services Limited
Expert of ePOS solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
Apr 25 '07 #7
use {php}<p>haha{/php}
see the smarty manual.
Thanks.

--
iTech Consulting Services Limited
Expert of ePOS solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
Apr 25 '07 #8
Message-ID: <46********@127.0.0.1from Man-wai Chang contained the
following:
>IE only? And you're advertising that? What happened to browser
compatibility or web standards? Too bad I won't be seeing your site then.

(sh.... that's my boss' decision, not me. :)
Who apparently has an irony bypass

<from the Flash movie>
We provide solutions. Period.
....

Pity you can't solve the problem a making a website that works in any
browser

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Apr 25 '07 #9
Man-wai Chang wrote:
>>Website: http://www.itech.com.hk (IE only)
^^^^^^^
IE only? And you're advertising that? What happened to browser
compatibility or web standards? Too bad I won't be seeing your site then.

(sh.... that's my boss' decision, not me. :)
In that case, I feel for you! Bosses, who needs them 'ey?
Apr 25 '07 #10
Geoff Berrow wrote:
Message-ID: <46********@127.0.0.1from Man-wai Chang contained the
following:
>>IE only? And you're advertising that? What happened to browser
compatibility or web standards? Too bad I won't be seeing your site then.
(sh.... that's my boss' decision, not me. :)

Who apparently has an irony bypass

<from the Flash movie>
We provide solutions. Period.
...

Pity you can't solve the problem a making a website that works in any
browser
Yeah, here a solution!

<param name="movie" value="flash\main.swf">
^^^
This solution business apparently is clueless which way slashes are
suppose to go!

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
May 3 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian | last post by:
Hello, I am trying to work out how to have smarty use a string's contents as the display-> template.. ie: $smarty->display($buffer); obviously $buffer isn't a filename, but a smarty template...
2
by: Brian | last post by:
I have an application that uses an array of values as a "lookup" table and smarty as a template engine. $lookup = "label"; $lookup = "label2"; $lookup = "label"; $lookup = "label2"; In my...
1
by: Richard | last post by:
I need help. I have a smarty based program that I am modifying. I have a smarty template file that consists of smarty and HTML. I need to integrate some PHP database calls into it. My problem...
0
by: Martin Meng | last post by:
Is Smarty really secure enough to open up the template source to members from the general public (albeit registered user, screened, identity verified)? My application calls for customiszble...
1
by: DJ Majestik | last post by:
OK, I am new to the whole PEAR/Smarty templating thing. I am trying to setup my directory structure correctly. If someone could weigh in and see if I have this setup "right", I would appreciate it....
0
by: Conrad | last post by:
Hi, I'm very new to Smarty Template Engine and I'm using PHP 5.0.4 on the Windows XP Professional platform and I have the following question: When I change the 7th line of the script to use a...
2
by: steve.high | last post by:
I hope someone here with experience could add their two cents, as I am kind of a noob to the ZF and Smarty. >From my observation, the View API in the ZF does pretty much everything that Smarty...
7
by: Man-wai Chang | last post by:
1. How could concatenate two values into a string in the template? {section name=j start=0 loop=10 step=1} {section name=k start=0 loop=10 step=1} {assign var=xx...
2
by: Gene | last post by:
i'm newcomer in using smarty and i have problem like this: i want to have one template file (e.g. index.tpl) in this file section which use variable {$content}. and two files *.php which are using...
3
by: knkk | last post by:
I am trying to include this code in the footer.template files of all blog templates: <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." :...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.