By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

How should I add php code in a smarty template?

P: n/a

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
Share this Question
Share on Google+
10 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
>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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.