When using a Fetch( ) function to retrieve the data from a url or other source, you can specify the display of results in your Interactions.
These functions can be naturally generated by the "Code Builder" in the Interactions Manager. Basic Madl components used in the display of fetched data for Interactions include:
$t->row( )
Fetches the source in $mystring into variable $t. Rows will return only the first matching pattern into variable $t.
Parameters | |
---|---|
$mystring | A String. |
Return Values | |
---|---|
$t->result | A String. Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->row('|{DATA}|iU', '{DATA}'); return $t->result;
$t->rows( )
Fetches the source in $mystring into variable $t. Rows will return only the first matching pattern
Parameters | |
---|---|
$mystring | A String. |
Return Values | |
---|---|
$t->result | A String. Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->rows('|{DATA}|iU', '{DATA}'); return $t->result;
$t->headingrows( )
Usually generated by the code builder when you have checked the "Heading Rows" check box in the code builder. Iheadingrows allows for interpretation of a two-level repeating pattern in a document or data structure. The "outer loop" or headings are interpreted by the first two parameters and the "inner loop" by the second. WIth headingrows, the first instance of a header in $t is found and interpreted. At the end of the header regular expression pattern the row regular expression pattern is searched for on an iterative basis and interpreted until another header pattern is encountered. This continues until no further header regular expressions are found or the end of $t is reached.
Parameters | |
---|---|
$mystring | A String. |
Return Values | |
---|---|
$t->result | A String. Returns page source or structured data / XML into variable $t |
Example \ For example in the following example the Date and forecast would be searched for in an outer loop and the flights with an inner loop. Monday 1st May Forecast: Sunny
0600 QF34 London 0925 NZ234 Wellington 1235 EA416 Dubai 1635 BA24 Manchester Tuesday 2nd May Forecast: Drizzle clearing
0545 EA45 Singapore 1200 QF14 Bangkok 1235 EA416 Dubai
$t->fetch("[http://www.verygoldcoast.com.au/attractions/restaurants");] $t->headingRows("|<h1>{HEADING}|U", "<h1>Ray","|<div class="\\\"dl_list_item\\\"">~*<img~*src=\\\"{IMAGE}\\\"~*
$t->append( )
This is a function generated by the interaction builder Append will add any text or HTML in the Footer field of the interaction builder after the result
returned in $t. Often used to create a page footer this function can also be used to display multiple results as well as seen in the example below.
Parameters | |
---|---|
$mystring | A String. |
Return Values | |
---|---|
$t->result | A String. Returns source before $t->result |
$t->fetch("[http://blinkmobile.com.au/index.php/meet-the-team/board-members");] $t->rows( "|<h1 style="\';text-align:">{NAME}</h1>~*<img src="\';{IMAGE}\';" border="\';~*" align="\';LEFT\';" alt="" />{DESCRIPTION}<div style="|U';,">{NAME}<br /><br /> <img src="\';{IMAGE}\';" alt="" /><br /> {DESCRIPTION} <hr />'; ); $t->resolveurls(); $directors = $t->result; $t->fetch(';[http://blinkmobile.com.au/index.php/meet-the-team/staff';);] $t->rows( ';|~*<h1 style="\';text-align:">{NAME}</h1>~*<img src="\';{IMAGE}alt=~*\';LEFT\';" alt="" />{DESCRIPTION}<div style="|U';,">{NAME}<br /><br /> <img src="\';{IMAGE}\';" alt="" /><br /> {DESCRIPTION} <hr />'; ); $t->resolveurls(); $t->append($directors); return $t->result;</div></div>
$t->prepend( )
This is a function generated by the interaction builder Prepend will add any text or HTML in the Header field of the interaction builder before the result returned in $t.
Often used to create a page header this function can also be used to display multiple results as well as seen in the example below.
Parameters | |
---|---|
$mystring | A String. |
Return Values | |
---|---|
$t->result | A String. Returns source before $t->result |
$t->rows( "|<h1 style="\"text-align:">{NAME}</h1>~*<img src="\"{IMAGE}\"" border="\"~*" align="\"LEFT\"" alt="" />{DESCRIPTION}<div style="|U",">{NAME}<br /><br /> <img src="\"{IMAGE}\"" alt="" /><br /> {DESCRIPTION} <hr />" ); $t->resolveurls(); $directors = $t->result; $t->fetch("[http://blinkmobile.com.au/index.php/meet-the-team/staff");] $t->rows( "|~*<h1 style="\"text-align:">{NAME}</h1>~*<img src="\"{IMAGE}alt=~*\"LEFT\"" alt="" />{DESCRIPTION}<div style="|U",">{NAME}<br /><br /> <img src="\"{IMAGE}\"" alt="" /><br /> {DESCRIPTION} <hr />" ); $t->resolveurls(); $t->prepend($directors); return $t->result;</div></div>
$t->wrap( )
This is a function generated by the interaction builder Wrap will add any text or HTML in the Header and Footer fields of the interaction builder before and after the result returned in $t.
Often used to create a page header / footer this function can also be used to control or style display results as well as seen in the example below.
Parameters | |
---|---|
$mystring | A String. |
Return Values | |
---|---|
$t->result | A String. Returns source before and after $t->result |
$t->wrap("Text in the header", "Text in the footer");