Hello, i am stuck in a "simple" task. I have an UDT in wich i want to call a variable defined in a page. For instance i have my UDT that execute a SQL query (from a PHP script) embeded in my page A.
In page A i want the query execute on a WHERE clause for instance ...SELECT ... WHERE items="VALUEFROMPAGEA" in order to contextualize my content.
In page B i want the query execute on a WHERE clause for instance ...SELECT ... WHERE items="VALUEFROMPAGEB". etc...
How can i achieve this simply and more elegantly ?
Thank you
UDT, PHP and Page content values RESOLVED
UDT, PHP and Page content values RESOLVED
Last edited by lancester on Tue Nov 26, 2013 3:13 pm, edited 1 time in total.
Re: UDT, PHP and Page content values
You can pass parameters to UDTs.
In the page or template, call:
or
Inside your UDT, you can use:
..to reference your parameter.
Change 'myval' to whatever variable name you want. You can also pass multiple parameters.
In the page or template, call:
Code: Select all
{myudt myval='abc'}
Code: Select all
{myudt myval='def'}
Code: Select all
$params['myval']
Change 'myval' to whatever variable name you want. You can also pass multiple parameters.
Re: UDT, PHP and Page content values
Wishbone wrote:You can pass parameters to UDTs.
In the page or template, call:
orCode: Select all
{myudt myval='abc'}
Inside your UDT, you can use:Code: Select all
{myudt myval='def'}
..to reference your parameter.Code: Select all
$params['myval']
Change 'myval' to whatever variable name you want. You can also pass multiple parameters.
Thank you for your quick answer. In my page i try to add {myudt myval='abc'} in a personnalized content block. (I understood that myudt is my own udt name).
It displays on the site as if it is text "{myudt myval='abc'}".
I tried several way without success. Are you sure i can add this as text into a block content into a page ?
Thank you
Re: UDT, PHP and Page content values [RESOLVED]
Hello, it worked like a charm 
