How to add category images in directory view?

More
14 years 2 months ago - 14 years 2 months ago #3578 by p.meertens
Hi There,

Hi there, i've just read this article. Something i was really looking for. At least if this is about showing the categorie images in the for "Directory" item in the menu. If not, can some one tell me if that's possible and how?

I've tried to add the <?php echo JHTML::_('image.site', $sub->image, 'images/stories/', NULL, NULL, $sub->title); ?>

I've got 2 directories named "Default" and "Blog" and in both i found the file and changed it accordingly

However it's not having any results. I don't know if i added it properly or not. Could someone take a look at the php file?

Kind regards,
Perry

<?php
/**
* @version 1.5 beta 5 $Id: blog_subcategories.php 127 2009-10-14 15:28:59Z vistamedia $
* @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' );
?>

<?php
$n = count($this->categories);
$i = 0;
?>
<div class="subcategorieslist">
<?php
echo JText::_( 'FLEXI_SUBCATEGORIES' ) . ' : ';
foreach ($this->categories as $sub) :
$subsubcount = count($sub->subcats);
?>
<?php echo $this->escape($sub->title); ?>
<?php echo JHTML::_('image.site', $sub->image, 'images/stories/', NULL, NULL, $sub->title); ?> <?php
if ($this->params->get('show_itemcount', 1)) echo ' (' . ($sub->assigneditems != null ? $sub->assigneditems.'/'.$subsubcount : '0/'.$subsubcount) . ')';
$i++;
if ($i != $n) :
echo ', ';
endif;
endforeach; ?>
</div>
Last edit: 14 years 2 months ago by yopyop001. Reason: Topic divised and renamed (directory instead of sub-categories)

Please Log in or Create an account to join the conversation.

More
14 years 2 months ago #3582 by yopyop001
Hi,

The directory view don't use the same template system as items and categories. (blog and default directories located in components/com_flexicontent/templates/)

To modify the directory template, you have to edit the file :

components/com_flexicontent/views/flexicontent/tmpl/default_categories.php

And you can use template overriding to do that.
( docs.joomla.org/Tutorial_talk:Template_overrides )

To load the image for category you can use :
Code:
<?php echo JHTML::_('image.site', $sub->image, 'images/stories/', NULL, NULL, $sub->title); ?>
between ligne 62
Code:
<?php foreach ($this->categories as $sub) : ?>
and ligne 94 :
Code:
endforeach; ?>

and for subcategories :
Code:
<?php echo JHTML::_('image.site', $subcat->image, 'images/stories/', NULL, NULL, $subcat->title); ?>
between ligne 77
Code:
foreach ($sub->subcats as $subcat) :?>
and ligne 85 :
Code:
endforeach; ?>

I let you adapt your html and css codes.

Rgds.

Please Log in or Create an account to join the conversation.

More
14 years 2 months ago #3605 by p.meertens
It works beautifully. Thank you

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #21713 by ggppdk
Read more here:

www.flexicontent.org/forum/index ... =10#p21712


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #22355 by Ardias3k
Hello, I use the version 1.5.6 RC2a (r1057) and I have taken from the version v1.5.6_preRC3_r1110_Nightly_Build.tar.gz views of the folder / templates.

In the backend I will already see the new directory under Options (extract images from category ...)

The description under the sub-categories of work

but the images are not displayed.

Please Help
Code:
<?php /** * @version 1.5 stable $Id: default_categories.php 1108 2012-01-15 04:06:31Z ggppdk $ * @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' ); jimport('joomla.filesystem.file'); ?> <?php $showassignated = $this->params->get('showassignated', 0); $hide_empty_cats = $this->params->get('hide_empty_cats', 0); $show_cat_descr = $this->params->get('show_cat_descr', 0); $cat_descr_cut = $this->params->get('cat_descr_cut', 100); $show_cat_image = $this->params->get('show_cat_image', 1); $cat_image_source = $this->params->get('cat_image_source', 1); $cat_link_image = $this->params->get('cat_link_image', 1); $cat_image_method = $this->params->get('cat_image_method', 1); $cat_image_width = $this->params->get('cat_image_width', 80); $cat_image_height = $this->params->get('cat_image_height', 80); $hide_empty_subcats = $this->params->get('hide_empty_subcats', 0); $show_subcat_descr = $this->params->get('show_subcat_descr', 0); $subcat_descr_cut = $this->params->get('subcat_descr_cut', 100); $show_subcat_image = $this->params->get('show_subcat_image', 1); $subcat_image_source = $this->params->get('subcat_image_source', 1); $subcat_link_image = $this->params->get('subcat_link_image', 1); $subcat_image_method = $this->params->get('subcat_image_method', 1); $subcat_image_width = $this->params->get('subcat_image_width', 80); $subcat_image_height = $this->params->get('subcat_image_height', 80); jimport( 'joomla.html.parameter' ); $config =& JFactory::getConfig(); $joomla_image_path = FLEXI_J16GE ? $config->getValue('config.image_path', '') : $config->getValue('config.image_path', 'images'.DS.'stories'); // Get the directory menu parameters $cols = JRequest::getVar('columns_count',false); if(!$cols) $cols = $this->params->get('columns_count',1); $c1 = $this->params->get('column1',false); if(!$c1) $c1 = $this->params->get('column1',200); $c2 = $this->params->get('column2',false); if(!$c2) $c2 = $this->params->get('column2',200); $c3 = $this->params->get('column3',false); if(!$c3) $c3 = $this->params->get('column3',200); $i = 0; $condition1 = $condition2 = $condition3 = $style = ''; switch ($cols) { case 1 : $condition1 = ''; $condition2 = ''; $condition3 = ''; $style = ' style="width:100%;"'; break; case 2 : $condition1 = $c1; $condition2 = ''; $condition3 = ''; $style = ' style="width:49%;"'; break; case 3 : $condition1 = $c1; $condition2 = ($c1+$c2); $condition3 = ''; $style = ' style="width:32%;"'; break; case 4 : $condition1 = $c1; $condition2 = ($c1+$c2); $condition3 = ($c1+$c2+$c3); $style = ' style="width:24%;"'; break; } ?> <div class="fccatcolumn "<?php echo $style; ?>> <?php foreach ($this->categories as $sub) : ?> <?php $sub->params = new JParameter($sub->params); if ($this->params->get('hide_empty_cats')) { $subcats_are_empty = 1; if (!$sub->assigneditems) foreach($sub->subcats as $subcat) { if ($subcat->assignedcats || $subcat->assignedsubitems) { $subcats_are_empty = 0; break; } } else { $subcats_are_empty = 0; } if ($subcats_are_empty) continue; } ?> <div class="floattext"> <h2 class="fccat_title_box cat<?php echo $sub->id; ?>"> <a class="fccat_title" href="<?php echo JRoute::_( FlexicontentHelperRoute::getCategoryRoute($sub->slug) ); ?>"> <?php echo $this->escape($sub->title); ?> <?php if ($showassignated) : ?> <span class="fccat_assigned small"><?php echo $sub->assigneditems != null ? '('.$sub->assigneditems.')' : '(0)'; ?></span> <?php endif; ?> </h2> <?php // category image $sub->image = FLEXI_J16GE ? $sub->params->get('image') : $sub->image; $image = ""; if ($show_cat_image) { $image = ""; $sub->introtext = & $sub->description; $sub->fulltext = ""; if ( $cat_image_source && $sub->image && JFile::exists( JPATH_SITE .DS. $joomla_image_path .DS. $sub->image ) ) { $src = JURI::base(true)."/".$joomla_image_path."/".$sub->image; $h = '&amp;h=' . $cat_image_height; $w = '&amp;w=' . $cat_image_width; $aoe = '&amp;aoe=1'; $q = '&amp;q=95'; $zc = $cat_image_method ? '&amp;zc=' . $cat_image_method : ''; $conf = $w . $h . $aoe . $q . $zc; $image = JURI::base().'components/com_flexicontent/librairies/phpthumb/phpThumb.php?src='.$src.$conf; } else if ( $cat_image_source!=1 && $src = flexicontent_html::extractimagesrc($sub) ) { $h = '&amp;h=' . $cat_image_height; $w = '&amp;w=' . $cat_image_width; $aoe = '&amp;aoe=1'; $q = '&amp;q=95'; $zc = $cat_image_method ? '&amp;zc=' . $cat_image_method : ''; $conf = $w . $h . $aoe . $q . $zc; $base_url = (!preg_match("#^http|^https|^ftp#i", $src)) ? JURI::base(true).'/' : ''; $image = JURI::base().'components/com_flexicontent/librairies/phpthumb/phpThumb.php?src='.$base_url.$src.$conf; } if ($image) { $image = '<img class="fccat_image" src="'.$image.'" alt="'.$this->escape($sub->title).'" title="'.$this->escape($sub->title).'"/>'; } else { //$image = '<div class="fccat_image" style="height:'.$cat_image_height.'px;width:'.$cat_image_width.'px;" ></div>'; } if ($cat_link_image && $image) { $image = '[url='.JRoute::_( FlexicontentHelperRoute::getCategoryRoute($sub->slug) ).']'.$image.'[/url]'; } } ?> <?php if ($image) : ?> <span class="fccat_image_box"><?php echo $image; ?></span> <?php endif; ?> <?php if ($show_cat_descr && $sub->description) : ?> <span class="fccat_descr"><?php echo flexicontent_html::striptagsandcut( $sub->description, $cat_descr_cut); ?></span> <?php endif; ?> <div class='clear'></div> <ul class="fcsubcats_list cat<?php echo $sub->id; ?>" > <?php $oddeven = ''; ?> <?php foreach ($sub->subcats as $subcat) : ?> <?php $subcat->params = new JParameter($subcat->params); $oddeven = $oddeven=='even' ? 'odd' : 'even'; if ($hide_empty_subcats) { if (!$subcat->assignedcats && !$subcat->assignedsubitems) continue; } ?> <li class='fcsubcat <?php echo $oddeven; ?>' > <a class='fcsubcat_title' href="<?php echo JRoute::_( FlexicontentHelperRoute::getCategoryRoute($subcat->slug) ); ?>"><?php echo $this->escape($subcat->title); ?> <?php if ($showassignated) : ?> <span class="fcsubcat_assigned small"><?php echo $subcat->assignedsubitems != null ? '('.$subcat->assignedsubitems.'/'.$subcat->assignedcats.')' : '(0/'.$subcat->assignedcats.')'; ?></span> <?php endif; ?> <?php // Category image $subcat->image = FLEXI_J16GE ? $subcat->params->get('image') : $subcat->image; $image = ""; if ($show_subcat_image) { $subcat->introtext = & $subcat->description; $subcat->fulltext = ""; if ( $subcat_image_source && $subcat->image && JFile::exists( JPATH_SITE .DS. $joomla_image_path .DS. $subcat->image ) ) { $src = JURI::base(true)."/".$joomla_image_path."/".$subcat->image; $h = '&amp;h=' . $subcat_image_height; $w = '&amp;w=' . $subcat_image_width; $aoe = '&amp;aoe=1'; $q = '&amp;q=95'; $zc = $subcat_image_method ? '&amp;zc=' . $subcat_image_method : ''; $conf = $w . $h . $aoe . $q . $zc; $image = JURI::base().'components/com_flexicontent/librairies/phpthumb/phpThumb.php?src='.$src.$conf; } else if ( $subcat_image_source!=1 && $src = flexicontent_html::extractimagesrc($subcat) ) { $h = '&amp;h=' . $subcat_image_height; $w = '&amp;w=' . $subcat_image_width; $aoe = '&amp;aoe=1'; $q = '&amp;q=95'; $zc = $subcat_image_method ? '&amp;zc=' . $subcat_image_method : ''; $conf = $w . $h . $aoe . $q . $zc; $base_url = (!preg_match("#^http|^https|^ftp#i", $src)) ? JURI::base(true).'/' : ''; $image = JURI::base().'components/com_flexicontent/librairies/phpthumb/phpThumb.php?src='.$base_url.$src.$conf; } if ($image) { $image = '<img class="fcsubcat_image" src="'.$image.'" alt="'.$this->escape($subcat->title).'" title="'.$this->escape($subcat->title).'"/>'; } else { //$image = '<div class="fcsubcat_image" style="height:'.$subcat_image_height.'px;width:'.$subcat_image_width.'px;" ></div>'; } if ($subcat_link_image && $image) { $image = '[url='.JRoute::_( FlexicontentHelperRoute::getCategoryRoute($subcat->slug) ).']'.$image.'[/url]'; } } ?> <?php if ($image) : ?> <span class="fcsubcat_image_box"><?php echo $image; ?></span> <?php endif; ?> <?php if ($show_subcat_descr && $subcat->description) : ?> <span class="fcsubcat_descr"><?php echo flexicontent_html::striptagsandcut( $subcat->description, $cat_descr_cut); ?></span> <?php endif; ?> <div class='clear'></div> </li> <?php endforeach; ?> </ul> </div> <?php $i++; if ($i == $condition1 || $i == $condition2 || $i == $condition3) : echo '</div><div class="fccatcolumn"'.$style.'>'; endif; endforeach; ?> </div> <div class="clear"></div>

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #22358 by ggppdk
If you would provide more information of what you setup you have made, then we may find if this is a misconfiguration or a bug and fix it.

-- You have created a new joomla menu item pointing to the directory (flexicontent) view?

-- What setting did you choose for images : extract from description, use category image, OR BOTH?

-- Do you have image inside the category description or do you have images in the category parameters or both.

Please provide any other details that maybe relevant and describe your configuration scenario, and how you tested.


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.646 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline