developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #1396: patch_1396.diff

File patch_1396.diff, 2.0 KB (added by bricet, 9 years ago)
  • build/manifests/testapp.mn

    diff -r fe6c038852fe build/manifests/testapp.mn
    a b  
    161161  menu.tpl
    162162  test_include.tpl
    163163  test_include_included.tpl
     164  test_include_recursive.tpl
    164165  test_plugin_counter_init_allarg_noexeption.tpl
    165166  test_plugin_counter_init_exeption.tpl
    166167  test_plugin_counter_init_noexeption.tpl
  • lib/jelix/plugins/tpl/common/cfunction.include.php

    diff -r fe6c038852fe lib/jelix/plugins/tpl/common/cfunction.include.php
    a b  
    2424        return '';
    2525    }
    2626    if(count($param) == 1){
    27         $compiler->addMetaContent('$t->meta('.$param[0].');');
     27        $compiler->addMetaContent('static $preventRecursiv = false; if( !$preventRecursiv ) { $preventRecursiv=true; $t->meta('.$param[0].'); }');
    2828        return '$t->display('.$param[0].');';
    2929    }else{
    3030        $compiler->doError2('errors.tplplugin.cfunction.bad.argument.number','include','1');
  • new file testapp/modules/jelix_tests/templates/test_include_recursive.tpl

    diff -r fe6c038852fe testapp/modules/jelix_tests/templates/test_include_recursive.tpl
    - +  
     1{=count($items)}
     2{assign $dummy=array_pop($items)}{if count($items) > 0}{include 'test_plugin_include_recursive_included'}{/if}
  • testapp/modules/jelix_tests/tests/jtpl.plugins.html.php

    diff -r fe6c038852fe testapp/modules/jelix_tests/tests/jtpl.plugins.html.php
    a b  
    252252<p>End</p>
    253253
    254254", $content);
     255
     256
     257        $tpl = new jTpl();
     258        $tpl->assign( 'items', array(1,2) );
     259        $content = $tpl->fetch( 'test_include_recursive' );
     260        $this->assertEqual("2\n1\n" , $content);
    255261        }
    256262}
    257263
    258 ?>
    259  No newline at end of file
     264?>