[Fwd: Re: [Cartoweb-users] How to remover backslashes to the url string]

Alexandre Saunier alexandre.saunier at camptocamp.com
Mon Apr 3 03:41:37 EDT 2006


I forward this message to the list since some of you might be interested.

-------- Original message --------

Alexandre,

Thanks for your reply, I really appreciate your help.

I was trying to create URL link directly from template and always got a
"/" appended at the end of the base url, which I described in my last
email. I also tried to generate url string from php code and had the
same problem.

After I referred the information you provided, I created the link from
inside the php code too, but I include the whole HTML string into
$row->url, for example, inside php code, I did:

  $url = sprintf('<a href="%s%d" target="_blank">%s</a>',
                            'http://some/base/url?id=',
                            $inputValues['FID'],
                            I18n::gt('More'));
$row->url = $url;

And then I retrieve $row->url from inside the template, then it works.

What I did are within two files:
my_path/cartoweb3/coreplugins/tables/templates/tables.tpl and
my_path/cartoweb3/coreplugins/tables/client/ClientTables.php.

Hope this  would be helpful to others too.

Again, thank you very much and have a nice day,
Xiaoyun

On 3/31/06, *Alexandre Saunier* < alexandre.saunier at camptocamp.com
<mailto:alexandre.saunier at camptocamp.com>> wrote:

     Hello,

     is your link base URL provided through the template or using some PHP
     code? Is it the base URL of your CartoWeb?

     Note that in most cases, you may conveniently use the CartoWeb
     "tableRules" feature to modify the content of your query results,
     including for generating HTML links.

     TableRules are explained in the manual:
 
http://cartoweb.org/doc/cw3.2/xhtml/dev.newplugin.html#dev.newplugin.special.tables
 
<http://cartoweb.org/doc/cw3.2/xhtml/dev.newplugin.html#dev.newplugin.special.tables>

     An example is implemented within the test_main project => have a 
look at
     the testMainTableRules plugin:
 
projects/test_main/plugins/testMainTableRules/client/ClientTestMainTableRules.php

     AS

     Xiaoyun Tang wrote:
      > Hi,
      >
      > I made some changes to tables.tpl such that I am able to add 
links to
      > the query result table. But the template automatically adds a
     backslash
      > "/" to the url which make it impossible to link out to other
     resource.
      >
      > For example, I have a query result table and I want to link to
     other web
      > services, say http://myservices.org,  by using the Id attribute, 
like
      > " http://myservices.org?parameter=Id". But when I check the url
     string
      > from the query result table, I found out a backslash is 
automatically
      > added to the url by the template, so the call becomes
      > "http://myservices.org/?parameter=Id", please note the backslash "/"
      > after "org".
      >
      > Can anyone help me out, please?
      >
      > Thanks,
      >
      > --
      > Xiaoyun Tang




-- 
Xiaoyun Tang


More information about the Cartoweb-users mailing list