Skip to content

Instantly share code, notes, and snippets.

@drmmr763
Created April 16, 2013 04:30
Show Gist options
  • Save drmmr763/5393355 to your computer and use it in GitHub Desktop.
Save drmmr763/5393355 to your computer and use it in GitHub Desktop.
<xsl:variable name="identifier"><xsl:value-of select="field_identifier" /></xsl:variable>
<h1><xsl:value-of select="php:function('Restaurant::getRestaruantData', $identifier)" disable-output-escaping="yes"/></h1>
<?php
public static function getRestaurantData($identifier)
{
// get data from API
$json_data = "https://mydatasource.com/api/data=".$identifier;
$data = json_decode($json_data);
foreach ($data as $item)
{
$html .= '<div class="rating">'.$item->rating.'</div>';
$html .= '<div class="reviews>'.$item->reviews.'</div>';
}
return $html;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment