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_bis.diff

File patch_1396_bis.diff, 2.7 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/CREDITS

    diff -r fe6c038852fe lib/jelix/CREDITS
    a b  
    295295 - introduced optional jMinifier for jResponseHtml for JS/CSS concatenation and minification (#860)
    296296 - type attribut on link tag should be optional (#1188)
    297297 - added lock on jCache::call to prevent multiple calls on CPU high-consuming functions (ticket #1237)
    298  - fixed the support of meta in included template (#1196)
     298 - fixed the support of meta in included template (#1196, #1396)
    299299
    300300Christophe Thiriot (aka Doubleface)
    301301 - testor
  • 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{meta main count($items)}
     2{=count($items)}
     3{assign $dummy=array_pop($items)}{if count($items) > 0}{include 'test_include_recursive'}{/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
     260        $meta = $tpl->meta('test_include_recursive');
     261        $content = $tpl->fetch( 'test_include_recursive' );
     262
     263        $this->assertEqual(array('main'=>'2'), $meta);
     264        $this->assertEqual("2\n1\n" , $content);
    255265        }
    256266}
    257267
    258 ?>
    259  No newline at end of file
     268?>