Loading ...
Sorry, an error occurred while loading the content.
 

{include file assign} / {input...} issues

Expand Messages
  • Shekar C. Reddy
    Manuel, I see the prefilter function replaces all {include}s with: {/capture}{formadddatapart data=$smarty.capture.formdata} 1 {capture name= formdata }
    Message 1 of 22 , Apr 27, 2006
      Manuel,

      I see the prefilter function replaces all {include}s with:

      '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
      {capture name="formdata"}'

      which means I'm not using {include} at all. I noticed an issue with
      the prefilter in case when I include a file and assign the data to a
      var like so:

      {include file='navbar.tpl' assign=navbar}
      {$navbar}
      {$navbar}
      <...content...>
      {$navbar}
      {$navbar}
      {$navbar}

      In the above case, the include line itself is displaying the navbar
      but not the {$navbar}. In other words, static/dynamic content that
      is included in the template in a straight-forward way is getting
      assigned to vars without a problem that we can place at several
      places in the template without having to re-include the file. But
      when I use the form class with the prefilter, the content is not
      getting assigned to the var forcing me to include the file multiple
      times.

      2. On another note, the {input} tags are getting invoked even if
      they are enclosed within {if} tags:

      {if $form}
      {input...}
      {/if}

      In the above case, the input tag is getting invoked even if $form is
      false!

      How can I resolve the above issues?

      Regards,
    • Manuel Lemos
      Hello, ... No, 1 means the include appears there after the pre-filter is applied. ... I think the problem is that the navbar.tpl data is captured by the
      Message 2 of 22 , May 2, 2006
        Hello,

        on 04/27/2006 02:50 PM Shekar C. Reddy said the following:
        > Manuel,
        >
        > I see the prefilter function replaces all {include}s with:
        >
        > '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
        > {capture name="formdata"}'
        >
        > which means I'm not using {include} at all.

        No, \1 means the include appears there after the pre-filter is applied.


        > I noticed an issue with
        > the prefilter in case when I include a file and assign the data to a
        > var like so:
        >
        > {include file='navbar.tpl' assign=navbar}
        > {$navbar}
        > {$navbar}
        > <...content...>
        > {$navbar}
        > {$navbar}
        > {$navbar}
        >
        > In the above case, the include line itself is displaying the navbar
        > but not the {$navbar}. In other words, static/dynamic content that
        > is included in the template in a straight-forward way is getting
        > assigned to vars without a problem that we can place at several
        > places in the template without having to re-include the file. But
        > when I use the form class with the prefilter, the content is not
        > getting assigned to the var forcing me to include the file multiple
        > times.

        I think the problem is that the navbar.tpl data is captured by the
        formdata variable, so what is assigned to your navbar variable is
        probably an empty string.

        I think that if you use just {include file='navbar.tpl'} wherever you
        need, it will work as intended.



        > 2. On another note, the {input} tags are getting invoked even if
        > they are enclosed within {if} tags:
        >
        > {if $form}
        > {input...}
        > {/if}
        >
        > In the above case, the input tag is getting invoked even if $form is
        > false!

        I don't know how Smarty handles {if} sections. Maybe the pre-filter
        needs to be changed to also pre-process if sections. Try adding these
        lines to the pre-filter and let me know if it works.

        $search=array(
        ...
        '/({\\/?if[^}]*})/i'
        );
        $replace=array(
        ...
        '{/capture}{insert name="formadddatapart"
        data=$smarty.capture.formdata}\\1{capture name="formdata"}'
        );



        --

        Regards,
        Manuel Lemos

        Metastorage - Data object relational mapping layer generator
        http://www.metastorage.net/

        PHP Classes - Free ready to use OOP components written in PHP
        http://www.phpclasses.org/
      • Shekar C. Reddy
        ... $form is false! ... these ... Manuel, The above logic for handling {if} sections did not work. It is still giving the following error: unrecognized tag
        Message 3 of 22 , May 3, 2006
          > > 2. On another note, the {input} tags are getting invoked even if
          > > they are enclosed within {if} tags:
          > >
          > > {if $form}
          > > {input...}
          > > {/if}
          > >
          > > In the above case, the input tag is getting invoked even if
          $form is false!
          >
          > I don't know how Smarty handles {if} sections. Maybe the pre-filter
          > needs to be changed to also pre-process if sections. Try adding
          these
          > lines to the pre-filter and let me know if it works.
          >
          > $search=array(
          > ...
          > '/({\\/?if[^}]*})/i'
          > );
          > $replace=array(
          > ...
          > '{/capture}{insert name="formadddatapart"
          > data=$smarty.capture.formdata}\\1{capture name="formdata"}'
          > );

          Manuel,

          The above logic for handling {if} sections did not work. It is still
          giving the following error:

          unrecognized tag 'input' (Smarty_Compiler.class.php, line 580)


          Regards,




          --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
          >
          > Hello,
          >
          > on 04/27/2006 02:50 PM Shekar C. Reddy said the following:
          > > Manuel,
          > >
          > > I see the prefilter function replaces all {include}s with:
          > >
          > > '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
          > > {capture name="formdata"}'
          > >
          > > which means I'm not using {include} at all.
          >
          > No, \1 means the include appears there after the pre-filter is
          applied.
          >
          >
          > > I noticed an issue with
          > > the prefilter in case when I include a file and assign the data
          to a
          > > var like so:
          > >
          > > {include file='navbar.tpl' assign=navbar}
          > > {$navbar}
          > > {$navbar}
          > > <...content...>
          > > {$navbar}
          > > {$navbar}
          > > {$navbar}
          > >
          > > In the above case, the include line itself is displaying the
          navbar
          > > but not the {$navbar}. In other words, static/dynamic content
          that
          > > is included in the template in a straight-forward way is getting
          > > assigned to vars without a problem that we can place at several
          > > places in the template without having to re-include the file.
          But
          > > when I use the form class with the prefilter, the content is not
          > > getting assigned to the var forcing me to include the file
          multiple
          > > times.
          >
          > I think the problem is that the navbar.tpl data is captured by the
          > formdata variable, so what is assigned to your navbar variable is
          > probably an empty string.
          >
          > I think that if you use just {include file='navbar.tpl'} wherever
          you
          > need, it will work as intended.
          >
          >
          >
          > > 2. On another note, the {input} tags are getting invoked even if
          > > they are enclosed within {if} tags:
          > >
          > > {if $form}
          > > {input...}
          > > {/if}
          > >
          > > In the above case, the input tag is getting invoked even if
          $form is
          > > false!
          >
          > I don't know how Smarty handles {if} sections. Maybe the pre-filter
          > needs to be changed to also pre-process if sections. Try adding
          these
          > lines to the pre-filter and let me know if it works.
          >
          > $search=array(
          > ...
          > '/({\\/?if[^}]*})/i'
          > );
          > $replace=array(
          > ...
          > '{/capture}{insert name="formadddatapart"
          > data=$smarty.capture.formdata}\\1{capture name="formdata"}'
          > );
          >
          >
          >
          > --
          >
          > Regards,
          > Manuel Lemos
          >
          > Metastorage - Data object relational mapping layer generator
          > http://www.metastorage.net/
          >
          > PHP Classes - Free ready to use OOP components written in PHP
          > http://www.phpclasses.org/
        • Manuel Lemos
          Hello, ... What I meant is to add those two new entries in the $search and $replace array. You should not remove the other entries. -- Regards, Manuel Lemos
          Message 4 of 22 , May 3, 2006
            Hello,

            on 05/03/2006 02:11 PM Shekar C. Reddy said the following:
            >>> 2. On another note, the {input} tags are getting invoked even if
            >>> they are enclosed within {if} tags:
            >>>
            >>> {if $form}
            >>> {input...}
            >>> {/if}
            >>>
            >>> In the above case, the input tag is getting invoked even if
            > $form is false!
            >> I don't know how Smarty handles {if} sections. Maybe the pre-filter
            >> needs to be changed to also pre-process if sections. Try adding
            > these
            >> lines to the pre-filter and let me know if it works.
            >>
            >> $search=array(
            >> ...
            >> '/({\\/?if[^}]*})/i'
            >> );
            >> $replace=array(
            >> ...
            >> '{/capture}{insert name="formadddatapart"
            >> data=$smarty.capture.formdata}\\1{capture name="formdata"}'
            >> );
            >
            > Manuel,
            >
            > The above logic for handling {if} sections did not work. It is still
            > giving the following error:
            >
            > unrecognized tag 'input' (Smarty_Compiler.class.php, line 580)

            What I meant is to add those two new entries in the $search and $replace
            array. You should not remove the other entries.

            --

            Regards,
            Manuel Lemos

            Metastorage - Data object relational mapping layer generator
            http://www.metastorage.net/

            PHP Classes - Free ready to use OOP components written in PHP
            http://www.phpclasses.org/
          • Shekar C. Reddy
            Manuel, Yes, I appended those strings as elements at the end of each array (search/replace) while keeping the old ones. But it did not work. Could be a logic
            Message 5 of 22 , May 4, 2006
              Manuel,

              Yes, I appended those strings as elements at the end of each array
              (search/replace) while keeping the old ones. But it did not work.
              Could be a logic error and maybe we are 'this' close to squashing
              it. Unfortunately, I'm weak with regex.

              Regards,




              --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
              >
              > Hello,
              >
              > on 05/03/2006 02:11 PM Shekar C. Reddy said the following:
              > >>> 2. On another note, the {input} tags are getting invoked even
              if
              > >>> they are enclosed within {if} tags:
              > >>>
              > >>> {if $form}
              > >>> {input...}
              > >>> {/if}
              > >>>
              > >>> In the above case, the input tag is getting invoked even if
              > > $form is false!
              > >> I don't know how Smarty handles {if} sections. Maybe the pre-
              filter
              > >> needs to be changed to also pre-process if sections. Try adding
              > > these
              > >> lines to the pre-filter and let me know if it works.
              > >>
              > >> $search=array(
              > >> ...
              > >> '/({\\/?if[^}]*})/i'
              > >> );
              > >> $replace=array(
              > >> ...
              > >> '{/capture}{insert name="formadddatapart"
              > >> data=$smarty.capture.formdata}\\1{capture name="formdata"}'
              > >> );
              > >
              > > Manuel,
              > >
              > > The above logic for handling {if} sections did not work. It is
              still
              > > giving the following error:
              > >
              > > unrecognized tag 'input' (Smarty_Compiler.class.php, line 580)
              >
              > What I meant is to add those two new entries in the $search and
              $replace
              > array. You should not remove the other entries.
              >
              > --
              >
              > Regards,
              > Manuel Lemos
              >
              > Metastorage - Data object relational mapping layer generator
              > http://www.metastorage.net/
              >
              > PHP Classes - Free ready to use OOP components written in PHP
              > http://www.phpclasses.org/
              >
            • Manuel Lemos
              Hello, ... I do not see why it does not work. Can you get the compiled template file that Smarty generates so I can see what may not be working? -- Regards,
              Message 6 of 22 , May 9, 2006
                Hello,

                on 05/04/2006 11:19 AM Shekar C. Reddy said the following:
                > Manuel,
                >
                > Yes, I appended those strings as elements at the end of each array
                > (search/replace) while keeping the old ones. But it did not work.
                > Could be a logic error and maybe we are 'this' close to squashing
                > it. Unfortunately, I'm weak with regex.

                I do not see why it does not work. Can you get the compiled template
                file that Smarty generates so I can see what may not be working?

                --

                Regards,
                Manuel Lemos

                Metastorage - Data object relational mapping layer generator
                http://www.metastorage.net/

                PHP Classes - Free ready to use OOP components written in PHP
                http://www.phpclasses.org/
              • Shekar C. Reddy
                Manuel, Regret for the delay in responding. I tried to generate the compiled template file but for some reason, it is not generating the compiled file (maybe,
                Message 7 of 22 , May 29, 2006
                  Manuel,

                  Regret for the delay in responding. I tried to generate the compiled
                  template file but for some reason, it is not generating the compiled
                  file (maybe, loading from the memory itself) although I set
                  compile_check and force_compile to true.

                  Further, using the new prefilter that address the {if} tag, some of
                  the text within these tags is appearing at the TOP of the page
                  instead of a particular position.

                  Here is the code:

                  PREFILTER
                  ---------
                  $search = array(
                  '/{input\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                  '/{hiddeninput\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                  '/{label\s+for=("[^"]+"|\'[^\']+\'|\S+)}/i',
                  '/({include[^}]*})/i',
                  '/({\\/?if[^}]*})/i'
                  );
                  $replace = array(
                  '{/capture}{formaddinputpart input=\\1 data=$smarty.capture.formdata}
                  {capture name="formdata"}',
                  '{/capture}{formaddinputhiddenpart input=\\1
                  data=$smarty.capture.formdata}{capture name="formdata"}',
                  '{/capture}{formaddlabelpart for=\\1 data=$smarty.capture.formdata}
                  {capture name="formdata"}',
                  '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                  {capture name="formdata"}',
                  '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                  {capture name="formdata"}'
                  );


                  TEMPLATE
                  --------
                  {$header}
                  {$content}
                  {$message}
                  <table>
                  <tr>
                  <td>
                  {if $tools}
                  {foreach key=name item=toolbar from=$toolbar}
                  {input name="$name"}
                  {/foreach}
                  {/if}
                  </td>
                  </tr>
                  </table>
                  {$footer}


                  Template vars assigned to Smarty
                  --------------------------------
                  $smarty->assign('tools', 0);
                  $smarty->assign(array('save'=>'Save','cancel'=>'Cancel'), $toolbar);
                  $smarty->display('test-if.tpl');

                  Elements within the $toolbar are added as inputs if $tools is set to
                  true; otherwise, the page does not use form_class, at all (so no
                  inputs added in that case). I'm trying to get the {if} tag to skip
                  the {input} tags in the template if $tools is false. The idea is to
                  isolate the logic to toolbar.tpl that can be included in any
                  template without errors but the prefilter is not processing the {if}
                  tags properly. However, here is an earlier version that got compiled
                  (if that helps):

                  <?php /* Smarty version 2.6.11, created on 2006-05-29 08:35:15
                  compiled from test.tpl */ ?>
                  <?php echo $this->_tpl_vars['header']; ?>

                  <?php echo $this->_tpl_vars['content']; ?>

                  <table>
                  <tr>
                  <td>
                  <?php $_smarty_tpl_vars = $this->_tpl_vars;
                  $this->_smarty_include(array('smarty_include_tpl_file'
                  => 'toolbar.tpl', 'smarty_include_vars' => array('position'
                  => 'top')));
                  $this->_tpl_vars = $_smarty_tpl_vars;
                  unset($_smarty_tpl_vars);
                  ?>
                  <?php echo $this->_tpl_vars['message']; ?>

                  </td>
                  </tr>
                  </table>


                  OUTPUT
                  ------
                  <pre>
                  <b>Error</b>: 256 <br />
                  <b>Text </b>: Smarty error: [in test-if.tpl line 7]: syntax error:
                  unrecognized tag 'formadddatapart' (Smarty_Compiler.class.php, line
                  580) <br />
                  <b>File </b>: c:\web\library\smarty\Smarty.class.php <br />
                  <b>Line </b>: 1095 <br />
                  <b>Date </b>: May 29, 2006, 9:47 am <br />
                  <br />
                  <br />
                  <b>Backtrace</b>:<br />
                  <table border=1 cellspacing=0 cellpadding=2 bgcolor=eeeeee width=99%
                  ><tr>
                  <td><font face="Verdana, Tahoma"
                  size="2">Class</font></td>
                  <td><font face="Verdana, Tahoma"
                  size="2">Function</font></td>
                  <td><font face="Verdana, Tahoma"
                  size="2">Line</font></td>
                  <td><font face="Verdana, Tahoma"
                  size="2">File</font></td><tr><td><font face="Verdana, Tahoma"
                  size="1"></font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">trigger_error("Smarty error: [in test-if.tpl line
                  7]: syntax error: unrecognized tag 'formadddatapart'
                  (Smarty_Compiler.class.php, line 580)", "256")</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">1095</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                  td><font face="Verdana, Tahoma" size="1">Smarty</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">trigger_error("[in test-if.tpl line 7]: syntax
                  error: unrecognized tag 'formadddatapart'
                  (Smarty_Compiler.class.php, line 580)", "256")</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">1814</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                  td><font face="Verdana, Tahoma" size="1">Smarty</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">_trigger_fatal_error("syntax error: unrecognized
                  tag 'formadddatapart'", "test-
                  if.tpl", "7", "c:\web\library\smarty\Smarty_Compiler.class.php", "580
                  ", "256")</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">2202</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                  /tr><tr><td><font face="Verdana, Tahoma"
                  size="1">Smarty_Compiler</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">_syntax_error("unrecognized
                  tag 'formadddatapart'", "256", "c:\web\library\smarty\Smarty_Compiler
                  .class.php", "580")</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">580</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                  /tr><tr><td><font face="Verdana, Tahoma"
                  size="1">Smarty_Compiler</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">_compile_tag("formadddatapart
                  data=$smarty.capture.formdata")</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">312</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                  /tr><tr><td><font face="Verdana, Tahoma"
                  size="1">Smarty_Compiler</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">_compile_file("test-if.tpl", "{$header}
                  {$content}
                  {$message}
                  <table>
                  <tr>
                  <td>
                  {if $tools}
                  {foreach key=name item=toolbar
                  from=$toolbar}
                  {input
                  name="$name"}
                  {/foreach}
                  {/if}
                  </td>
                  </tr>
                  <tr>
                  </table>", null)</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">1491</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                  td><font face="Verdana, Tahoma" size="1">Smarty</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">_compile_source("test-if.tpl", "{$header}
                  {$content}
                  {$message}
                  <table>
                  <tr>
                  <td>
                  {if $tools}
                  {foreach key=name item=toolbar
                  from=$toolbar}
                  {input
                  name="$name"}
                  {/foreach}
                  {/if}
                  </td>
                  </tr>
                  <tr>
                  </table>", null, "C:/Documents and Settings/Shawn/My
                  Documents/web/dev\temp\compile\%%CC^CC1^CC14DFC8%%test-if.tpl.inc")
                  </font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">1424</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                  td><font face="Verdana, Tahoma" size="1">Smarty</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">_compile_resource("test-if.tpl", "C:/Documents and
                  Settings/Shawn/My Documents/web/dev\temp\compile\%%CC^CC1^CC14DFC8%%
                  test-if.tpl.php")</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">1256</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                  td><font face="Verdana, Tahoma" size="1">Smarty</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">fetch("test-if.tpl", null, null, true)</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">1108</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                  td><font face="Verdana, Tahoma" size="1">Smarty</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">display("test-if.tpl")</font>
                  </td><td><font face="Verdana,
                  Tahoma" size="1">244</font>
                  </td><td><font face="Verdana,
                  Tahoma"
                  size="1">c:\web\dev\www\index.html</font></td></tr></tr></table><br /
                  >
                  <br />
                  </pre><pre><b><u><font
                  color='red'>CONTEXT</font></u></b></pre><pre>Array
                  (
                  [error_msg] => [in test-if.tpl line 7]: syntax error:
                  unrecognized tag 'formadddatapart' (Smarty_Compiler.class.php, line
                  580)
                  [error_type] => 256
                  )
                  </pre><br />

                  --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
                  >
                  > Hello,
                  >
                  > on 05/04/2006 11:19 AM Shekar C. Reddy said the following:
                  > > Manuel,
                  > >
                  > > Yes, I appended those strings as elements at the end of each
                  array
                  > > (search/replace) while keeping the old ones. But it did not
                  work.
                  > > Could be a logic error and maybe we are 'this' close to
                  squashing
                  > > it. Unfortunately, I'm weak with regex.
                  >
                  > I do not see why it does not work. Can you get the compiled
                  template
                  > file that Smarty generates so I can see what may not be working?
                  >
                  > --
                  >
                  > Regards,
                  > Manuel Lemos
                  >
                  > Metastorage - Data object relational mapping layer generator
                  > http://www.metastorage.net/
                  >
                  > PHP Classes - Free ready to use OOP components written in PHP
                  > http://www.phpclasses.org/
                  >
                • Shekar C. Reddy
                  Manuel, Regret for the delay in responding. I tried to generate the compiled template file but for some reason, it is not generating the compiled file (maybe,
                  Message 8 of 22 , May 29, 2006
                    Manuel,

                    Regret for the delay in responding. I tried to generate the compiled
                    template file but for some reason, it is not generating the compiled
                    file (maybe, loading from the memory itself) although I set
                    compile_check and force_compile to true.

                    Further, using the new prefilter that address the {if} tag, some of
                    the text within these tags is appearing at the TOP of the page
                    instead of a particular position.

                    Here is the code:

                    PREFILTER
                    ---------
                    $search = array(
                    '/{input\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                    '/{hiddeninput\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                    '/{label\s+for=("[^"]+"|\'[^\']+\'|\S+)}/i',
                    '/({include[^}]*})/i',
                    '/({\\/?if[^}]*})/i'
                    );
                    $replace = array(
                    '{/capture}{formaddinputpart input=\\1 data=$smarty.capture.formdata}
                    {capture name="formdata"}',
                    '{/capture}{formaddinputhiddenpart input=\\1
                    data=$smarty.capture.formdata}{capture name="formdata"}',
                    '{/capture}{formaddlabelpart for=\\1 data=$smarty.capture.formdata}
                    {capture name="formdata"}',
                    '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                    {capture name="formdata"}',
                    '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                    {capture name="formdata"}'
                    );


                    TEMPLATE
                    --------
                    {$header}
                    {$content}
                    {$message}
                    <table>
                    <tr>
                    <td>
                    {if $tools}
                    {foreach key=name item=toolbar from=$toolbar}
                    {input name="$name"}
                    {/foreach}
                    {/if}
                    </td>
                    </tr>
                    </table>
                    {$footer}


                    Template vars assigned to Smarty
                    --------------------------------
                    $smarty->assign('tools', 0);
                    $smarty->assign('toolbar', array('save'=>'Save','cancel'=>'Cancel'));
                    $smarty->display('test-if.tpl');

                    Elements within the $toolbar are added as inputs if $tools is set to
                    true; otherwise, the page does not use form_class, at all (so no
                    inputs added in that case). I'm trying to get the {if} tag to skip
                    the {input} tags in the template if $tools is false. The idea is to
                    isolate the logic to toolbar.tpl that can be included in any
                    template without errors but the prefilter is not processing the {if}
                    tags properly. However, here are two previously compiled files that
                    have their $tools var set to true (if that helps):

                    <?php echo $this->_tpl_vars['header']; ?>
                    <?php echo $this->_tpl_vars['content']; ?>
                    <table>
                    <tr>
                    <td>
                    <?php $_smarty_tpl_vars = $this->_tpl_vars;
                    $this->_smarty_include(array('smarty_include_tpl_file'
                    => 'toolbar.tpl', 'smarty_include_vars' => array('position'
                    => 'top')));
                    $this->_tpl_vars = $_smarty_tpl_vars;
                    unset($_smarty_tpl_vars);
                    ?>
                    <?php echo $this->_tpl_vars['message']; ?>

                    </td>
                    </tr>
                    </table>
                    ........................................
                    <?php if ($this->_tpl_vars['tools']): ?>
                    <?php ob_start();
                    $_smarty_tpl_vars = $this->_tpl_vars;
                    $this->_smarty_include(array('smarty_include_tpl_file'
                    => 'toolbar.tpl', 'smarty_include_vars' => array()));
                    $this->_tpl_vars = $_smarty_tpl_vars;
                    unset($_smarty_tpl_vars);
                    $this->assign('toolbar', ob_get_contents());
                    ob_end_clean();
                    endif;


                    OUTPUT
                    ------
                    <pre>
                    <b>Error</b>: 256 <br />
                    <b>Text </b>: Smarty error: [in test-if.tpl line 7]: syntax error:
                    unrecognized tag 'formadddatapart' (Smarty_Compiler.class.php, line
                    580) <br />
                    <b>File </b>: c:\web\library\smarty\Smarty.class.php <br />
                    <b>Line </b>: 1095 <br />
                    <b>Date </b>: May 29, 2006, 9:47 am <br />
                    <br />
                    <br />
                    <b>Backtrace</b>:<br />
                    <table border=1 cellspacing=0 cellpadding=2 bgcolor=eeeeee width=99%
                    ><tr>
                    <td><font face="Verdana, Tahoma"
                    size="2">Class</font></td>
                    <td><font face="Verdana, Tahoma"
                    size="2">Function</font></td>
                    <td><font face="Verdana, Tahoma"
                    size="2">Line</font></td>
                    <td><font face="Verdana, Tahoma"
                    size="2">File</font></td><tr><td><font face="Verdana, Tahoma"
                    size="1"></font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">trigger_error("Smarty error: [in test-if.tpl line
                    7]: syntax error: unrecognized tag 'formadddatapart'
                    (Smarty_Compiler.class.php, line 580)", "256")</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">1095</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                    td><font face="Verdana, Tahoma" size="1">Smarty</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">trigger_error("[in test-if.tpl line 7]: syntax
                    error: unrecognized tag 'formadddatapart'
                    (Smarty_Compiler.class.php, line 580)", "256")</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">1814</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                    td><font face="Verdana, Tahoma" size="1">Smarty</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">_trigger_fatal_error("syntax error: unrecognized
                    tag 'formadddatapart'", "test-
                    if.tpl", "7", "c:\web\library\smarty\Smarty_Compiler.class.php", "580
                    ", "256")</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">2202</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                    /tr><tr><td><font face="Verdana, Tahoma"
                    size="1">Smarty_Compiler</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">_syntax_error("unrecognized
                    tag 'formadddatapart'", "256", "c:\web\library\smarty\Smarty_Compiler
                    .class.php", "580")</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">580</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                    /tr><tr><td><font face="Verdana, Tahoma"
                    size="1">Smarty_Compiler</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">_compile_tag("formadddatapart
                    data=$smarty.capture.formdata")</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">312</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                    /tr><tr><td><font face="Verdana, Tahoma"
                    size="1">Smarty_Compiler</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">_compile_file("test-if.tpl", "{$header}
                    {$content}
                    {$message}
                    <table>
                    <tr>
                    <td>
                    {if $tools}
                    {foreach key=name item=toolbar
                    from=$toolbar}
                    {input
                    name="$name"}
                    {/foreach}
                    {/if}
                    </td>
                    </tr>
                    <tr>
                    </table>", null)</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">1491</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                    td><font face="Verdana, Tahoma" size="1">Smarty</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">_compile_source("test-if.tpl", "{$header}
                    {$content}
                    {$message}
                    <table>
                    <tr>
                    <td>
                    {if $tools}
                    {foreach key=name item=toolbar
                    from=$toolbar}
                    {input
                    name="$name"}
                    {/foreach}
                    {/if}
                    </td>
                    </tr>
                    <tr>
                    </table>", null, "C:/Documents and Settings/Shawn/My
                    Documents/web/dev\temp\compile\%%CC^CC1^CC14DFC8%%test-if.tpl.inc")
                    </font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">1424</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                    td><font face="Verdana, Tahoma" size="1">Smarty</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">_compile_resource("test-if.tpl", "C:/Documents and
                    Settings/Shawn/My Documents/web/dev\temp\compile\%%CC^CC1^CC14DFC8%%
                    test-if.tpl.php")</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">1256</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                    td><font face="Verdana, Tahoma" size="1">Smarty</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">fetch("test-if.tpl", null, null, true)</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">1108</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                    td><font face="Verdana, Tahoma" size="1">Smarty</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">display("test-if.tpl")</font>
                    </td><td><font face="Verdana,
                    Tahoma" size="1">244</font>
                    </td><td><font face="Verdana,
                    Tahoma"
                    size="1">c:\web\dev\www\index.html</font></td></tr></tr></table><br /
                    >
                    <br />
                    </pre><pre><b><u><font
                    color='red'>CONTEXT</font></u></b></pre><pre>Array
                    (
                    [error_msg] => [in test-if.tpl line 7]: syntax error:
                    unrecognized tag 'formadddatapart' (Smarty_Compiler.class.php, line
                    580)
                    [error_type] => 256
                    )
                    </pre><br />




                    --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
                    >
                    > Hello,
                    >
                    > on 05/04/2006 11:19 AM Shekar C. Reddy said the following:
                    > > Manuel,
                    > >
                    > > Yes, I appended those strings as elements at the end of each
                    array
                    > > (search/replace) while keeping the old ones. But it did not
                    work.
                    > > Could be a logic error and maybe we are 'this' close to
                    squashing
                    > > it. Unfortunately, I'm weak with regex.
                    >
                    > I do not see why it does not work. Can you get the compiled
                    template
                    > file that Smarty generates so I can see what may not be working?
                    >
                    > --
                    >
                    > Regards,
                    > Manuel Lemos
                    >
                    > Metastorage - Data object relational mapping layer generator
                    > http://www.metastorage.net/
                    >
                    > PHP Classes - Free ready to use OOP components written in PHP
                    > http://www.phpclasses.org/
                    >
                  • Manuel Lemos
                    Hello, ... I think you are looking at the wrong Smarty directories. ... As explained in the example, do not process the form template directly with the page
                    Message 9 of 22 , Jun 7, 2006
                      Hello,

                      on 05/29/2006 11:17 AM Shekar C. Reddy said the following:
                      > Manuel,
                      >
                      > Regret for the delay in responding. I tried to generate the compiled
                      > template file but for some reason, it is not generating the compiled
                      > file (maybe, loading from the memory itself) although I set
                      > compile_check and force_compile to true.

                      I think you are looking at the wrong Smarty directories.


                      > Further, using the new prefilter that address the {if} tag, some of
                      > the text within these tags is appearing at the TOP of the page
                      > instead of a particular position.
                      >
                      > Here is the code:
                      >
                      > PREFILTER
                      > ---------
                      > $search = array(
                      > '/{input\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                      > '/{hiddeninput\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                      > '/{label\s+for=("[^"]+"|\'[^\']+\'|\S+)}/i',
                      > '/({include[^}]*})/i',
                      > '/({\\/?if[^}]*})/i'
                      > );
                      > $replace = array(
                      > '{/capture}{formaddinputpart input=\\1 data=$smarty.capture.formdata}
                      > {capture name="formdata"}',
                      > '{/capture}{formaddinputhiddenpart input=\\1
                      > data=$smarty.capture.formdata}{capture name="formdata"}',
                      > '{/capture}{formaddlabelpart for=\\1 data=$smarty.capture.formdata}
                      > {capture name="formdata"}',
                      > '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                      > {capture name="formdata"}',
                      > '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                      > {capture name="formdata"}'
                      > );
                      >
                      >
                      > TEMPLATE
                      > --------
                      > {$header}
                      > {$content}
                      > {$message}
                      > <table>
                      > <tr>
                      > <td>
                      > {if $tools}
                      > {foreach key=name item=toolbar from=$toolbar}
                      > {input name="$name"}
                      > {/foreach}
                      > {/if}
                      > </td>
                      > </tr>
                      > </table>
                      > {$footer}

                      As explained in the example, do not process the form template directly
                      with the page template.


                      > Template vars assigned to Smarty
                      > --------------------------------
                      > $smarty->assign('tools', 0);
                      > $smarty->assign(array('save'=>'Save','cancel'=>'Cancel'), $toolbar);
                      > $smarty->display('test-if.tpl');

                      Do not use display, use fetch instead. Please look at the example script
                      first.


                      > Elements within the $toolbar are added as inputs if $tools is set to
                      > true; otherwise, the page does not use form_class, at all (so no
                      > inputs added in that case). I'm trying to get the {if} tag to skip
                      > the {input} tags in the template if $tools is false. The idea is to
                      > isolate the logic to toolbar.tpl that can be included in any
                      > template without errors but the prefilter is not processing the {if}
                      > tags properly. However, here is an earlier version that got compiled
                      > (if that helps):
                      >
                      > <?php /* Smarty version 2.6.11, created on 2006-05-29 08:35:15
                      > compiled from test.tpl */ ?>
                      > <?php echo $this->_tpl_vars['header']; ?>
                      >
                      > <?php echo $this->_tpl_vars['content']; ?>
                      >
                      > <table>
                      > <tr>
                      > <td>
                      > <?php $_smarty_tpl_vars = $this->_tpl_vars;
                      > $this->_smarty_include(array('smarty_include_tpl_file'
                      > => 'toolbar.tpl', 'smarty_include_vars' => array('position'
                      > => 'top')));
                      > $this->_tpl_vars = $_smarty_tpl_vars;
                      > unset($_smarty_tpl_vars);
                      > ?>
                      > <?php echo $this->_tpl_vars['message']; ?>
                      >
                      > </td>
                      > </tr>
                      > </table>

                      This is not the result of the form template compilation.


                      --

                      Regards,
                      Manuel Lemos

                      Metastorage - Data object relational mapping layer generator
                      http://www.metastorage.net/

                      PHP Classes - Free ready to use OOP components written in PHP
                      http://www.phpclasses.org/
                    • Shekar C. Reddy
                      Manuel, Regret for the delay in replying as I was moved to another project. I ve pasted the compiled output of the toolbar.tpl:
                      Message 10 of 22 , Jul 24, 2006
                        Manuel,

                        Regret for the delay in replying as I was moved to another project. I've pasted the
                        compiled output of the toolbar.tpl:

                        <?php /* Smarty version 2.6.11, created on 2006-06-08 02:55:10
                        compiled from toolbar.tpl */ ?>
                        <?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
                        smarty_core_load_plugins(array('plugins' => array(array('modifier', 'default', 'toolbar.tpl', 8,
                        false),array('function', 'formaddinputpart', 'toolbar.tpl', 63, false),array('function',
                        'formadddatapart', 'toolbar.tpl', 118, false),)), $this); ?>
                        <?php ob_start(); ?>

                        <?php if ($this->_tpl_vars['type'] == 'form'): ?>

                        <?php $_from = $this->_tpl_vars['toolbar']; if (!is_array($_from) && !is_object($_from))
                        { settype($_from, 'array'); }if (count($_from)):
                        foreach ($_from as $this->_tpl_vars['name'] => $this->_tpl_vars['toolbar']):
                        ?>
                        <?php $this->_smarty_vars['capture']['formdata'] = ob_get_contents(); ob_end_clean
                        (); echo smarty_insert_formaddinputpart(array('input' => ($this->_tpl_vars['name']),'data'
                        => $this->_smarty_vars['capture']['formdata']), $this); ob_start(); ?>
                        <?php endforeach; unset($_from); ?>

                        <?php endif; ?>



                        Please note I have been using the code precisely as included in your example files using
                        Smarty successfully without any issues except or the {if} tag that did not work as expected.
                        So far, so good! But when I added the 'if' to the prefilter as suggested by you, it is not
                        skipping the line of code that has the conditional and running into errors if the type is not
                        'fom' as in the above code.

                        Further, when I place some text between a {if} tag, the text is rendered at the top-most of
                        the page - outside every other table - as the first line in the output instead of displaying
                        at the current position in the template.

                        On another note, I've noticed that the page that used to take 1.2 secs to render earlier is
                        taking 2.0 secs with the if prefilter (caching turned off).

                        You could try this if prefilter yourself and please let me know.

                        Thanks and regards,




                        --- In forms-dev@yahoogroups.com, "Shekar C. Reddy" <zendfw@...> wrote:
                        >
                        > Manuel,
                        >
                        > Regret for the delay in responding. I tried to generate the compiled
                        > template file but for some reason, it is not generating the compiled
                        > file (maybe, loading from the memory itself) although I set
                        > compile_check and force_compile to true.
                        >
                        > Further, using the new prefilter that address the {if} tag, some of
                        > the text within these tags is appearing at the TOP of the page
                        > instead of a particular position.
                        >
                        > Here is the code:
                        >
                        > PREFILTER
                        > ---------
                        > $search = array(
                        > '/{input\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                        > '/{hiddeninput\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                        > '/{label\s+for=("[^"]+"|\'[^\']+\'|\S+)}/i',
                        > '/({include[^}]*})/i',
                        > '/({\\/?if[^}]*})/i'
                        > );
                        > $replace = array(
                        > '{/capture}{formaddinputpart input=\\1 data=$smarty.capture.formdata}
                        > {capture name="formdata"}',
                        > '{/capture}{formaddinputhiddenpart input=\\1
                        > data=$smarty.capture.formdata}{capture name="formdata"}',
                        > '{/capture}{formaddlabelpart for=\\1 data=$smarty.capture.formdata}
                        > {capture name="formdata"}',
                        > '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                        > {capture name="formdata"}',
                        > '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                        > {capture name="formdata"}'
                        > );
                        >
                        >
                        > TEMPLATE
                        > --------
                        > {$header}
                        > {$content}
                        > {$message}
                        > <table>
                        > <tr>
                        > <td>
                        > {if $tools}
                        > {foreach key=name item=toolbar from=$toolbar}
                        > {input name="$name"}
                        > {/foreach}
                        > {/if}
                        > </td>
                        > </tr>
                        > </table>
                        > {$footer}
                        >
                        >
                        > Template vars assigned to Smarty
                        > --------------------------------
                        > $smarty->assign('tools', 0);
                        > $smarty->assign('toolbar', array('save'=>'Save','cancel'=>'Cancel'));
                        > $smarty->display('test-if.tpl');
                        >
                        > Elements within the $toolbar are added as inputs if $tools is set to
                        > true; otherwise, the page does not use form_class, at all (so no
                        > inputs added in that case). I'm trying to get the {if} tag to skip
                        > the {input} tags in the template if $tools is false. The idea is to
                        > isolate the logic to toolbar.tpl that can be included in any
                        > template without errors but the prefilter is not processing the {if}
                        > tags properly. However, here are two previously compiled files that
                        > have their $tools var set to true (if that helps):
                        >
                        > <?php echo $this->_tpl_vars['header']; ?>
                        > <?php echo $this->_tpl_vars['content']; ?>
                        > <table>
                        > <tr>
                        > <td>
                        > <?php $_smarty_tpl_vars = $this->_tpl_vars;
                        > $this->_smarty_include(array('smarty_include_tpl_file'
                        > => 'toolbar.tpl', 'smarty_include_vars' => array('position'
                        > => 'top')));
                        > $this->_tpl_vars = $_smarty_tpl_vars;
                        > unset($_smarty_tpl_vars);
                        > ?>
                        > <?php echo $this->_tpl_vars['message']; ?>
                        >
                        > </td>
                        > </tr>
                        > </table>
                        > ........................................
                        > <?php if ($this->_tpl_vars['tools']): ?>
                        > <?php ob_start();
                        > $_smarty_tpl_vars = $this->_tpl_vars;
                        > $this->_smarty_include(array('smarty_include_tpl_file'
                        > => 'toolbar.tpl', 'smarty_include_vars' => array()));
                        > $this->_tpl_vars = $_smarty_tpl_vars;
                        > unset($_smarty_tpl_vars);
                        > $this->assign('toolbar', ob_get_contents());
                        > ob_end_clean();
                        > endif;
                        >
                        >
                        > OUTPUT
                        > ------
                        > <pre>
                        > <b>Error</b>: 256 <br />
                        > <b>Text </b>: Smarty error: [in test-if.tpl line 7]: syntax error:
                        > unrecognized tag 'formadddatapart' (Smarty_Compiler.class.php, line
                        > 580) <br />
                        > <b>File </b>: c:\web\library\smarty\Smarty.class.php <br />
                        > <b>Line </b>: 1095 <br />
                        > <b>Date </b>: May 29, 2006, 9:47 am <br />
                        > <br />
                        > <br />
                        > <b>Backtrace</b>:<br />
                        > <table border=1 cellspacing=0 cellpadding=2 bgcolor=eeeeee width=99%
                        > ><tr>
                        > <td><font face="Verdana, Tahoma"
                        > size="2">Class</font></td>
                        > <td><font face="Verdana, Tahoma"
                        > size="2">Function</font></td>
                        > <td><font face="Verdana, Tahoma"
                        > size="2">Line</font></td>
                        > <td><font face="Verdana, Tahoma"
                        > size="2">File</font></td><tr><td><font face="Verdana, Tahoma"
                        > size="1"></font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">trigger_error("Smarty error: [in test-if.tpl line
                        > 7]: syntax error: unrecognized tag 'formadddatapart'
                        > (Smarty_Compiler.class.php, line 580)", "256")</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">1095</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                        > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">trigger_error("[in test-if.tpl line 7]: syntax
                        > error: unrecognized tag 'formadddatapart'
                        > (Smarty_Compiler.class.php, line 580)", "256")</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">1814</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                        > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">_trigger_fatal_error("syntax error: unrecognized
                        > tag 'formadddatapart'", "test-
                        > if.tpl", "7", "c:\web\library\smarty\Smarty_Compiler.class.php", "580
                        > ", "256")</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">2202</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                        > /tr><tr><td><font face="Verdana, Tahoma"
                        > size="1">Smarty_Compiler</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">_syntax_error("unrecognized
                        > tag 'formadddatapart'", "256", "c:\web\library\smarty\Smarty_Compiler
                        > .class.php", "580")</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">580</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                        > /tr><tr><td><font face="Verdana, Tahoma"
                        > size="1">Smarty_Compiler</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">_compile_tag("formadddatapart
                        > data=$smarty.capture.formdata")</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">312</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                        > /tr><tr><td><font face="Verdana, Tahoma"
                        > size="1">Smarty_Compiler</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">_compile_file("test-if.tpl", "{$header}
                        > {$content}
                        > {$message}
                        > <table>
                        > <tr>
                        > <td>
                        > {if $tools}
                        > {foreach key=name item=toolbar
                        > from=$toolbar}
                        > {input
                        > name="$name"}
                        > {/foreach}
                        > {/if}
                        > </td>
                        > </tr>
                        > <tr>
                        > </table>", null)</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">1491</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                        > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">_compile_source("test-if.tpl", "{$header}
                        > {$content}
                        > {$message}
                        > <table>
                        > <tr>
                        > <td>
                        > {if $tools}
                        > {foreach key=name item=toolbar
                        > from=$toolbar}
                        > {input
                        > name="$name"}
                        > {/foreach}
                        > {/if}
                        > </td>
                        > </tr>
                        > <tr>
                        > </table>", null, "C:/Documents and Settings/Shawn/My
                        > Documents/web/dev\temp\compile\%%CC^CC1^CC14DFC8%%test-if.tpl.inc")
                        > </font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">1424</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                        > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">_compile_resource("test-if.tpl", "C:/Documents and
                        > Settings/Shawn/My Documents/web/dev\temp\compile\%%CC^CC1^CC14DFC8%%
                        > test-if.tpl.php")</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">1256</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                        > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">fetch("test-if.tpl", null, null, true)</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">1108</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                        > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">display("test-if.tpl")</font>
                        > </td><td><font face="Verdana,
                        > Tahoma" size="1">244</font>
                        > </td><td><font face="Verdana,
                        > Tahoma"
                        > size="1">c:\web\dev\www\index.html</font></td></tr></tr></table><br /
                        > >
                        > <br />
                        > </pre><pre><b><u><font
                        > color='red'>CONTEXT</font></u></b></pre><pre>Array
                        > (
                        > [error_msg] => [in test-if.tpl line 7]: syntax error:
                        > unrecognized tag 'formadddatapart' (Smarty_Compiler.class.php, line
                        > 580)
                        > [error_type] => 256
                        > )
                        > </pre><br />
                        >
                        >
                        >
                        >
                        > --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@> wrote:
                        > >
                        > > Hello,
                        > >
                        > > on 05/04/2006 11:19 AM Shekar C. Reddy said the following:
                        > > > Manuel,
                        > > >
                        > > > Yes, I appended those strings as elements at the end of each
                        > array
                        > > > (search/replace) while keeping the old ones. But it did not
                        > work.
                        > > > Could be a logic error and maybe we are 'this' close to
                        > squashing
                        > > > it. Unfortunately, I'm weak with regex.
                        > >
                        > > I do not see why it does not work. Can you get the compiled
                        > template
                        > > file that Smarty generates so I can see what may not be working?
                        > >
                        > > --
                        > >
                        > > Regards,
                        > > Manuel Lemos
                        > >
                        > > Metastorage - Data object relational mapping layer generator
                        > > http://www.metastorage.net/
                        > >
                        > > PHP Classes - Free ready to use OOP components written in PHP
                        > > http://www.phpclasses.org/
                        > >
                        >
                      • Shekar C. Reddy
                        Manuel, Would you be able to help me with this issue? Thanks much in advance... ... I ve pasted the ... ( modifier , default , toolbar.tpl , 8, ...
                        Message 11 of 22 , Aug 4, 2006
                          Manuel,

                          Would you be able to help me with this issue?

                          Thanks much in advance...




                          --- In forms-dev@yahoogroups.com, "Shekar C. Reddy" <zendfw@...>
                          wrote:
                          >
                          > Manuel,
                          >
                          > Regret for the delay in replying as I was moved to another project.
                          I've pasted the
                          > compiled output of the toolbar.tpl:
                          >
                          > <?php /* Smarty version 2.6.11, created on 2006-06-08 02:55:10
                          > compiled from toolbar.tpl */ ?>
                          > <?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
                          > smarty_core_load_plugins(array('plugins' => array(array
                          ('modifier', 'default', 'toolbar.tpl', 8,
                          > false),array('function', 'formaddinputpart', 'toolbar.tpl', 63,
                          false),array('function',
                          > 'formadddatapart', 'toolbar.tpl', 118, false),)), $this); ?>
                          > <?php ob_start(); ?>
                          >
                          > <?php if ($this->_tpl_vars['type'] == 'form'): ?>
                          >
                          > <?php $_from = $this->_tpl_vars['toolbar']; if (!is_array($_from)
                          && !is_object($_from))
                          > { settype($_from, 'array'); }if (count($_from)):
                          > foreach ($_from as $this->_tpl_vars['name'] => $this->_tpl_vars
                          ['toolbar']):
                          > ?>
                          > <?php $this->_smarty_vars['capture']['formdata'] =
                          ob_get_contents(); ob_end_clean
                          > (); echo smarty_insert_formaddinputpart(array('input' => ($this-
                          >_tpl_vars['name']),'data'
                          > => $this->_smarty_vars['capture']['formdata']), $this); ob_start
                          (); ?>
                          > <?php endforeach; unset($_from); ?>
                          >
                          > <?php endif; ?>
                          >
                          >
                          >
                          > Please note I have been using the code precisely as included in
                          your example files using
                          > Smarty successfully without any issues except or the {if} tag that
                          did not work as expected.
                          > So far, so good! But when I added the 'if' to the prefilter as
                          suggested by you, it is not
                          > skipping the line of code that has the conditional and running into
                          errors if the type is not
                          > 'fom' as in the above code.
                          >
                          > Further, when I place some text between a {if} tag, the text is
                          rendered at the 'top-most' of
                          > the page - outside every other table - as the first line in the
                          output instead of displaying
                          > at the current position in the template.
                          >
                          > On another note, I've noticed that the page that used to take 1.2
                          secs to render earlier is
                          > taking 2.0 secs with the if prefilter added (caching turned off).
                          >
                          > You could try this if prefilter yourself and please let me know.
                          >
                          > Thanks and regards,
                          >
                          >
                          >
                          >
                          > --- In forms-dev@yahoogroups.com, "Shekar C. Reddy" <zendfw@> wrote:
                          > >
                          > > Manuel,
                          > >
                          > > Regret for the delay in responding. I tried to generate the
                          compiled
                          > > template file but for some reason, it is not generating the
                          compiled
                          > > file (maybe, loading from the memory itself) although I set
                          > > compile_check and force_compile to true.
                          > >
                          > > Further, using the new prefilter that address the {if} tag, some
                          of
                          > > the text within these tags is appearing at the TOP of the page
                          > > instead of a particular position.
                          > >
                          > > Here is the code:
                          > >
                          > > PREFILTER
                          > > ---------
                          > > $search = array(
                          > > '/{input\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                          > > '/{hiddeninput\s+name=("[^"]+"|\'[^\']+\'|\S+)}/i',
                          > > '/{label\s+for=("[^"]+"|\'[^\']+\'|\S+)}/i',
                          > > '/({include[^}]*})/i',
                          > > '/({\\/?if[^}]*})/i'
                          > > );
                          > > $replace = array(
                          > > '{/capture}{formaddinputpart input=\\1
                          data=$smarty.capture.formdata}
                          > > {capture name="formdata"}',
                          > > '{/capture}{formaddinputhiddenpart input=\\1
                          > > data=$smarty.capture.formdata}{capture name="formdata"}',
                          > > '{/capture}{formaddlabelpart for=\\1
                          data=$smarty.capture.formdata}
                          > > {capture name="formdata"}',
                          > > '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                          > > {capture name="formdata"}',
                          > > '{/capture}{formadddatapart data=$smarty.capture.formdata}\\1
                          > > {capture name="formdata"}'
                          > > );
                          > >
                          > >
                          > > TEMPLATE
                          > > --------
                          > > {$header}
                          > > {$content}
                          > > {$message}
                          > > <table>
                          > > <tr>
                          > > <td>
                          > > {if $tools}
                          > > {foreach key=name item=toolbar from=$toolbar}
                          > > {input name="$name"}
                          > > {/foreach}
                          > > {/if}
                          > > </td>
                          > > </tr>
                          > > </table>
                          > > {$footer}
                          > >
                          > >
                          > > Template vars assigned to Smarty
                          > > --------------------------------
                          > > $smarty->assign('tools', 0);
                          > > $smarty->assign('toolbar', array
                          ('save'=>'Save','cancel'=>'Cancel'));
                          > > $smarty->display('test-if.tpl');
                          > >
                          > > Elements within the $toolbar are added as inputs if $tools is set
                          to
                          > > true; otherwise, the page does not use form_class, at all (so no
                          > > inputs added in that case). I'm trying to get the {if} tag to skip
                          > > the {input} tags in the template if $tools is false. The idea is
                          to
                          > > isolate the logic to toolbar.tpl that can be included in any
                          > > template without errors but the prefilter is not processing the
                          {if}
                          > > tags properly. However, here are two previously compiled files
                          that
                          > > have their $tools var set to true (if that helps):
                          > >
                          > > <?php echo $this->_tpl_vars['header']; ?>
                          > > <?php echo $this->_tpl_vars['content']; ?>
                          > > <table>
                          > > <tr>
                          > > <td>
                          > > <?php $_smarty_tpl_vars = $this->_tpl_vars;
                          > > $this->_smarty_include(array('smarty_include_tpl_file'
                          > > => 'toolbar.tpl', 'smarty_include_vars' => array('position'
                          > > => 'top')));
                          > > $this->_tpl_vars = $_smarty_tpl_vars;
                          > > unset($_smarty_tpl_vars);
                          > > ?>
                          > > <?php echo $this->_tpl_vars['message']; ?>
                          > >
                          > > </td>
                          > > </tr>
                          > > </table>
                          > > ........................................
                          > > <?php if ($this->_tpl_vars['tools']): ?>
                          > > <?php ob_start();
                          > > $_smarty_tpl_vars = $this->_tpl_vars;
                          > > $this->_smarty_include(array('smarty_include_tpl_file'
                          > > => 'toolbar.tpl', 'smarty_include_vars' => array()));
                          > > $this->_tpl_vars = $_smarty_tpl_vars;
                          > > unset($_smarty_tpl_vars);
                          > > $this->assign('toolbar', ob_get_contents());
                          > > ob_end_clean();
                          > > endif;
                          > >
                          > >
                          > > OUTPUT
                          > > ------
                          > > <pre>
                          > > <b>Error</b>: 256 <br />
                          > > <b>Text </b>: Smarty error: [in test-if.tpl line 7]: syntax error:
                          > > unrecognized tag 'formadddatapart' (Smarty_Compiler.class.php,
                          line
                          > > 580) <br />
                          > > <b>File </b>: c:\web\library\smarty\Smarty.class.php <br />
                          > > <b>Line </b>: 1095 <br />
                          > > <b>Date </b>: May 29, 2006, 9:47 am <br />
                          > > <br />
                          > > <br />
                          > > <b>Backtrace</b>:<br />
                          > > <table border=1 cellspacing=0 cellpadding=2 bgcolor=eeeeee
                          width=99%
                          > > ><tr>
                          > > <td><font face="Verdana, Tahoma"
                          > > size="2">Class</font></td>
                          > > <td><font face="Verdana, Tahoma"
                          > > size="2">Function</font></td>
                          > > <td><font face="Verdana, Tahoma"
                          > > size="2">Line</font></td>
                          > > <td><font face="Verdana, Tahoma"
                          > > size="2">File</font></td><tr><td><font face="Verdana, Tahoma"
                          > > size="1"></font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">trigger_error("Smarty error: [in test-if.tpl line
                          > > 7]: syntax error: unrecognized tag 'formadddatapart'
                          > > (Smarty_Compiler.class.php, line 580)", "256")</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">1095</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                          > > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">trigger_error("[in test-if.tpl line 7]: syntax
                          > > error: unrecognized tag 'formadddatapart'
                          > > (Smarty_Compiler.class.php, line 580)", "256")</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">1814</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                          > > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">_trigger_fatal_error("syntax error: unrecognized
                          > > tag 'formadddatapart'", "test-
                          > >
                          if.tpl", "7", "c:\web\library\smarty\Smarty_Compiler.class.php", "580
                          > > ", "256")</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">2202</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                          > > /tr><tr><td><font face="Verdana, Tahoma"
                          > > size="1">Smarty_Compiler</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">_syntax_error("unrecognized
                          > >
                          tag 'formadddatapart'", "256", "c:\web\library\smarty\Smarty_Compiler
                          > > .class.php", "580")</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">580</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                          > > /tr><tr><td><font face="Verdana, Tahoma"
                          > > size="1">Smarty_Compiler</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">_compile_tag("formadddatapart
                          > > data=$smarty.capture.formdata")</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">312</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\library\smarty\Smarty_Compiler.class.php</font></td><
                          > > /tr><tr><td><font face="Verdana, Tahoma"
                          > > size="1">Smarty_Compiler</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">_compile_file("test-if.tpl", "{$header}
                          > > {$content}
                          > > {$message}
                          > > <table>
                          > > <tr>
                          > > <td>
                          > > {if $tools}
                          > > {foreach key=name item=toolbar
                          > > from=$toolbar}
                          > > {input
                          > > name="$name"}
                          > > {/foreach}
                          > > {/if}
                          > > </td>
                          > > </tr>
                          > > <tr>
                          > > </table>", null)</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">1491</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                          > > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">_compile_source("test-if.tpl", "{$header}
                          > > {$content}
                          > > {$message}
                          > > <table>
                          > > <tr>
                          > > <td>
                          > > {if $tools}
                          > > {foreach key=name item=toolbar
                          > > from=$toolbar}
                          > > {input
                          > > name="$name"}
                          > > {/foreach}
                          > > {/if}
                          > > </td>
                          > > </tr>
                          > > <tr>
                          > > </table>", null, "C:/Documents and Settings/Shawn/My
                          > > Documents/web/dev\temp\compile\%%CC^CC1^CC14DFC8%%test-
                          if.tpl.inc")
                          > > </font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">1424</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                          > > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">_compile_resource("test-if.tpl", "C:/Documents
                          and
                          > > Settings/Shawn/My Documents/web/dev\temp\compile\%%
                          CC^CC1^CC14DFC8%%
                          > > test-if.tpl.php")</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">1256</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                          > > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">fetch("test-if.tpl", null, null, true)</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">1108</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\library\smarty\Smarty.class.php</font></td></tr><tr><
                          > > td><font face="Verdana, Tahoma" size="1">Smarty</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">display("test-if.tpl")</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma" size="1">244</font>
                          > > </td><td><font face="Verdana,
                          > > Tahoma"
                          > >
                          size="1">c:\web\dev\www\index.html</font></td></tr></tr></table><br /
                          > > >
                          > > <br />
                          > > </pre><pre><b><u><font
                          > > color='red'>CONTEXT</font></u></b></pre><pre>Array
                          > > (
                          > > [error_msg] => [in test-if.tpl line 7]: syntax error:
                          > > unrecognized tag 'formadddatapart' (Smarty_Compiler.class.php,
                          line
                          > > 580)
                          > > [error_type] => 256
                          > > )
                          > > </pre><br />
                          > >
                          > >
                          > >
                          > >
                          > > --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@> wrote:
                          > > >
                          > > > Hello,
                          > > >
                          > > > on 05/04/2006 11:19 AM Shekar C. Reddy said the following:
                          > > > > Manuel,
                          > > > >
                          > > > > Yes, I appended those strings as elements at the end of each
                          > > array
                          > > > > (search/replace) while keeping the old ones. But it did not
                          > > work.
                          > > > > Could be a logic error and maybe we are 'this' close to
                          > > squashing
                          > > > > it. Unfortunately, I'm weak with regex.
                          > > >
                          > > > I do not see why it does not work. Can you get the compiled
                          > > template
                          > > > file that Smarty generates so I can see what may not be working?
                          > > >
                          > > > --
                          > > >
                          > > > Regards,
                          > > > Manuel Lemos
                          > > >
                          > > > Metastorage - Data object relational mapping layer generator
                          > > > http://www.metastorage.net/
                          > > >
                          > > > PHP Classes - Free ready to use OOP components written in PHP
                          > > > http://www.phpclasses.org/
                          > > >
                          > >
                          >
                        • Manuel Lemos
                          Hello, ... This issue is not forgotten. I just did not had the time to look into it. Patches to solve the problem are also welcome. -- Regards, Manuel Lemos
                          Message 12 of 22 , Aug 8, 2006
                            Hello,

                            on 08/04/2006 12:16 PM Shekar C. Reddy said the following:
                            > Manuel,
                            >
                            > Would you be able to help me with this issue?
                            >
                            > Thanks much in advance...

                            This issue is not forgotten. I just did not had the time to look into
                            it. Patches to solve the problem are also welcome.

                            --

                            Regards,
                            Manuel Lemos

                            Metastorage - Data object relational mapping layer generator
                            http://www.metastorage.net/

                            PHP Classes - Free ready to use OOP components written in PHP
                            http://www.phpclasses.org/
                          • Manuel Lemos
                            Hello, ... I finally made time to make the Smarty pre-filter use handle properly all special marks like include, include_php, if, else, elseif, foreach,
                            Message 13 of 22 , Nov 21, 2006
                              Hello,

                              on 07/24/2006 11:41 PM Shekar C. Reddy said the following:
                              > Manuel,
                              >
                              > Regret for the delay in replying as I was moved to another project. I've pasted the
                              > compiled output of the toolbar.tpl:

                              I finally made time to make the Smarty pre-filter use handle properly
                              all special marks like include, include_php, if, else, elseif, foreach,
                              foreachelse, etc.

                              You may download the latest version that was just updated. Sorry for the
                              delay.

                              --

                              Regards,
                              Manuel Lemos

                              Metastorage - Data object relational mapping layer generator
                              http://www.metastorage.net/

                              PHP Classes - Free ready to use OOP components written in PHP
                              http://www.phpclasses.org/
                            • Shekar C. Reddy
                              Thanks much, Manuel! This will reduce the number of template files in my application now. I was actually using different template files for forms-based pages
                              Message 14 of 22 , Nov 21, 2006
                                Thanks much, Manuel!

                                This will reduce the number of template files in my application now.
                                I was actually using different template files for forms-based pages
                                and non-forms-based pages as a work around.

                                Regards,




                                --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
                                >
                                > Hello,
                                >
                                > on 07/24/2006 11:41 PM Shekar C. Reddy said the following:
                                > > Manuel,
                                > >
                                > > Regret for the delay in replying as I was moved to another
                                project. I've pasted the
                                > > compiled output of the toolbar.tpl:
                                >
                                > I finally made time to make the Smarty pre-filter use handle
                                properly
                                > all special marks like include, include_php, if, else, elseif,
                                foreach,
                                > foreachelse, etc.
                                >
                                > You may download the latest version that was just updated. Sorry
                                for the
                                > delay.
                                >
                                > --
                                >
                                > Regards,
                                > Manuel Lemos
                                >
                                > Metastorage - Data object relational mapping layer generator
                                > http://www.metastorage.net/
                                >
                                > PHP Classes - Free ready to use OOP components written in PHP
                                > http://www.phpclasses.org/
                                >
                              • Shekar C. Reddy
                                Manuel, I m afraid I noticed a tiny glitch in the revised prefilter: TEMPLATE: 1} colspan= {$colspan} {/if} nowrap OUTPUT:
                                Message 15 of 22 , Nov 25, 2006
                                  Manuel,

                                  I'm afraid I noticed a tiny glitch in the revised prefilter:

                                  TEMPLATE:
                                  <td{if $colspan > 1} colspan="{$colspan}"{/if} nowrap>

                                  OUTPUT:
                                  <td<?php $this->_smarty_vars['capture']['formdata'] = ob_get_contents
                                  (); ob_end_clean(); echo templateInsertFormAddDataPart(array('data'
                                  => $this->_smarty_vars['capture']['formdata']), $this); if ($this-
                                  >_tpl_vars['colspan'] > 1): ?> colspan="<?php echo $this->_tpl_vars
                                  ['colspan']; ?>
                                  "<?php endif; ob_start(); ?> nowrap>

                                  As a result of the above, I get the following output at the top of
                                  the page outside of all tables in addition to the colspan that did
                                  not get rendered:

                                  colspan="2" nowrap>

                                  Please let me know...

                                  Regards,

                                  PS: templateInsertFormAddDataPart is my global function that I
                                  registered with Smarty in place of insert.formadddatapart.php plugin.





                                  --- In forms-dev@yahoogroups.com, "Shekar C. Reddy" <zendfw@...>
                                  wrote:
                                  >
                                  > Thanks much, Manuel!
                                  >
                                  > This will reduce the number of template files in my application
                                  now.
                                  > I was actually using different template files for forms-based
                                  pages
                                  > and non-forms-based pages as a work around.
                                  >
                                  > Regards,
                                  >
                                  >
                                  >
                                  >
                                  > --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@> wrote:
                                  > >
                                  > > Hello,
                                  > >
                                  > > on 07/24/2006 11:41 PM Shekar C. Reddy said the following:
                                  > > > Manuel,
                                  > > >
                                  > > > Regret for the delay in replying as I was moved to another
                                  > project. I've pasted the
                                  > > > compiled output of the toolbar.tpl:
                                  > >
                                  > > I finally made time to make the Smarty pre-filter use handle
                                  > properly
                                  > > all special marks like include, include_php, if, else, elseif,
                                  > foreach,
                                  > > foreachelse, etc.
                                  > >
                                  > > You may download the latest version that was just updated. Sorry
                                  > for the
                                  > > delay.
                                  > >
                                  > > --
                                  > >
                                  > > Regards,
                                  > > Manuel Lemos
                                  > >
                                  > > Metastorage - Data object relational mapping layer generator
                                  > > http://www.metastorage.net/
                                  > >
                                  > > PHP Classes - Free ready to use OOP components written in PHP
                                  > > http://www.phpclasses.org/
                                  > >
                                  >
                                • Shekar C. Reddy
                                  Manuel, I m afraid the problem did not get resolved with preg_quote in prefilter as the following still throws syntax error: unrecognized tag input
                                  Message 16 of 22 , Nov 26, 2006
                                    Manuel,

                                    I'm afraid the problem did not get resolved with preg_quote in
                                    prefilter as the following still throws "syntax error: unrecognized
                                    tag 'input' (Smarty_Compiler.class.php, line 580)" error if the page
                                    is not based on forms class ($form var is false):

                                    {if $form}
                                    {input name="submit"}
                                    {/if}

                                    Regards,





                                    --- In forms-dev@yahoogroups.com, "Shekar C. Reddy" <zendfw@...>
                                    wrote:
                                    >
                                    > Manuel,
                                    >
                                    > I'm afraid I noticed a tiny glitch in the revised prefilter:
                                    >
                                    > TEMPLATE:
                                    > <td{if $colspan > 1} colspan="{$colspan}"{/if} nowrap>
                                    >
                                    > OUTPUT:
                                    > <td<?php $this->_smarty_vars['capture']['formdata'] =
                                    ob_get_contents
                                    > (); ob_end_clean(); echo templateInsertFormAddDataPart(array
                                    ('data'
                                    > => $this->_smarty_vars['capture']['formdata']), $this); if ($this-
                                    > >_tpl_vars['colspan'] > 1): ?> colspan="<?php echo $this->_tpl_vars
                                    > ['colspan']; ?>
                                    > "<?php endif; ob_start(); ?> nowrap>
                                    >
                                    > As a result of the above, I get the following output at the top of
                                    > the page outside of all tables in addition to the colspan that did
                                    > not get rendered:
                                    >
                                    > colspan="2" nowrap>
                                    >
                                    > Please let me know...
                                    >
                                    > Regards,
                                    >
                                    > PS: templateInsertFormAddDataPart is my global function that I
                                    > registered with Smarty in place of insert.formadddatapart.php
                                    plugin.
                                    >
                                    >
                                    >
                                    >
                                    >
                                    > --- In forms-dev@yahoogroups.com, "Shekar C. Reddy" <zendfw@>
                                    > wrote:
                                    > >
                                    > > Thanks much, Manuel!
                                    > >
                                    > > This will reduce the number of template files in my application
                                    > now.
                                    > > I was actually using different template files for forms-based
                                    > pages
                                    > > and non-forms-based pages as a work around.
                                    > >
                                    > > Regards,
                                    > >
                                    > >
                                    > >
                                    > >
                                    > > --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@> wrote:
                                    > > >
                                    > > > Hello,
                                    > > >
                                    > > > on 07/24/2006 11:41 PM Shekar C. Reddy said the following:
                                    > > > > Manuel,
                                    > > > >
                                    > > > > Regret for the delay in replying as I was moved to another
                                    > > project. I've pasted the
                                    > > > > compiled output of the toolbar.tpl:
                                    > > >
                                    > > > I finally made time to make the Smarty pre-filter use handle
                                    > > properly
                                    > > > all special marks like include, include_php, if, else, elseif,
                                    > > foreach,
                                    > > > foreachelse, etc.
                                    > > >
                                    > > > You may download the latest version that was just updated.
                                    Sorry
                                    > > for the
                                    > > > delay.
                                    > > >
                                    > > > --
                                    > > >
                                    > > > Regards,
                                    > > > Manuel Lemos
                                    > > >
                                    > > > Metastorage - Data object relational mapping layer generator
                                    > > > http://www.metastorage.net/
                                    > > >
                                    > > > PHP Classes - Free ready to use OOP components written in PHP
                                    > > > http://www.phpclasses.org/
                                    > > >
                                    > >
                                    >
                                  • Manuel Lemos
                                    Hello, ... You can only use the forms Smarty plug-in if you set Smarty form variable to the forms class object. Therefore you cannot use the form to assign
                                    Message 17 of 22 , Nov 27, 2006
                                      Hello,

                                      on 11/27/2006 05:19 AM Shekar C. Reddy said the following:
                                      > Manuel,
                                      >
                                      > I'm afraid the problem did not get resolved with preg_quote in
                                      > prefilter as the following still throws "syntax error: unrecognized
                                      > tag 'input' (Smarty_Compiler.class.php, line 580)" error if the page
                                      > is not based on forms class ($form var is false):
                                      >
                                      > {if $form}
                                      > {input name="submit"}
                                      > {/if}

                                      You can only use the forms Smarty plug-in if you set Smarty "form"
                                      variable to the forms class object. Therefore you cannot use the "form"
                                      to assign any other value. You need to use another name for your
                                      template variable.

                                      --

                                      Regards,
                                      Manuel Lemos

                                      Metastorage - Data object relational mapping layer generator
                                      http://www.metastorage.net/

                                      PHP Classes - Free ready to use OOP components written in PHP
                                      http://www.phpclasses.org/
                                    • Shekar C. Reddy
                                      Oops! Sorry for the confusion. The actual code is: {if $page.type = form } {input name= Submit } {/if} Yes, the Smarty form variable is set to the forms
                                      Message 18 of 22 , Nov 27, 2006
                                        Oops! Sorry for the confusion. The actual code is:

                                        {if $page.type = 'form'}
                                        {input name="Submit"}
                                        {/if}

                                        Yes, the Smarty "form" variable is set to the forms class object -
                                        as per your examples. But the {if} tag is not excluding the {input}
                                        tag if $page.type != 'form' and the {input} tag is getting
                                        invoked/executed in all cases. Or in other words, the {if} tag is
                                        not functioning the way it should.

                                        Please let me know...

                                        Regards,




                                        --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
                                        >
                                        > Hello,
                                        >
                                        > on 11/27/2006 05:19 AM Shekar C. Reddy said the following:
                                        > > Manuel,
                                        > >
                                        > > I'm afraid the problem did not get resolved with preg_quote in
                                        > > prefilter as the following still throws "syntax error:
                                        unrecognized
                                        > > tag 'input' (Smarty_Compiler.class.php, line 580)" error if the
                                        page
                                        > > is not based on forms class ($form var is false):
                                        > >
                                        > > {if $form}
                                        > > {input name="submit"}
                                        > > {/if}
                                        >
                                        > You can only use the forms Smarty plug-in if you set Smarty "form"
                                        > variable to the forms class object. Therefore you cannot use
                                        the "form"
                                        > to assign any other value. You need to use another name for your
                                        > template variable.
                                        >
                                        > --
                                        >
                                        > Regards,
                                        > Manuel Lemos
                                        >
                                        > Metastorage - Data object relational mapping layer generator
                                        > http://www.metastorage.net/
                                        >
                                        > PHP Classes - Free ready to use OOP components written in PHP
                                        > http://www.phpclasses.org/
                                      • Manuel Lemos
                                        Hello, ... It seems you should be using == token, as just = makes Smarty fail in error. ... It looks ok to me. Smarty generates PHP code that uses if/endif
                                        Message 19 of 22 , Nov 29, 2006
                                          Hello,

                                          on 11/27/2006 03:21 PM Shekar C. Reddy said the following:
                                          > Oops! Sorry for the confusion. The actual code is:
                                          >
                                          > {if $page.type = 'form'}
                                          > {input name="Submit"}
                                          > {/if}

                                          It seems you should be using == token, as just = makes Smarty fail in error.


                                          > Yes, the Smarty "form" variable is set to the forms class object -
                                          > as per your examples. But the {if} tag is not excluding the {input}
                                          > tag if $page.type != 'form' and the {input} tag is getting
                                          > invoked/executed in all cases. Or in other words, the {if} tag is
                                          > not functioning the way it should.

                                          It looks ok to me. Smarty generates PHP code that uses if/endif syntax.
                                          The generated code looks right to me.

                                          --

                                          Regards,
                                          Manuel Lemos

                                          Metastorage - Data object relational mapping layer generator
                                          http://www.metastorage.net/

                                          PHP Classes - Free ready to use OOP components written in PHP
                                          http://www.phpclasses.org/
                                        • Shekar C. Reddy
                                          Sorry again for typing wrong code, Manuel - because I could not copy it from my code as I was away from my machine. Yes, the operator used is == with
                                          Message 20 of 22 , Nov 30, 2006
                                            Sorry again for typing wrong code, Manuel - because I could not copy
                                            it from my code as I was away from my machine. Yes, the operator
                                            used is ' == ' with spaces on its either side. It bombs with:

                                            syntax error: unrecognized tag 'input' (Smarty_Compiler.class.php,
                                            line 580)

                                            However, the following code works by properly skipping the line that
                                            attempts to render $page.xx var if the $page.type is != 'form' as
                                            there is no var with the name $page.xx:

                                            {if $page.type == 'form'}
                                            {$page.xx}
                                            {/if}

                                            For sometime, I thought it was Smarty compiler's problem with the
                                            {if} tag rendition but later noticed it works with the non-existent
                                            $page.xx var but does not work with the input tag. Input tag works
                                            (or gets skipped) only if the forms class is instantiated. Another
                                            thing I noticed is, if I include the input tags using a separate
                                            template file, it works/skips if page.type is != form. So far, the
                                            best workaround I found is to use different templates for forms-
                                            based and non-forms based pages where non-forms based pages do not
                                            instantiate the forms class and its templates do not have any
                                            references to input tags.

                                            Regards,




                                            --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
                                            >
                                            > Hello,
                                            >
                                            > on 11/27/2006 03:21 PM Shekar C. Reddy said the following:
                                            > > Oops! Sorry for the confusion. The actual code is:
                                            > >
                                            > > {if $page.type = 'form'}
                                            > > {input name="Submit"}
                                            > > {/if}
                                            >
                                            > It seems you should be using == token, as just = makes Smarty fail
                                            in error.
                                            >
                                            >
                                            > > Yes, the Smarty "form" variable is set to the forms class
                                            object -
                                            > > as per your examples. But the {if} tag is not excluding the
                                            {input}
                                            > > tag if $page.type != 'form' and the {input} tag is getting
                                            > > invoked/executed in all cases. Or in other words, the {if} tag
                                            is
                                            > > not functioning the way it should.
                                            >
                                            > It looks ok to me. Smarty generates PHP code that uses if/endif
                                            syntax.
                                            > The generated code looks right to me.
                                            >
                                            > --
                                            >
                                            > Regards,
                                            > Manuel Lemos
                                            >
                                            > Metastorage - Data object relational mapping layer generator
                                            > http://www.metastorage.net/
                                            >
                                            > PHP Classes - Free ready to use OOP components written in PHP
                                            > http://www.phpclasses.org/
                                            >
                                          • Manuel Lemos
                                            Hello, ... Of course, when you use the forms class plug-in you must have created a a form object so it composes the form output. The Smarty plug-in for the
                                            Message 21 of 22 , Dec 9, 2006
                                              Hello,

                                              on 11/30/2006 12:52 PM Shekar C. Reddy said the following:
                                              > Sorry again for typing wrong code, Manuel - because I could not copy
                                              > it from my code as I was away from my machine. Yes, the operator
                                              > used is ' == ' with spaces on its either side. It bombs with:
                                              >
                                              > syntax error: unrecognized tag 'input' (Smarty_Compiler.class.php,
                                              > line 580)
                                              >
                                              > However, the following code works by properly skipping the line that
                                              > attempts to render $page.xx var if the $page.type is != 'form' as
                                              > there is no var with the name $page.xx:
                                              >
                                              > {if $page.type == 'form'}
                                              > {$page.xx}
                                              > {/if}
                                              >
                                              > For sometime, I thought it was Smarty compiler's problem with the
                                              > {if} tag rendition but later noticed it works with the non-existent
                                              > $page.xx var but does not work with the input tag. Input tag works
                                              > (or gets skipped) only if the forms class is instantiated. Another
                                              > thing I noticed is, if I include the input tags using a separate
                                              > template file, it works/skips if page.type is != form. So far, the
                                              > best workaround I found is to use different templates for forms-
                                              > based and non-forms based pages where non-forms based pages do not
                                              > instantiate the forms class and its templates do not have any
                                              > references to input tags.

                                              Of course, when you use the forms class plug-in you must have created a
                                              a form object so it composes the form output. The Smarty plug-in for
                                              the forms class always calls the class to add data parts even when there
                                              are no inputs. So either you use the forms class to compose the output
                                              or you don't.


                                              --

                                              Regards,
                                              Manuel Lemos

                                              Metastorage - Data object relational mapping layer generator
                                              http://www.metastorage.net/

                                              PHP Classes - Free ready to use OOP components written in PHP
                                              http://www.phpclasses.org/
                                            • Shekar C. Reddy
                                              Thanks for clarifying that, Manuel. It is clear now as to how the form object composes the form output. I guess we can live with multiple templates for forms
                                              Message 22 of 22 , Dec 11, 2006
                                                Thanks for clarifying that, Manuel. It is clear now as to how the form
                                                object composes the form output. I guess we can live with multiple
                                                templates for forms and non-forms.

                                                Regards,




                                                --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
                                                >
                                                > Hello,
                                                >
                                                > on 11/30/2006 12:52 PM Shekar C. Reddy said the following:
                                                > > Sorry again for typing wrong code, Manuel - because I could not copy
                                                > > it from my code as I was away from my machine. Yes, the operator
                                                > > used is ' == ' with spaces on its either side. It bombs with:
                                                > >
                                                > > syntax error: unrecognized tag 'input' (Smarty_Compiler.class.php,
                                                > > line 580)
                                                > >
                                                > > However, the following code works by properly skipping the line that
                                                > > attempts to render $page.xx var if the $page.type is != 'form' as
                                                > > there is no var with the name $page.xx:
                                                > >
                                                > > {if $page.type == 'form'}
                                                > > {$page.xx}
                                                > > {/if}
                                                > >
                                                > > For sometime, I thought it was Smarty compiler's problem with the
                                                > > {if} tag rendition but later noticed it works with the non-existent
                                                > > $page.xx var but does not work with the input tag. Input tag works
                                                > > (or gets skipped) only if the forms class is instantiated. Another
                                                > > thing I noticed is, if I include the input tags using a separate
                                                > > template file, it works/skips if page.type is != form. So far, the
                                                > > best workaround I found is to use different templates for forms-
                                                > > based and non-forms based pages where non-forms based pages do not
                                                > > instantiate the forms class and its templates do not have any
                                                > > references to input tags.
                                                >
                                                > Of course, when you use the forms class plug-in you must have created a
                                                > a form object so it composes the form output. The Smarty plug-in for
                                                > the forms class always calls the class to add data parts even when there
                                                > are no inputs. So either you use the forms class to compose the output
                                                > or you don't.
                                                >
                                                >
                                                > --
                                                >
                                                > Regards,
                                                > Manuel Lemos
                                                >
                                                > Metastorage - Data object relational mapping layer generator
                                                > http://www.metastorage.net/
                                                >
                                                > PHP Classes - Free ready to use OOP components written in PHP
                                                > http://www.phpclasses.org/
                                                >
                                              Your message has been successfully submitted and would be delivered to recipients shortly.