I've created a very simple slideshow module. I have a helper.php that gives me all articles of a given category. My problem is that i don't know how to create the readmore link.
That's what i have:
public static function getSildes() {
// return var having the complete carousel stuff
$slide = "";
// a counter for bootstrap active flag
$counter = 0;
// my database connection
$db = JFactory::getDbo();
// i need the cat_id of category named "Bootyslide"
$module = JModuleHelper::getModule('mod_bootyslide');
$category = new JRegistry($module->params);
$cat_id = (int) $category['mycategory'];
// and now i select all the articles with the category id
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__content');
$query->where('catid="' . $cat_id . '"');
$query->where('state="1"');
$db->setQuery((string)$query);
$results = $db->loadObjectList();
foreach($results as $result){
$images = json_decode($result->images);
$image = $images->image_fulltext;
$text = $result->introtext;
$alias = $result->alias;
$fulltext = $result->fulltext;
($counter == 0) ? $active = "active" : $active = "";
$slide .= " <div class=\"item " . $active . "\">";
if (strlen($image) > 0) {
$slide .= " <img src=\"" . $image . "\">";
}
$slide .= " <div class=\"carousel-caption\">
<div class=\"container\">
<div>
" . $text . "
</div>
<!-- the readmore link -->
</div>
</div>
</div> ";
++$counter;
}
return $slide;
}
I know that when the column fulltext has values, I should create the readmore link, that's not the problem. I really don't know how to create the URL.