ez projects / ezjscore / forum / general / parameters in template call
You need to be logged in to post messages in the forums. New users may register here.
Member since: Posts: 29 |
Tuesday 26 January 2010 4:42:43 pm I'm building a simple ajax imagegallery to master this extension, and I thought I'd start with the 'simplified' version: TemplateFunction=true. By calling templates only I don't have to bother with the API yet.
The current urls my script generates are like /ezjscore/call/gallery::view::<node_id>. How do I access the node_id parameter from my templates/gallery/view.tpl template? Or is this not possible yet? eZ Publish certified developer |
|
Member since: Posts: 29 |
Tuesday 26 January 2010 5:32:56 pm I have a really dirty workaround by putting the $_SERVER var in an autoload operator. Now I can access the parameters by using the REQUEST_URI variable.
When using a clean approach with postvariables, like in the esjzcore_demo extension, the problem persists. Ezjscore doesn't seem to pass on post variables. I guess that makes my post a feature request ;-) eZ Publish certified developer |
|
|
Member since: Posts: 221 |
Tuesday 26 January 2010 5:44:26 pm Unfortunately, passing vars in POST is not really well supported, as those will not be encapsulated and will have to be later fetched in $_POST. It is imho a bad design that should be fixed sooner or later (see http://projects.ez.no/ezjscore/fo..._of_standard_rpc_protocols#msg20752)
Otoh the vars put in the GET should arrive in your template - even though I do not remember right now the name of the variable storing them... Principal Consultant International Business |
|
Member since: Posts: 168 |
Wednesday 27 January 2010 10:23:38 am Commited some more example code in ezjscore/design/standard/templates/ezjsctemplate/test.tpl:
This {'is'} a template function test! {* Using native arguments *} {if is_set( $arguments[0] )} With argument[0] being: "{$arguments[0]|wash}". {/if} {* Using post parameters ( Should not be used if method could be GET as forced in Y.ez() or $.ez() ) *} {if ezhttp_hasvariable( 'customPostParam', 'post' )} With customPostParam post parameter being: "{ezhttp( 'customPostParam', 'post' )|wash}". {/if} Hope this helps ;) Note: ezjscore uses POST, and as of 1.0.1 params are not sent in url, as of 1.1 you'll be able to use GET with params in url if you specify it when calling Y.ez() / $.ez(). Usefull if you want request to be cached. eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription |
|
Member since: Posts: 29 |
Wednesday 27 January 2010 11:30:02 am I didn't know about the ezhttp operator. Thanks for your help both!
eZ Publish certified developer |
You need to be logged in to post messages in the forums. New users may register here.