Bonsoir,
Je souhaite utiliser le module YooDrawer pour faire fonctionner un slideshow sur ma page d'accueil mais il ne charge que la description "text", c'est à dire le corps des articles. Alors que j'ai un champ image, et quelques champs texte.
Apparemment, le problème vient de la façon dont sont écrits le helper.php et le mod_yoo_drawer.php.
J'ai suivi le tuto de Matthieu (
www.internet-montelimar.com/blog
... ntent.html
) et ai cherché à comprendre pendant une paire d'heures mais là, je touche mes limites.
Ca ne me paraît pas irréalisable pourtant au vu du code...
Je ne vais pas partager ici le plugin vus qu'il est nécéssaire d'adhérer un club Yoo pour le télécharger mais je ne pense pas porter atteinte aux auteurs en copiant ici le helper et le mod_yoo_drawer.php:
helper.php
Code:
<?php
/**
* YOOdrawer Joomla! Module
*
* @author yootheme.com
* @copyright Copyright (C) 2007 YOOtheme Ltd. & Co. KG. All rights reserved.
* @license GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
require_once (JPATH_SITE . '/components/com_content/helpers/route.php');
class modYOOdrawerHelper
{
function renderItem(&$item, &$params, &$access)
{
global $mainframe;
$user =& JFactory::getUser();
$item->text = $item->introtext;
$item->groups = '';
$item->readmore = (trim($item->fulltext) != '');
$item->metadesc = '';
$item->metakey = '';
$item->access = '';
$item->created = '';
$item->modified = '';
if ($params->get('readmore'))
{
// Check to see if the user has access to view the full article
if ($item->access <= $user->get('aid', 0)) {
$linkOn = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid));
} else {
$linkOn = JRoute::_('index.php?option=com_user&task=register');
}
$item->linkOn = $linkOn;
}
require(JModuleHelper::getLayoutPath('mod_yoo_drawer', '_item'));
}
function getList(&$params, &$access)
{
global $mainframe;
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$aid = $user->get('aid', 0);
$catid = (int) $params->get('catid', 0);
$items = (int) $params->get('items', 0);
$order = $params->get('order', 'o_asc');
$contentConfig = &JComponentHelper::getParams( 'com_content' );
$noauth = !$contentConfig->get('shownoauth');
$nullDate = $db->getNullDate();
jimport('joomla.utilities.date');
$date = new JDate();
$now = $date->toMySQL();
// Ordering
switch ($order) {
case 'm_dsc':
$ordering = 'a.modified DESC, a.created DESC';
break;
case 'h_dsc':
$ordering = 'a.hits DESC, a.created DESC';
break;
case 'c_dsc':
$ordering = 'a.created DESC';
break;
case 'o_asc':
default:
$ordering = 'a.ordering';
break;
}
// Query to determine article count
$query = 'SELECT a.*,' .
' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'.
' CASE WHEN CHAR_LENGTH(cc.name) THEN CONCAT_WS(":", cc.id, cc.name) ELSE cc.id END as catslug'.
' FROM #__content AS a' .
' INNER JOIN #__categories AS cc ON cc.id = a.catid' .
' INNER JOIN #__sections AS s ON s.id = a.sectionid' .
' WHERE a.state = 1 ' .
($noauth ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : '').
' AND (a.publish_up = "'.$nullDate.'" OR a.publish_up <= "'.$now.'" ) ' .
' AND (a.publish_down = "'.$nullDate.'" OR a.publish_down >= "'.$now.'" )' .
' AND cc.id = '. $catid .
' AND cc.section = s.id' .
' AND cc.published = 1' .
' AND s.published = 1' .
' ORDER BY ' . $ordering;
$db->setQuery($query);
$rows = $db->loadObjectList();
if ($order == 'rnd') shuffle($rows);
return array_slice($rows, 0, $items);
}
}
mod_yoo_drawer.php
Code:
<?php
/**
* YOOdrawer Joomla! Module
*
* @author yootheme.com
* @copyright Copyright (C) 2007 YOOtheme Ltd. & Co. KG. All rights reserved.
* @license GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
global $mainframe;
// count instances
if (!isset($GLOBALS['yoo_drawers'])) {
$GLOBALS['yoo_drawers'] = 1;
} else {
$GLOBALS['yoo_drawers']++;
}
// include the syndicate functions only once
require_once (dirname(__FILE__).DS.'helper.php');
// disable edit ability icon
$access = new stdClass();
$access->canEdit = 0;
$access->canEditOwn = 0;
$access->canPublish = 0;
$list = modYOOdrawerHelper::getList($params, $access);
// check if any results returned
$items = count($list);
if (!$items) {
return;
}
// init vars
$style = $params->get('style', 'default-v');
$module_height = $params->get('module_height', '150');
$item_size = $params->get('item_size', '220');
$item_minimized = $params->get('item_minimized', '90');
$title = $params->get('title', 'Title');
$module_base = JURI::base() . 'modules/mod_yoo_drawer/';
// css parameters
$drawer_id = 'yoo-drawer-' . $GLOBALS['yoo_drawers'];
switch ($style) {
// horizontal
case "photo-h":
$layout = 'horizontal';
$item_width = $item_size;
$item_height = $module_height;
$module_width = $item_size + ($items-1) * $item_minimized;
$css_item_width = 'width: ' . $item_width . 'px;';
$css_item_height = 'height: ' . $item_height . 'px;';
$css_module_width = 'width: ' . $module_width . 'px;';
$css_module_height = 'height: ' . $module_height . 'px;';
// js parameters
$item_shift = $item_size - $item_minimized + 1;
break;
// vertical
case "photo-v":
$layout = 'vertical';
$item_height = $item_size;
$module_height = $item_size + ($items-1) * $item_minimized;
$css_item_height = 'height: ' . $item_height . 'px;';
$css_module_height = 'height: ' . $module_height . 'px;';
// js parameters
$item_shift = $item_size - $item_minimized + 10;
break;
case "default-v":
default:
$layout = 'vertical';
$item_height = $item_size - 10;
$module_height = $item_size + ($items-1) * $item_minimized;
$css_item_height = 'height: ' . $item_height . 'px;';
$css_module_height = 'height: ' . $module_height . 'px;';
// js parameters
$item_shift = $item_size - $item_minimized - 10;
}
$javascript = "new YOOdrawer('" . $drawer_id . "', '#" . $drawer_id . " .item', { layout: '" . $layout . "', shiftSize: " . $item_shift . " });";
switch ($style) {
case "photo-h":
require(JModuleHelper::getLayoutPath('mod_yoo_drawer', 'photo-h'));
break;
case "photo-v":
require(JModuleHelper::getLayoutPath('mod_yoo_drawer', 'photo-v'));
break;
default:
require(JModuleHelper::getLayoutPath('mod_yoo_drawer', 'default-v'));
}
$document =& JFactory::getDocument();
$document->addStyleSheet($module_base . 'mod_yoo_drawer.css.php');
$document->addScript($module_base . 'mod_yoo_drawer.js');
echo "<script type=\"text/javascript\">\n// <!--\nwindow.addEvent('domready', function(){ $javascript });\n// -->\n</script>\n";
En plus de suivre le tuto cité plus haut j'ai essayé de remplacer les com_content en com_flexicontent et quelques autres bricoles en essayant de garder des fichiers cohérents...
Je vous remercie par avance de toute aide, précieuse !