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

Block plugin to select what a want to show

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


Joined: 05 Jul 2011
Posts: 3

PostPosted: Tue Jul 05, 2011 9:04 pm    Post subject: Block plugin to select what a want to show Reply with quote

Im implementing a export system from HTML to PDF and i need do mark what part of the code i want to show in case of export like:

{export}
// title
{/export}

// menu // i dont want to export

{export}
// content
{/export}

Any idea?

ps.: sorry for the bad english.
Back to top
View user's profile Send private message
drfranca
Smarty n00b


Joined: 05 Jul 2011
Posts: 3

PostPosted: Wed Jul 06, 2011 1:55 pm    Post subject: The begining Reply with quote

Code:
function smarty_block_export($params, $content, &$smarty, &$repeat)
{
   //echo '<pre>';
    //var_dump($smarty);
    //die;

   $ex = isset($smarty->get['export']) && (int)$smarty->get['export'];
   
   switch ( $params['func'] ) {
      case 'exclude':         
         $content = $ex ? '' : $content;
         break;
      case 'content':
         $content = $ex ? $content : '';
         break;
      default :
         $content = $ex ? $content : '';
         break;   
   }
   
    return $content;
}


That's my code until now, but i dont receive the GET data inside the plugin, how can i get that?

I try:
Code:
 $smarty->get['export']
But no results.
Back to top
View user's profile Send private message
drfranca
Smarty n00b


Joined: 05 Jul 2011
Posts: 3

PostPosted: Wed Jul 06, 2011 2:07 pm    Post subject: Sorry guys Reply with quote

Sorry guys, this works
Code:
$_GET['export']


Embarassed
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