Hi,
I'm not a php guru, but i know enough to modify things around to suit my need. But this time, i'm hitting a wall can not figure out how to achieve my result.
Here is the situation:
I working in a category view.
I have 2 custom fields: an image (called artist-image in my template) and a text (called artist-subtitle in my template) fields.
I'm adapting a script that displays a the title and a subtitle of the item when hovering the image.
My position are set-up fine and works when i use a basic template.
I manage to make everything working fine, but i have a problem with my subtitle field.
here is the code that works without the subtitle output:
Code:
<?php
/**
* @version 1.5 stable $Id: category_items.php 481 2011-03-01 07:14:56Z emmanuel.danan@gmail.com $
* @package Joomla
* @subpackage FLEXIcontent
* @copyright (C) 2009 Emmanuel Danan - www.vistamedia.fr
* @license GNU/GPL v2
*
* FLEXIcontent is a derivative work of the excellent QuickFAQ component
* @copyright (C) 2008 Christoph Lukes
* see www.schlu.net for more information
*
* FLEXIcontent is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
// first define the template name
$tmpl = $this->tmpl;
?>
<?php
$items = $this->items;
$count = count($items);
if ($count) :
?>
<?php
$leadnum = $this->params->get('lead_num', 100);
$leadnum = ($leadnum >= $count) ? $count : $leadnum;
if ($this->limitstart == 0) :
?>
<div id="catview-artist-list">
<?php for ($i=0; $i<$leadnum; $i++) : ?>
<?php if (isset($items[$i]->positions['artist-image'])) : ?>
<?php foreach ($items[$i]->positions['artist-image'] as $field) : ?>
<div class="catview-artist-image rounded7px">
<div class="mosaic-block fade">
<a href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($items[$i]->slug, $items[$i]->categoryslug)); ?>" class="mosaic-overlay">
<div class="details">
<h4><?php echo $this->escape($items[$i]->title); ?></h4>
<p>subtitle field should go here</p>
</div>
<div class="mosaic-backdrop"><?php echo $field->display; ?></div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php endfor; ?>
</div>
<?php endif; ?>
<?php endif; ?>
But i need to have the subtitle to be an output from a field entry of the item "subtitle field should go here"
But if i try to place my artist-subtitle position in between the artist-image position, i get an error and it breaks everything or it does not display properly such as this try:
Code:
<?php
/**
* @version 1.5 stable $Id: category_items.php 481 2011-03-01 07:14:56Z emmanuel.danan@gmail.com $
* @package Joomla
* @subpackage FLEXIcontent
* @copyright (C) 2009 Emmanuel Danan - www.vistamedia.fr
* @license GNU/GPL v2
*
* FLEXIcontent is a derivative work of the excellent QuickFAQ component
* @copyright (C) 2008 Christoph Lukes
* see www.schlu.net for more information
*
* FLEXIcontent is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
// first define the template name
$tmpl = $this->tmpl;
?>
<?php
$items = $this->items;
$count = count($items);
if ($count) :
?>
<?php
$leadnum = $this->params->get('lead_num', 100);
$leadnum = ($leadnum >= $count) ? $count : $leadnum;
if ($this->limitstart == 0) :
?>
<div id="catview-artist-list">
<?php for ($i=0; $i<$leadnum; $i++) : ?>
<?php if (isset($items[$i]->positions['artist-image'])) : ?>
<?php foreach ($items[$i]->positions['artist-image'] as $field) : ?>
<div class="catview-artist-image rounded7px">
<div class="mosaic-block fade">
<a href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($items[$i]->slug, $items[$i]->categoryslug)); ?>" class="mosaic-overlay">
<div class="details">
<h4><?php echo $this->escape($items[$i]->title); ?></h4>
<?php if (isset($items[$i]->positions['artist-subtitle'])) : ?>
<?php foreach ($items[$i]->positions['artist-subtitle'] as $field) : ?>
<p><?php echo $field->display; ?></p>
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="mosaic-backdrop"><?php echo $field->display; ?></div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php endfor; ?>
</div>
<?php endif; ?>
<?php endif; ?>
I have a feeling it's something stupid, but i can figure it out.
I guess i need a first "for each item" statement and then use the "for each position" statement.
Any help would be greatly appreciated.