Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

How to use literal tag in my plugin function block

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
vuongminh1380
Smarty n00b


Joined: 25 Mar 2016
Posts: 2

PostPosted: Fri Mar 25, 2016 7:50 am    Post subject: How to use literal tag in my plugin function block Reply with quote

I need to disable smarty code when user call my plugin block like literal tag on my block function

Code:

<?php

function smarty_block_testd($params, $content, $template, &$repeat){
   if ($content === null) { // open tag
     $template->beginLiteral(); // method i want
   }else{ // close tag
    $template->endLiteral(); // method i want
}
}

?>



Thank you for reading
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1568

PostPosted: Fri Mar 25, 2016 12:22 pm    Post subject: Reply with quote

Policies like this one enforced with compile-time filters and/or different template delimiters for system and user templates.
Back to top
View user's profile Send private message
vuongminh1380
Smarty n00b


Joined: 25 Mar 2016
Posts: 2

PostPosted: Fri Mar 25, 2016 2:56 pm    Post subject: Reply with quote

AnrDaemon wrote:
Policies like this one enforced with compile-time filters and/or different template delimiters for system and user templates.


Thank for help bro!

I need it to write my plugin ProductList bro! My idea:

Code:
{ProductList} // it loop product items
      {$pro_name}
      {$pro_price}
      {if $had_tag}
               {ProductTag proid=$pro_id}

               {/ProductTag}
       {/if}
{/ProductList}


I need disable smarty code in ProductList tag and get content to do:

Code:
foreach($product_list as $item){
        $template->assignGlobal("pro_name", $item["pro_name"]);
        $template->display("string: $content);
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP