[Cartoweb-users] How to create requests variables

Karol Briones karolitab at gmail.com
Thu Nov 27 10:13:19 EST 2008


Hi Oliver, I try to send a variable like this

in the recenterInput.tpl I have

<input type="text" name="variableimg" value="" />

the makeSearch function return the dir of the image

protected function makeSearch($searchString) {
...
   return $row->imagen;
}

and filterPostRequest set the result into the field

public function filterPostRequest(FilterRequestModifier $request) {
    $searchString = $request->getValue('variableimg');
    if (!empty($searchString)) {

        // To simplify we assume that only one result is returned by the search
        $variableImg = $this->makeSearch($searchString);
        $request->setValue('variableimg', $variableImg);
    }
}
...

But don't show the name of the image, now, I try to show an image like this

<!--varImagen.tpl-->

<input type="image" name="varImagen" id="varImagen" src="{$varImagen_path}"
      style="width:{$varImagen_width}px;height:{$varImagen_height}px;" />

I try to use

protected function drawUserForm() {
    $smarty = new Smarty_Plugin($this->getCartoclient(), $this);
    return $smarty->fetch('varImagen.tpl');
}

public function renderForm(Smarty $template) {
...
$varImagen_path="images/museo.jpg";
    $template->assign('varImagen_path',$varImagen_path);
}

And the folder images is in htdocs folder, I have the idea how to make my
plugin, but don't understand very well how work it. Thanks for your help.

Thanks and regards,
Karol

2008/11/25 Karol Briones <karolitab at gmail.com>

> Thanks Oliver, I want to try it.
>
> Thanks and regards,
> Karol
>
> 2008/11/25 Oliver Christen <oliver.christen at camptocamp.com>
>
>  hi
>> have a look at the examples in the wiki,
>> especially http://www.cartoweb.org/cwiki/HowToWriteaRecenterPlugin which
>> should give you pretty much all the pieces you need.
>>
>> regards
>> Oliver
>>
>> ----- Original Message -----
>>  *From:* Karol Briones <karolitab at gmail.com>
>> *To:* cartoweb-users at lists.maptools.org
>> *Sent:* Monday, November 24, 2008 10:43 PM
>> *Subject:* [Cartoweb-users] How to create requests variables
>>
>> Hello list, I try to create a new plugin that query te database and show
>> the result on the cartoclient.tpl, but I don't know how to create variable
>> request or create an variable into the client.php from the new plugin ,send
>> this variable and get this variable in template to show the result, thanks
>> for your help.
>>
>> Thanks and regards,
>> Karol
>>
>> ------------------------------
>>
>> _______________________________________________
>> Cartoweb-users mailing list
>> Cartoweb-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20081127/ad9bdbde/attachment-0001.html


More information about the Cartoweb-users mailing list