- Posts: 8
COMMUNITY FORUM
Image not loading
- Dave Spring
-
Topic Author
- Offline
- New Member
This is the code of my generic.php file - Am I missing something or is there something else I should check?
Any bit of help will be much appreciated......
K2HelperUtilities::setDefaultImage($this->item, 'itemlist', $this->params);
$mypagetitle = str_replace('k12', 'K-12', $this->params->get('page_title'));
?>
<div id="genericitemlist">
<!-- Page title -->
<h1 class="componentheading<?php echo $this->params->get('pageclass_sfx')?>"><?php echo $this->escape($mypagetitle); ?></h1>
<?php if(count($this->items)): ?>
<!-- Item list -->
<div class="itemList">
<!-- Secondary items -->
<div id="itemsListSecondary">
<?php foreach($this->items as $item) { ?>
<?php
$fields_var=json_decode($item->extra_fields, true);
$field1=$fields_var[0]["value"];
$field2=$fields_var[1]["value"];
?>
<div class="itemContainer" style="width:100%;">
<!-- Start K2 Item Layout -->
<div class="catItemView">
<div class="catItemImage">
<a href="<?php echo $this->item->link; ?>">
<img src="images/projects/<?php echo $field1 ?>" width="90" height="90" />
</a>
</div>
<div class="catItemDetails">
<div class="catItemTitle">
<a href="<?php echo $item->link; ?>">
<?php echo $item->title; ?>
</a>
</div>
<div class="catItemIntroText">
<?php echo K2HelperUtilities::wordLimit($item->introtext, 26); ?>
</div>
<div class="readMore">
<a href="<?php echo $item->link; ?>">
» View Project
</a>
</div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<!-- End K2 Item Layout -->
Please Log in or Create an account to join the conversation.
- Dave Spring
-
Topic Author
- Offline
- New Member
- Posts: 8
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
A more proper way to retrieve this information would be:
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L104-L109
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Dave Spring
-
Topic Author
- Offline
- New Member
- Posts: 8
Can't figure out what is causing the graphic not to load correctly. I just get a broken image icon. If this code looks good , is there any other files I need to check, that I maybe overlooking?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Make sure your extrafields structure has not been changed.
$field1=$fields_var[0]["value"];
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Dave Spring
-
Topic Author
- Offline
- New Member
- Posts: 8
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
You have to use the field's however.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Dave Spring
-
Topic Author
- Offline
- New Member
- Posts: 8
As I inspected the page, it appears the echo is not returning the designated image. i.imgur.com/7nd2dXu.png
Here is the code for my Category_Item.php .........
K2HelperUtilities::setDefaultImage($this->item, 'itemlist', $this->params);
$fields_var=json_decode($this->item->extra_fields, true);
$field1=$fields_var[0]["value"];
$field2=$fields_var[1]["value"];
?>
<!-- Start K2 Item Layout -->
<div class="catItemView group<?php echo ucfirst($this->item->itemGroup); ?><?php if($this->item->params->get('pageclass_sfx')) echo ' '.$this->item->params->get('pageclass_sfx'); ?>">
<!-- Plugins: BeforeDisplay -->
<?php echo $this->item->event->BeforeDisplay; ?>
<!-- K2 Plugins: K2BeforeDisplay -->
<?php echo $this->item->event->K2BeforeDisplay; ?>
<div class="catItemDetails">
<div class="catItemImage">
<a href="<?php echo $this->item->link; ?>">
<img src="images/projects/<?php echo $field1 ?>" width="90" height="90" />
</a>
</div>
<div class="catItemTitle">
<a href="<?php echo $this->item->link; ?>">
<?php echo $this->item->title; ?>
</a>
</div>
<div class="catItemIntroText">
<?php echo $this->item->introtext; ?>
</div>
<div class="readMore">
<a href="<?php echo $this->item->link; ?>">
» View Project
</a>
</div>
</div>
</div>
<!-- End K2 Item Layout -->
This one is working and this loads the featured items in the list, i.imgur.com/UXpXTkY.png
Am I missing something or my eyes not seeing something?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Dave Spring
-
Topic Author
- Offline
- New Member
- Posts: 8
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
<?php if($this->item->params->get('catItemExtraFields') && count($this->item->extra_fields)): ?>
<!-- Item extra fields -->
<div class="liItemExtraFields catItemExtraFields">
<h4><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h4>
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="extraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="extraFieldsLabel"><?php echo $extraField->name; ?></span>
<span class="extraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
Is there anything appearing?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Dave Spring
-
Topic Author
- Offline
- New Member
- Posts: 8
Please Log in or Create an account to join the conversation.
- Dave Spring
-
Topic Author
- Offline
- New Member
- Posts: 8
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.