How should I add php code in a smarty template?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Man-wai Chang

    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
  • Man-wai Chang

    #2
    Re: How should I add php code in a smarty template?

    Sorry, found the solution, but how could I do this?

    {php} $pos="C{$smarty .section.j}R{$s marty.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

    Comment

    • Man-wai Chang

      #3
      Re: How should I add php code in a smarty template?

      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{$s marty.section.k }"; echo
      "<li>$pos"; {/php}
      {if ($ii % 2 == 0)}
      <tr>
      <td><input type="textbox" id="txtItem_no< ?php echo $pos; ?>"
      name="txtItem_n o<?php echo $pos; ?>" value="{$dtl_ar ray.$ileft.item _no}"
      size=10>
      <td>{$dtl_array .$ileft.s_desc}
      <td><input type="textbox" id="txtUom<?ph p echo $pos; ?>"
      name="txtUom<?p hp echo $pos; ?>" value="{$dtl_ar ray.$ileft.uom} " size=10>
      <td><input type="textbox" id="txtQty<?ph p echo $pos; ?>"
      name="txtQty<?p hp echo $pos; ?>" value="{$dtl_ar ray.$ileft.qty} " size=15>
      {assign var=ileft value=$ileft+1}
      {else}
      <td>
      <td><input type="textbox" id="txtItem_no< ?php echo $pos; ?>"
      name="txtItem_n o<?php echo $pos; ?>"
      value="{$dtl_ar ray.$iright.ite m_no}" size=10>
      <td>{$dtl_array .$iright.s_desc }
      <td><input type="textbox" id="txtUom<?ph p echo $pos; ?>"
      name="txtUom<?p hp echo $pos; ?>" value="{$dtl_ar ray.$iright.uom }" size=10>
      <td><input type="textbox" id="txtQty<?ph p echo $pos; ?>"
      name="txtQty<?p hp echo $pos; ?>" value="{$dtl_ar ray.$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

      Comment

      • skrebbel

        #4
        Re: How should I add php code in a smarty template?

        On Tue, 24 Apr 2007 10:37:02 +0200, Man-wai Chang
        <toylet.toylet@ 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.

        Comment

        • Man-wai Chang

          #5
          Re: How should I add php code in a smarty template?

          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

          Comment

          • Schraalhans Keukenmeester

            #6
            Re: How should I add php code in a smarty template?

            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.

            Comment

            • Man-wai Chang

              #7
              Re: How should I add php code in a smarty template?

              >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

              Comment

              • Man-wai Chang

                #8
                Re: How should I add php code in a smarty template?

                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

                Comment

                • Geoff Berrow

                  #9
                  Re: How should I add php code in a smarty template?

                  Message-ID: <462eb1b5$1@127 .0.0.1from Man-wai Chang contained the
                  following:
                  >IE only? And you're advertising that? What happened to browser
                  >compatibilit y 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/

                  Comment

                  • Schraalhans Keukenmeester

                    #10
                    Re: How should I add php code in a smarty template?

                    Man-wai Chang wrote:
                    >>Website: http://www.itech.com.hk (IE only)
                    > ^^^^^^^
                    >IE only? And you're advertising that? What happened to browser
                    >compatibilit y 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?

                    Comment

                    • Jonathan N. Little

                      #11
                      Re: How should I add php code in a smarty template?

                      Geoff Berrow wrote:
                      Message-ID: <462eb1b5$1@127 .0.0.1from Man-wai Chang contained the
                      following:
                      >
                      >>IE only? And you're advertising that? What happened to browser
                      >>compatibili ty 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\ma in.swf">
                      ^^^
                      This solution business apparently is clueless which way slashes are
                      suppose to go!

                      --
                      Take care,

                      Jonathan
                      -------------------
                      LITTLE WORKS STUDIO

                      Comment

                      Working...