R: [Cartoweb-users] Populate aselect from db

Giovanni Virdis g.virdis at riteco.it
Fri Jun 6 13:08:41 EDT 2008


Hi Oliver, i follow your suggestion and I read the documentation , certly I continue to study but now I need a help because I must create this application in a shot time.

I have modify the file cartoclient.tpl and i add the  rows

<script type="text/javascript">
  /*<![CDATA[*/
    var values_of_select_1 = '{$the_corresponding_smarty_variable_1}';
    var values_of_select_2 = '{$the_corresponding_smarty_variable_2}';
  /*]]>*/
</script>

But after I don't know how continue how I can get the value of values_of_select_1 and values_of_select_2 and where I set the value of {$the_corresponding_smarty_variable_1, {$the_corresponding_smarty_variable_2
I not understand the relation with file tpl and php 
I must create a new template to get the value? I must  create a new php fil to get the value from db ? How???

Thanks and excuse but I'm new and there are many concept to learn



-----Messaggio originale-----
Da: Oliver Christen [mailto:oliver.christen at camptocamp.com] 
Inviato: venerdì 6 giugno 2008 15.45
A: Giovanni Virdis
Oggetto: Re: [Cartoweb-users] Populate aselect from db

you declare it in renderForm

I suggest you read carefuly the documentation about plugins and extending 
plugins
http://www.cartoweb.org/doc_head/docbook/xhtml/dev.newplugin.html
and also look at the examples of plugin in the cartoweb's website wiki
http://www.cartoweb.org/cwiki/HowTo
there are also multiple examples in the mailinglist archive

regards
Oliver

----- Original Message ----- 
From: "Giovanni Virdis" <g.virdis at riteco.it>
To: "Oliver Christen" <oliver.christen at camptocamp.com>
Sent: Friday, June 06, 2008 3:37 PM
Subject: R: [Cartoweb-users] Populate aselect from db


Ok but where i declare {$the_corresponding_smarty_variable_1} and how ican 
set this variable with the data get from db (postgree)

-----Messaggio originale-----
Da: Oliver Christen [mailto:oliver.christen at camptocamp.com]
Inviato: venerdì 6 giugno 2008 14.30
A: Giovanni Virdis
Cc: cartoweb-users at lists.maptools.org
Oggetto: Re: [Cartoweb-users] Populate aselect from db

yes, the idea is to set javascript variables using smarty.

you define a smarty variable with the data that will be used to fill the
select

in a template, you use something like this:
<script type="text/javascript">
  /*<![CDATA[*/
    var values_of_select_1 = '{$the_corresponding_smarty_variable_1}';
    var values_of_select_2 = '{$the_corresponding_smarty_variable_2}';
  /*]]>*/
</script>

and in the edit plugin javascript, you get these variable values and fill
the select with them.

regards
Oliver

>I think you could do this working on .tpl file associated to your
>user-interface (from which user can choose values...)
>
> Giovanni Virdis ha scritto:
>>
>> Hi,
>>
>> if is possibile i want populate the select item from db. I have modify
>> the dhtmlEdit.js file to show a select item with a fix value
>>
>>
>> var authorisedOptionsList = new Array(1, 2, 3);
>>
>> var authorisedOptionsListLabel = new Array('Strutture pubbliche',
>> 'Strutture per il commercio', 'Strutture militari');
>>
>>
>> How i can populate this item  by db select?
>>
>>  Is possible chanche the value of second select item when I change the
>> value of first select item ?
>>
>> Example
>>
>>
>> 1° Select value:
>>
>>
>> 1, 'America'
>> 2, 'Europa'
>>
>> 3, 'Asia'
>>
>> 4, 'Oceania'
>>
>> 5, 'Africa'
>>
>>
>> 2° Select value:
>>
>>
>> 1, 'Giappone'
>> 2, 'Cina'
>> 3, 'Mongolia'
>> 4, 'Stati Uniti'
>> 5, 'Canada'
>> 6, 'Messico'
>> 7, 'Italia'
>> 8, 'Spagna'
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Cartoweb-users mailing list
>> Cartoweb-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>
>
> -- 
> Ing. Fabio D'Ovidio
>
> INOVA Open Solutions s.r.l.
> Web : http://www.inovaos.it
> Tel.: 081 197 57 600
> mail: fabiodovidio at gmail.com
>
> _______________________________________________
> 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