Can I use smarty variable inside {php} ?

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

    #1

    Can I use smarty variable inside {php} ?


    I meant something like:

    {section name=j start=0 loop=10 step=1}
    {php} $xx={$smarty.se ction.j.index}; echo $xx; {/php}
    {/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
  • iktorn

    #2
    Re: Can I use smarty variable inside {php} ?

    Man-wai Chang napisał(a):
    >
    I meant something like:
    >
    {section name=j start=0 loop=10 step=1}
    {php} $xx={$smarty.se ction.j.index}; echo $xx; {/php}
    {/section}
    >
    In my opinion it's pointless. You should separate your code and templates.

    If you need to do something that depends on smarty variables - better
    way is to write some custom funtion (plugin) that takes
    {$smarty.sectio n.j.index} as an argument (for example).

    --
    Wiktor Walc

    Comment

    • Man-wai Chang

      #3
      Re: Can I use smarty variable inside {php} ?

      If you need to do something that depends on smarty variables - better
      way is to write some custom funtion (plugin) that takes
      {$smarty.sectio n.j.index} as an argument (for example).
      Thanks. I got the point... but it's convenient. :)

      --
      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

      Working...