[Cartoweb-users] Tooltips template

Sylvain Beorchia sylvain.beorchia at makina-corpus.com
Tue May 15 09:08:47 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Oliver,

when i add some debug the template is good, and the foreach loop show me
each parameters and values. But the HTML is null.

ie. $html = $smarty->fetch($template); return nothing...




Oliver Christen a écrit :
> Hi Sylvain
> 
> from what you say, I guess you use Cartoweb 3.3, so you have this function:
>    public function renderResult($smarty) {
>        // Assigns a key => value attributes array to layerResults smarty
>        // variable
>        $smarty->assign('layerId', $this->getId());
>        $smarty->assign('layerLabel',
>            Encoder::encode($this->getLabel(), 'config'));
> 
>        $template = $this->getCustomTemplate();
>        if ($template) {
>            foreach ($this->returnedAttributes as $key => $value) {
>                $smarty->assign($key, $value);
>            }
>            return $smarty->fetch($template);
>        } else {
>            $smarty->assign('layerResults', $this->returnedAttributes);
>            return $smarty->fetch('layerResult.tpl');
>        }
>    }
> }
> 
> if you add some debug:
> 
>        if ($template) {
>            print 'template '.$template.' found<br>';
>            foreach ($this->returnedAttributes as $key => $value) {
>                print $key.' : '.$value.'<br>';
>                $smarty->assign($key, $value);
>            }
>            $html = $smarty->fetch($template);
>            print $html;
>            return $html;
>        }
> 
> what is the output?
> 
> also, you can add a printr in the template itself
> {$layerResults|@print_r}
> 
> you must have the file modifier.print_r.php in
> cartoweb3\scripts\include_addons\include\smarty\plugins, if you dont
> have it, you can get if off Cartoweb cvs
> 
> this should give some light on whats happening
> 
> regards
> Oliver
> 
> 
> Hi,
> 
> I come again with my tooltips problems:
> 
> In my tooltips.ini, i've got :
> 
>   timeout_async.ecm_poly.template = "layerResult_poly.tpl"
> 
> In the renderResult() function (LayerResult.php), i checked that
> $template contains the good value (layerResult_poly.tpl), and it does.
> 
>        $template = $this->getCustomTemplate();
> 
> But anyway, the layerResult_poly.tpl template is not apply at all.
> 
> I tried to add some debug informations in the Smarty.class.php::fetch
> function. I can see the  layerResult_poly.tpl  as a parameter, but just
> after that, i see results.tpl coming. And in fact, if i change the
> results.tpl, i've got some change in my tooltips.
> 
> Last thing, this is for example the content of results.tpl :
> 
> {foreach key=attributeName item=attributeValue from=$layerResults}
>    <b>{t}{$attributeName|capitalize}{/t} : </b>
>        {if $attributeName=='numero'}
>           <font color='#00AA00'>{t}{$attributeValue}{/t}</font></a><br>
> {else}
>      {t}{$attributeValue}{/t}<br>
> {/if}
> {/foreach}
> 
> But it does not do anything.
> 
> Any ideas ?
> 
> Thank you.
> 
> Sylvain Beorchia.
> Makina Corpus
>>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGSbDeit+Ro3cR7XYRAli5AJ95JUAIC9iKbsFlO6RP06gfftDF7QCcDxYM
huz4SDgehBXucuE28OOT1Bg=
=pzQE
-----END PGP SIGNATURE-----


More information about the Cartoweb-users mailing list