[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-general
Subject:    Re: [SMARTY] Smarty together with PEAR Html_Menu and NestedSet class.
From:       Gabriel Birke <birke () kontor4 ! de>
Date:       2004-05-24 12:59:09
Message-ID: 258AC4C0-AD82-11D8-A4F5-003065FA313E () kontor4 ! de
[Download RAW message or body]

> $menu->show()
>
> When I try do an assign:
>
> $page->assign('menu', $menu->show());
>
> It doesn't pass the var menu but prints the menu right away at the top 
> of the screen.
> Is it possible to pass an object to Smarty and call its function from 
> there so I get the menu at the right place on the html page ?

In this special case I think you just have to call $emnu->get() instead 
of $menu->show().

More general information:
If you have a method that echoes something directly, you can't call it 
in the assign statement. Instad, you can use output buffering to 
capture the code:

ob_start();
$theclass->printing_method();
$text = ob_get_contents();
ob_end_clean();
$page->assign("menu", $text);

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic