2017-01-09, 05:18:31
Hello Bigin,
thank you for the time you spent to help me. As expected, your code works great, and one thing I still couldn't find out is how to implement the enabled/disabled (active) state into my code. Here is what I got so far. I know it's terribly wriiten but I find it really difficult to understand OOP as a beginner... :-) Please ignore the inline styles, they will be replaced later with classes.
Thank you very much again and have a nice evening :-)
thank you for the time you spent to help me. As expected, your code works great, and one thing I still couldn't find out is how to implement the enabled/disabled (active) state into my code. Here is what I got so far. I know it's terribly wriiten but I find it really difficult to understand OOP as a beginner... :-) Please ignore the inline styles, they will be replaced later with classes.
PHP Code:
<?php
$slug = get_page_slug(false);
$page = get_site_url(false);
$manager = new IManager();
if(!$manager){die('ItemManager not installed!');}
$kategorie = $manager->getCategoryMapper()->getCategory('name=Angebote');
if(!$kategorie){die('Angebote category does not exist!');}
$itemClass = $manager->getItemClass();
$itemClass->init($kategorie->id);
$itemClass->filterItems('position', 'ASC'); // updated
foreach($itemClass->items as $item) {
echo "<div class=\"".strtolower(htmlspecialchars($item->fields->package->value))."\">\r\n";
if(!empty($item->fields->visibleonhome->value) == 1) {
echo '<div style="margin: 10px 10px 0 0; display: block; float: right; border-radius: 50%; background: green; width: 15px; height: 15px;"></div>';
}
if(!empty($item->fields->image->value)) {
$imageTitle = $manager->sanitizer->text($item->fields->image->title[0]);
$imageUrl = $manager->sanitizer->text($item->fields->image->fullurl[0]);
echo "\t";
echo '<div style="width: 40%; float: left;"><img alt="'.$imageTitle.'" src="'.$page.$imageUrl.'" /></div>';
echo "\r\n";
}
echo "\t<div style=\"width: 60%; float: left; padding: 0 30px 30px 30px;\">\r\n";
echo "\t<h1>" . htmlspecialchars($item->name) . "</h1>";
echo "\r\n";
if(!empty($item->fields->package->value)) {
echo "\t<p class=\"category ".strtolower(htmlspecialchars($item->fields->package->value))."\">" . htmlspecialchars($item->fields->package->value) . "</p>";
echo "\r\n";
}
if(!empty($item->fields->teaser->value)) {
echo $item->fields->teaser->value . "";
echo "\r\n";
}
if(!empty($item->fields->more->value)) {
echo "\t<a href=\"#\" class=\"more\">" . $item->fields->more->value . "<i class=\"fa fa-angle-right\" aria-hidden=\"true\"></i></a>";
echo "\r\n";
}
else {
echo "\t</div>\r\n";
}
if(!empty($item->fields->content->value) && !empty($item->fields->more->value)) {
echo "\t<span class=\"hidden\">" . $item->fields->content->value . "</span>";
echo "\r\n";
echo "\t</div>\r\n";
}
echo "</div>\r\n\r\n";
}
?>
Thank you very much again and have a nice evening :-)