Skip to content

Instantly share code, notes, and snippets.

@moskowite
Created April 16, 2012 22:51
Show Gist options
  • Save moskowite/2402160 to your computer and use it in GitHub Desktop.
Save moskowite/2402160 to your computer and use it in GitHub Desktop.
$att = "value";
$bogus = array('<p>', '</p>', '<br>');
foreach ($results as $item) {
$blurb = $item->S;
$better = str_replace($bogus, "", $blurb);
$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