When using a Fetch( )) function to retrieve the data from a url or other source, you can specify and filter results in your Interactions.
These functions can be naturally generated by the "Code Builder" in the Interactions Manager.
Basic Madl components used in the formatting or changing of fetched data in Interactions.
$t->trim( )
This function will find removes white space off start and end of any data found in the fetch results.
Parameters | |
---|---|
None |
Return Values | |
---|---|
$t->result | Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->trim(); return $t->result;
$t->preg_replace( )
This function will find removes white space off start and end of any data found in the fetch results.
Parameters | |
---|---|
For more information on parameter see the php guide at [http://php.net/manual/en/function.preg-replace.php] |
Return Values | |
---|---|
$t->result | Returns page source or structured data / XML into variable $t |
$t->removeExtraSpaces( )
This function will find removes white space off start and end of any data found in the fetch results. Typically used with SMS functions in Madl..
Parameters | |
---|---|
None |
Return Values | |
---|---|
$t->result | Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->removeExtraSpaces(); return $t->result;
$t->removeNewlines( )
This function will remove all instances of the following characters in the fetch results. Common use is for removing returns from fetch results to assist with
displaying data in containers without spaces. "\t" "\n" "\r" "\x20\x20" "\0" "\x0B"
Parameters | |
---|---|
None |
Return Values | |
---|---|
$t->result | Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->removeNewlines(); return $t->result;
$t->removeTags( )
This function will remove all HTML tags s in the fetch results. Common use is for removing <p> <a> tags from fetch results to assist with displaying data in containers.Parameters | |
---|---|
$allowable_tags | Optional $allowable_tags parameter lets you specify the tags you do not want to remove. |
Return Values | |
---|---|
$t->result | Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->removeTags ( string $str [, string $allowable_tags ] ) return $t->result;
$t->replace( )
This function will find and replace any data found in the fetch results. Common use is for replacing results be it text, images or HTML tags to assist with displaying data.
Parameters | |
---|---|
$search | String. Required. Specifies the value to find |
$replace | String. Required. Specifies the value to replace the value in find |
Return Values | |
---|---|
$t->result | Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->replace("For information about things for visitors to see and do in and around Brisbane, visit:",""); return $t->result;
$t->str_replace( )
This function will find and replace any data found in the fetch results. Common use is for replacing results be it text, images or HTML tags to assist with displaying data.
Parameters | |
---|---|
$search | String. Required. Specifies the value to find |
$replace | String. Required. Specifies the value to replace the value in find |
Return Values | |
---|---|
$t->result | Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->str_replace("Experience Brisbane",""); return $t->result;
$t->ucwirds( )
Returns a string with the first character of each word in str capitalised, if that character is alphabetic.
Parameters | |
---|---|
None |
Return Values | |
---|---|
$t->result | Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->ucwords(); return $t->result;
$t->resolveurls( )
Resolves any urls found in the fetch results.
Parameters | |
---|---|
None |
Return Values | |
---|---|
$t->result | Returns page source or structured data / XML into variable $t |
$t->fetch("[http://blinkmobile.com.au/mobile-solutions/");] $t->resolveurls(); return $t->result;
$t->header( )
Introduced in the April 2013 release BMP Sand Box of client code.
Header() is used to send a raw HTTP header. See the » HTTP/1.1 specification for more information on HTTP headers.
Parameters | |
---|---|
$string | A String containing the header string. |
$replace | Boolean, The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type.By default it will replace,but if you pass in FALSE as the second argument you can force multiple headers of the same type. |
$http_response_code | An Integer, or String containing url or page to re-direct to. |
$eader_in_output=false | Forces the HTTP response code to the specified value. Note that this parameter only has an effect if the string is not empty. |
Return Values | |
---|---|
$t->result | Currently the setCode() function will automatically replace all header() to $t->header(). From the April 2013 release it is advised to use this mADL function instead. |