2017-01-08, 22:29:40
Hello Bigin,
thank you again for your help. I think I understand it so far.
I hope you can help me with this piece of code
This works great until I re-sort the items in the item manager. After doing that, the path (src) to the image changes from originally:
to:
Depending on how often I re-sort the items the item manager repeats the part 'http://localhost/test-gs'.
After I just save the item again everything is fine. Is this a bug or simply my poor knowledge of programming? :-)
One more question: how can I - based on my code - show/display only the enabled items? I've tried with active=1 but with no success.
Thank you again for your great plug in and have a relaxed sunday :-)
thank you again for your help. I think I understand it so far.
I hope you can help me with this piece of code
PHP Code:
<?php
$slug = get_page_slug(false);
$manager = new IManager();
if(!$manager){die('ItemManager not installed!');}
$kategorie = $manager->getCategoryMapper()->getCategory('name=Kategorie');
if(!$kategorie){die('Category -Kategorie- does not exist!');}
$itemClass = $manager->getItemClass();
$itemClass->init($kategorie->get('id'));
$itemClass->filterItems('position', 'ASC');
foreach($itemClass->items as $item)
{
$entries = strtolower($item->fields->art->value);
if($entries == $slug)
{
if(!empty($item->fields->image->imagefullurl[0])) // Output image Nr 1
{
echo '<img alt="'.$item->fields->image->imagetitle[0].'" src="'. htmlspecialchars($item->fields->image->imagefullurl[0]). '" />';
}
}
}
?>
This works great until I re-sort the items in the item manager. After doing that, the path (src) to the image changes from originally:
PHP Code:
http://localhost/test-gs/data/uploads/imanager/2.2/Fingerprint.png
to:
PHP Code:
http://localhost/test-gs/http://localhost/test-gs/http://localhost/test-gs/http://localhost/test-gs/http://localhost/test-gs/data/uploads/imanager/2.2/Fingerprint.png
Depending on how often I re-sort the items the item manager repeats the part 'http://localhost/test-gs'.
After I just save the item again everything is fine. Is this a bug or simply my poor knowledge of programming? :-)
One more question: how can I - based on my code - show/display only the enabled items? I've tried with active=1 but with no success.
Thank you again for your great plug in and have a relaxed sunday :-)