UDT, PHP and Page content values RESOLVED

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
lancester
New Member
New Member
Posts: 6
Joined: Tue Apr 26, 2011 3:40 pm

UDT, PHP and Page content values RESOLVED

Post by lancester »

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
Last edited by lancester on Tue Nov 26, 2013 3:13 pm, edited 1 time in total.
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: UDT, PHP and Page content values

Post by Wishbone »

You can pass parameters to UDTs.

In the page or template, call:

Code: Select all

{myudt myval='abc'}
or

Code: Select all

{myudt myval='def'}
Inside your UDT, you can use:

Code: Select all

$params['myval']
..to reference your parameter.

Change 'myval' to whatever variable name you want. You can also pass multiple parameters.
lancester
New Member
New Member
Posts: 6
Joined: Tue Apr 26, 2011 3:40 pm

Re: UDT, PHP and Page content values

Post by lancester »

Wishbone wrote:You can pass parameters to UDTs.

In the page or template, call:

Code: Select all

{myudt myval='abc'}
or

Code: Select all

{myudt myval='def'}
Inside your UDT, you can use:

Code: Select all

$params['myval']
..to reference your parameter.

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
lancester
New Member
New Member
Posts: 6
Joined: Tue Apr 26, 2011 3:40 pm

Re: UDT, PHP and Page content values [RESOLVED]

Post by lancester »

Hello, it worked like a charm :-)
Post Reply

Return to “The Lounge”