Thanks Oliver, I've started yesterday about hacking clientExportPdf. and have finish with exactly the result you mention.
The %s in .ini just emprove the solution (no need to str_replace). Have a nive day. Oliver Christen wrote: > Hi > > as far as I know, there is no built-in mechanism to genericaly pass a > variable value to a block. > so you will need to extend the exportPdf and add some specific case to > handle you block. > > this is only an easy hack but it seems to work, im sure there are other > way to do it > 1) in the exportPdf.ini, write the connection string with %s where you > want to write the condition values > blocks.copyright.content = > "db~pgsql://xxx:[EMAIL PROTECTED]/demo_plugins~select name from people where > id = %s" > > 2) extend the exportPdf plugin(see doc > (http://www.cartoweb.org/doc/cw3.4/xhtml/dev.newplugin.html#dev.newplugin.adapting.extending) > you can also directly modify the ClientExportPdf.php but thats not very > clean) > and override the createBlock function. > all you have to do is copy the function content and simply slightly > modify the lines where you have > if ($this->blocks[$id]->type == 'text' && > (stristr($this->blocks[$id]->content, 'file~') || > stristr($this->blocks[$id]->content, 'db~'))) { > > simply add something like this > if ($id == 'your_block_name') { > $this->blocks[$id]->content = > sprintf($this->blocks[$id]->content, $your_value); > } > > now all you have to do is to get the $your_value but you should be able > to recover it from handleHttpPostRequest or from session. > > regards > Oliver > > >> Hi All, >> >> Don't know if someone is using it >> >> I've been ask to print in pdf a result of a query. >> >> As it was indicate in documentation we can make a >> blocks.myText.content = >> "db~pgsql://user:[EMAIL PROTECTED]/dbname~select column from table >> where x=(some value) AND y=(some >> other value); >> >> What I need to know is how can I have dynamic value for the x= et y= ? >> Typically how to give the x,y top left and the x,y bottom right >> coordinate of the pdf. >> >> Any clue, help or more information are welcome ... >> >> -- >> >> Bruno Friedmann [EMAIL PROTECTED] >> >> Ioda-Net Sàrl - www.ioda-net.ch >> 2830 Vellerat - Switzerland >> >> >> >> _______________________________________________ >> Cartoweb-users mailing list >> [email protected] >> http://lists.maptools.org/mailman/listinfo/cartoweb-users >> > -- Bruno Friedmann [EMAIL PROTECTED] Ioda-Net Sàrl - www.ioda-net.ch 2830 Vellerat - Switzerland Tél : ++41 32 435 7171 Fax : ++41 32 435 7172 gsm : ++41 78 802 6760 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com _______________________________________________ Cartoweb-users mailing list [email protected] http://lists.maptools.org/mailman/listinfo/cartoweb-users
