Skip to content

Instantly share code, notes, and snippets.

@whyisjake
Forked from moskowite/gist:2402160
Created April 16, 2012 23:09
Show Gist options
  • Save whyisjake/2402240 to your computer and use it in GitHub Desktop.
Save whyisjake/2402240 to your computer and use it in GitHub Desktop.
//Removed the bogus stuff in place of strip_tags
$att = "value";
foreach ($results as $item) {
$image = $item->xpath(".//DataObject[@type='cse_image']/Attribute");
if ( !empty($image)) {
echo '<div class="row result"><div class="result">';
echo '<div class="span2">';
echo '<img class="thumbnail" src="';
echo $image[0]->attributes()->$att;
echo '?w=100" width="100" />';
echo '</div>';
echo '<div class="span8"><h3><a href="'.$item->U.'">';
echo $item->T;
echo '</a></h3>';
echo '<a href="'.$item->U.'"</a>'.$item->UE.'</a>';
echo '<p>'.strip_tags($item->S).'</p></div></div><div class="clear:both"></div></div><div class="clear:both"></div>';
} else {
echo '<div class="row result"><div class="result">';
echo '<div class="span10"><h3><a href="'.$item->U.'">';
//namify($item);
echo $item->T;
echo '</a></h3>';
echo '<a href="'.$item->U.'"</a>'.$item->UE.'</a>';
echo '<p>'.strip_tags($item->S).'</p></div></div></div> ';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment