Share: Share on Facebook Share on X

Search Page Mobile

{source}
<?php
$searchPhrase = $_GET[“searchword”];
$limit = 12;
$offset = JRequest::getVar(‘limitstart’, 0, ”, ‘int’);
$db =& JFactory::getDBO();
$db->setQuery(“SELECT SQL_CALC_FOUND_ROWS id, asset_id, title, alias, introtext, imageone, imageonetext FROM studio_content WHERE catid=8 AND state=1 AND (title LIKE ‘%” . $searchPhrase . “%’ OR introtext LIKE ‘%” . $searchPhrase . “%’) ORDER BY created DESC”, $offset, $limit);
$rL= $db->loadObjectList();
if (!empty($rL)) {
$db->setQuery(‘SELECT FOUND_ROWS();’);
jimport(‘joomla.html.pagination’);
$pageNav = new JPagination( $db->loadResult(), $offset, $limit );
$content = $pageNav->getListFooter();

?>

<ul class=”vmenu”>
<li><h2>Results for:<?php echo ” ” . $searchPhrase; ?></h2></li>
</ul>

<?php
foreach ($rL as $row) {

$db2 = JFactory::getDBO();
$query2 = “SELECT id FROM studio_menu WHERE alias=’” . $row->alias . “‘”;
$db2->setQuery($query2);
$url2 = $db2->loadResult();
$url2 = JRoute::_(“index.php?option=com_content&view=article&id=” . $row->id . “&Itemid=” . $url2);
?>
<div class=”containerHomeImageLeft”>
<a href=”<?php echo $url2 ?>“>
<?php
if (!empty($row->imageone)) { ?>
<img src=”image_archive.php?image=<?php echo $row->imageone; ?>” alt=”<?php echo $row->imageonetext; ?>” />
<?php
} else {
?>
<img src=”images/studio_archive.png” alt=”studio international” />
<?php
}
?>
</a>

<?php
$title_text = $row->title;
$str_title = strlen($title_text);
if ($str_title > 75) {
$str_title = 75;
$title_text = substr ($title_text, 0, 74) . “…”;
}
?>

<a href=”<?php echo $url2 ?>“>
<?php
echo ‘<h2>‘ . $title_text . ‘</h2>‘;
?>
</a>

<p>
<div class=”textHome”>
<?php
$pos_contents = strpos($row->introtext, ‘contents’);
if ($pos_contents < 1) {
$pos_contents = strpos($row->introtext, ‘<strong>‘);
$pos_contents = $pos_contents + 8;
} else {
$pos_contents = $pos_contents + 10;
}
$len_intro = 130 – $str_title;
$intro_text = substr ($row->introtext, $pos_contents, $len_intro) . “…”;
$intro_text = str_replace(“<sup>“, “”, $intro_text);
$intro_text = str_replace(“</sup>“, “”, $intro_text);
$intro_text = str_replace(“<em>“, “”, $intro_text);
$intro_text = str_replace(“</em>“, “”, $intro_text);
$intro_text = str_replace(“<b>“, “”, $intro_text);
$intro_text = str_replace(“</b>“, “”, $intro_text);
echo $intro_text;
echo “</p></div></div>“;
}
echo $pageNav->getPagesLinks();
} else {
?>
<div class=”resultTitle”><b>No Results Found</b></div>
<div class=”result”><h2>No search results could be found for query: <?php echo ” ” . $searchPhrase; ?></h2></div>
<?php
}
?>

{/source}