[Cartoweb-users] New DropDown Menu

Oliver Christen oliver.christen at camptocamp.com
Fri Oct 19 05:25:53 EDT 2007


'layer_values' AND 'layer_output' must be array, one is used for the values 
and the other for the labels

simply write  'layer_values' => $loutput in the assign

for details about the Smarty syntax, see
http://smarty.php.net/manual/en/language.function.html.options.php

regards
Oliver



> Hi all,
>
> I tried to add a new plugin, which should be triggered according to the
> selection in a dropdown menu. Therefore, I examined the source code for
> the project chooser to build a new dropdown menu. I add to 
> cartoclient.tpl:
>
>      {if $tabInfo_active|default:''}
>      {t}Choose Layer{/t}<br />
>      <select name="layer"
> onchange="javascript:document.carto_form.posted.value=0;FormItemSelected();">
>      {html_options values=$layer_values output=$layer_output
> selected=$layer}
>      </select><br />
>      {/if}
>
> Then I wrote the plugin with the following renderForm method:
>
>    public function renderForm(Smarty $template) {
>
>        $loutput = array("Layer A", "Layer B", "Layer C");
>
>        $template->assign(array('tabInfo_active'  => true,
>                                'layer_values' => "Layer A",
>                                'layer_output' => $loutput,
>                                'layer' => "Layer A"));
>    }
>
> If I access cartoweb now (using reset session) I only see the first
> array element ("Layer A") in the menu. Why does it not show the others?
>
> Thanks in advance!
> Carolin
>
>
> -- 
> Carolin Latze
> Research Assistant
>
> Department of Computer Science
> Boulevard de Pérolles 90
> CH-1700 Fribourg
>
> phone: +41 26 300 83 30
>
>
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 



More information about the Cartoweb-users mailing list