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

Eduard Witteveen e.witteveen at HAWARIT.COM
Fri Oct 7 07:20:34 EDT 2005


Eduard Witteveen wrote:

> 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)

I made the following modifications to the include\smarty\Smarty.class.php

Line 1584:
--                  $this->trigger_error('unable to read resource: "' . 
$params['resource_name'] . '"');
++                if($_params['resource_type'] == "file") {
++                    $this->trigger_error('unable to read file: "' . 
$params['resource_name'] . '" include:"' . get_include_path() . '" 
working dir:"' . getcwd() . '"');
++                }
++                else {
++                    $this->trigger_error('unable to read resource: "' 
. $params['resource_name'] . '" type:"' . $_params['resource_type'] . '"');
++                }

>
>   Failure
>
> class: CartocommonException message: Error [512, Smarty error: unable 
> to read file: "foo.tpl" 
> include:".;C:\php5\pear;C:\cartoweb3/include/;C:\cartoweb3/include/pear" 
> working dir:"C:\cartoweb3\htdocs", 
> C:\cartoweb3\include\smarty\Smarty.class.php, 1088] Backtrace:



My plugin contains the following code:
class ClientFoo extends ClientTables {
    ..
    public function replacePlugin() {
        return 'tables';
    }
    ..
    public function renderForm(Smarty $template) {
        // render parent!
        parent::renderForm($template);
        $smarty = new Smarty_CorePlugin($this->getCartoclient(), 
$this);        // also tried to use template directly and constructor 
Smarty()
        $xml = $this->administrativeXml($this->tableGroups);
        $smarty->assign('foo', 'bar');
        return $smarty->fetch('foo.tpl');
    }
    ..
}

And i placed this file in 
C:\cartoweb3\projects\%projectname%\plugins\foo\client\ClientFoo.php, 
why doesnt the fetch('foo.tpl'); try to load the tpl from the location: 
C:\cartoweb3\projects\%projectname%\plugins\foo\templates\foo.tpl

How can i make my class aware of the file foo.tpl in my template folder?


More information about the Cartoweb-users mailing list