[Cartoweb-users] Using the selected object in the layer in my own plugin

Eduard Witteveen e.witteveen at HAWARIT.COM
Fri Oct 7 04:27:49 EDT 2005

Alexandre Saunier wrote:

> $smarty = new Smarty_Cartoclient($this->cartoclient);
> $smarty->assign(array('charset'     => Encoder::getCharset(),
>                       'metas'       => $this->metas,
>                       'sessionData' => $data,
>                       ));
> return $smarty->fetch('view.xml.tpl');
> associated to a dedicated XML template file view.xml.tpl.
> That was just a tip. ;)

Good to point it out, i already know the mechanism. A little sidenote, 
would it be possible to make the errormessage clearer when this 
view.xml.tlp wasnt found? (with a path)

>> The problem is that i dont know how i should access this 
>> $tableGroups, which is stored inside the ClientTables.php (private). 
>> I know that the value is also assigned to Smarty under the 
>> key='tables', but i also dont know how to access it.
> I presume you use CartoWeb3.0.
> In CVS version there is a public method ClientTables::getTableGroups() 
> which is missing in 3.0.0.
> If you prefer to keep using CW3.0, a solution would be to extend the 
> tables plugin in your project and add this method in your extended class
> (see 
> http://cartoweb.org/doc/xhtml/dev.newplugin.html#dev.newplugin.adapting.extending) 
> Obviously you'll have to switch ClientTables::tableGroups from private 
> to protected in the ClientTables.php upstream code. It's not a big 
> deal since it does not affect the class behavior much.

Okay, i understand the way to solve it in CW3.0, thank you.

I am curious how stable is the version in CVS?
And when i use the version from cvs, what would be the code to call this 
getTableGroups() method(from your story i suspect that extending is not 
nessecary over there? and (maybe i like this more) can it also be used 
in CW3.0 by adding a getTableGroups() method?)

> By the way note that in CVS version, most plugins private methods and 
> members have recently been switched to protected (including 
> ClientTables::tableGroups) in order to make plugin extending easier.


More information about the Cartoweb-users mailing list