Hi there, 

i have written my own keyword handler for phptal which handles the link:
keyword. This worked quite well for simple links but now i want to build 
more complex ones.

I call my handler like this in the simple case:
<a tal:attributes="href link:/*/*/folder">...</a>
The code in the template is this:
Core_Helper_LinkHelper::getInstance()->createUrl('folder',array())
That comes up with a link href="/Module/Controller/folder" which is ok.

Now i want to do this:
<a tal:attributes="href link:/*/*/folder:goto//${ud/id}">
The code in the template should look like that:
Core_Helper_LinkHelper::getInstance()->createUrl('folder',array('goto'=>XXX))
with XXX shall be a function of phptal translating ${ud/id} to the actual 
value.

The important part of my code is this: ($t[1] is the part after the ":")
        $p = explode('//', $t[1]);
        $parameter = 'array(';
        while(($k = array_shift($p)) && ($value = array_shift($p))) {
            $parameter .= ("'".$k."'=>".phptal_tales($value,$nothrow).',');
        }
        $parameter .= ')';
        return 
'Core_Helper_LinkHelper::getInstance()->createUrl('.rtrim($params, 
',').','.$parameter.')';
But phptal_tales() seems not to be the right function as it generates the line 
as this:
Core_Helper_LinkHelper::getInstance()->createUrl('folder',array('goto'=>$ctx->'.phptal_path($ctx->ud
 , 'id').',))
which ends in a parser error...

Whats the correct way to implement this?


-- 
 MfG, Christian Welzel

  GPG-Key:     http://www.camlann.de/key.asc
  Fingerprint: 4F50 19BF 3346 36A6 CFA9 DBDC C268 6D24 70A1 AD15

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to