{jr_fetch}
{jr_fetch} is a special Template function that is used for "including" data from another website (or the local website), by acting as web browser and then allowing you to embed the "fetched" data directly into a Jamroom Template. {jr_fetch} is unique in that will still operate even if the PHP setting "allow_url_fopen" is set to "no".
Parameters:
Name |
Type |
Required |
Default |
Description |
file |
string |
yes |
n/a |
The "file" parameter tells Jamroom what URL you want to include in your template. |
assign |
string |
no |
no |
The "assign" parameter is an optional parameter that allows you to take the "fetched" URL and store it in a template variable for further processing. This is handy to check to ensure the results of the fetch contain valid data. |
Example:
Example using {jr_fetch} to grab the output of an Ad Server located on your server and include it in a Jamroom Template:
{jr_fetch file="http://yoursite.com/adserver/showad?id=random" assign="ad_variable"}
{* now the variable $ad_variable contains the output of the URL - we can check to be sure we didn't have errors *}
{if !strstr($ad_variable,'error')}
{$ad_variable}
{/if} |
|