Fork me on GitHub

passing template vars to plugins  Bottom

  • Trying something that might be tricky here...

    I'm writing a theme plugin that needs to take input from a template variable, but it doesn't seem to be working. I'm trying something like this:

    Code

    <!--[newplugin x=1 y=2 z=$var1.item2]-->

    or

    <!--[newplugin x=1 y=2 z=<!--[$var1.item2]-->]-->


    It's not working. Is there a correct method or am I out of luck?
  • Not sure why there's a big space between it and em2 in both examples above. Obviously I am coding it as $var1.item2.
  • Code

    <!--[newplugin x=1 y=2 z=$var1.item2]-->


    this should be the correct format, assuming you're making a function, not a modifier.


    also:
    - the filename of the plugin should be function.newplugin.php
    - the name of the function inside that file should be smarty_function_newplugin($params, & $Smarty)
  • And you can check the data available in that template using <--[pndbeug]--> to check if $var1.item has the data that you expect icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • This was a while ago...

    I don't remember how I got it working but I did get it working.
  • I'm fairly sure there need to be quotes around the template variable, like this:

    Code

    <!--[newplugin x=1 y=2 z="$var1.item2"]-->
  • 0 users

This list is based on users active over the last 60 minutes.