PDA

Zobacz pełną wersję : Rotator artykułów



Robster
26-02-2010, 20:24
Szukam aktywnego linku do tego modułu:
http://extensions.joomla.org/extensions/news-display/articles-showcase/11309
dobrze by było, gdyby były tam od razu jakieś informacje co do konfiguracji.

Jeśli ktoś może polecić inny komponent z tego zakresu, to byłbym wdzięczny. Niekoniecznie musi być bardzo rozbudowany komponent, chodzi tylko o to by można było podpinać artykuły do slajdów z krótkim opisem (podpinanie nie musi być dynamiczne [podpinanie sekcji czy kategorii], może polegać na zwyczajnym podpięciu linka pod obrazek).
Szukałem czegoś na joomla.org, ale prócz tego jednego pozostałe albo nie działały na 1.5 jak trzeba (mimo zgodności) lub nie spełniały wymagać estetycznych lub funkcjonalnych.

Dylek
26-02-2010, 21:10
Przecież link na stronie którą podałeś działa.

Robster
26-02-2010, 21:44
Oj przepraszam. Jeszcze przed godziną nie działał. Wysłałem do supportu raport o niedziałającym linku, pewnie dlatego działa w tym momencie.
Tak więc temat nie ważny.

EDIT:
Jednak nie jest tak pięknie :/
Zainstalowałem moduł i otrzymałem taki oto błąd po przeładowaniu strony:
Parse error: syntax error, unexpected T_CLASS in /var/www/sites/yoyo.pl/c/o/codebox/modules/mod_lofarticlesslideshow/helper.php on line 20

Kod z wyżej wymienionego pliku:

<?php
/**
* $ModDesc
*
* @version $Id: helper.php $Revision
* @package modules
* @subpackage mod_lofslidenews
* @copyright Copyright (C) JAN 2010 LandOfCoder.com <@emai:landofcoder@gmail.com>. All rights reserved.
* @website htt://landofcoder.com
* @license GNU General Public License version 2
*/
// no direct access
defined('_JEXEC') or die;

require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'he lpers'.DS.'route.php';
if( !defined('PhpThumbFactoryLoaded') ) {
require_once dirname(__FILE__).DS.'libs'.DS.'phpthumb/ThumbLib.inc.php';
define('PhpThumbFactoryLoaded',1);
}
Linia 20
abstract class modLofArticlesSlideShowHelper {

Dalsza część kodu

/**
* get list articles
*/
public static function getList( $params ){
if( JVersion::isCompatible('1.6.0') ) {
return self::getListJLOneSix( $params );
}
return self::getListJLOneFive( $params );
}

/**
* get the list of articles, using for joomla 1.6.x
*
* @param JParameter $params;
* @return Array
*/
public static function getListJLOneFive( $params ){
global $mainframe;
$maxTitle = $params->get( 'max_title', '100' );
$maxDesciption = $params->get( 'max_description', 100 );
$openTarget = $params->get( 'open_target', 'parent' );
$formatter = $params->get( 'style_displaying', 'title' );
$titleMaxChars = $params->get( 'title_max_chars', '100' );
$descriptionMaxChars = $params->get( 'description_max_chars', 100 );
$condition = self::buildConditionQuery( $params );
$isThumb = $params->get( 'auto_renderthumb',1);
$ordering = $params->get( 'ordering', 'created_asc');
$limit = $params->get( 'limit_items', 4 );
$ordering = str_replace( '_', ' ', $ordering );
$my = &JFactory::getUser();
$aid = $my->get( 'aid', 0 );
$thumbWidth = (int)$params->get( 'thumbnail_width', 60 );
$thumbHeight = (int)$params->get( 'thumbnail_height', 60 );
$imageHeight = (int)$params->get( 'module_height', 300 ) ;
$imageWidth = (int)$params->get( 'module_width', 900 ) ;

$db = &JFactory::getDBO();
$date =& JFactory::getDate();
$now = $date->toMySQL();

// make sql query
$query = 'SELECT a.*,cc.description as catdesc, cc.title as category_title, cc.title as cattitle,s.description as secdesc, s.title as sectitle,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
. ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":",cc.id,cc.alias) ELSE cc.id END as catslug,'
. ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as secslug'
. "\n FROM #__content AS a"
. ' INNER JOIN #__categories AS cc ON cc.id = a.catid'
. ' INNER JOIN #__sections AS s ON s.id = a.sectionid'
. "\n WHERE a.state = 1"
. "\n AND ( a.publish_up = " . $db->Quote( $db->getNullDate() ) . " OR a.publish_up <= " . $db->Quote( $now ) . " )"
. "\n AND ( a.publish_down = " . $db->Quote( $db->getNullDate() ) . " OR a.publish_down >= " . $db->Quote( $now ) . " )"
. ( ( !$mainframe->getCfg( 'shownoauth' ) ) ? "\n AND a.access <= " . (int) $aid : '' )
;

$query .= $condition . ' ORDER BY ' . $ordering;
$query .= $limit ? ' LIMIT ' . $limit : '';
$db->setQuery($query);
$data = $db->loadObjectlist();
if( empty($data) ) return array();

foreach( $data as $key => $item ){
if($item->access <= $aid ) {
$data[$key]->link = JRoute::_(ContentHelperRoute::getArticleRoute($ite m->slug, $item->catslug, $item->sectionid));
} else {
$data[$key]->link = JRoute::_('index.php?option=com_user&view=login');
}
$item->date = JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC2'));

$item->subtitle = self::substring( $item->title, $titleMaxChars );
$item->description = self::substring( $item->introtext,
$descriptionMaxChars );

self::parseImages( $item );
if( $item->mainImage && $image=self::renderThumb($item->mainImage, $imageWidth, $imageHeight, $item->title ) ){
$item->mainImage = $image;
}

if( $item->thumbnail && $image = self::renderThumb($item->thumbnail, $thumbWidth, $thumbHeight) ){
$item->thumbnail = $image;
}
}
return $data;
}

/**
* get the list of articles, using for joomla 1.6.x
*
* @param JParameter $params;
* @return array;
*/
public static function getListJLOneSix( &$params ) {
$formatter = $params->get( 'style_displaying', 'title' );
$titleMaxChars = $params->get( 'title_max_chars', '100' );
$descriptionMaxChars = $params->get( 'description_max_chars', 100 );
$thumbWidth = (int)$params->get( 'thumbnail_width', 60 );
$thumbHeight = (int)$params->get( 'thumbnail_height', 60 );
$imageHeight = (int)$params->get( 'module_height', 300 ) ;
$imageWidth = (int)$params->get( 'module_width', 650 ) ;

JModel::addIncludePath(JPATH_SITE.DS.'components'. DS.'com_content'.DS.'models');
// Get an instance of the generic articles model
$model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
// Set application parameters in model
$appParams = JFactory::getApplication()->getParams();
$model->setState('params', $appParams);
$openTarget = $params->get( 'open_target', 'parent' );
// Set the filters based on the module params
$model->setState('list.start', 0);
$model->setState('list.limit', (int) $params->get('limit_items', 5));
$model->setState('filter.published', 1);

// Access filter
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser ()->get('id'));
$model->setState('filter.access', $access);

// Category filter
if ($catid = $params->get('category')) {
if( count ($catid) == 1 && !$catid[0] ) {
$model->setState('filter.category_id', null);
}
else {
$model->setState('filter.category_id', $catid);
}
}

// User filter
$userId = JFactory::getUser()->get('id');

$ordering = $params->get('ordering', 'created_asc');
$limit = $params->get( 'limit_items', 4 );
$ordering = split( '_', $ordering );

$model->setState('list.ordering', $ordering[0]);
$model->setState('list.direction', $ordering[1]);

$items = $model->getItems();

foreach ($items as $key => &$item) {
$item->slug = $item->id.':'.$item->alias;
$item->catslug = $item->catid.':'.$item->category_alias;

if ( $access || in_array($item->access, $authorised) ) {
$item->link = JRoute::_(ContentRoute::article($item->slug, $item->catslug));
}

else {
$item->link = JRoute::_('index.php?option=com_user&view=login');
}
$item->date = JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC2'));


self::parseImages( $item );

if( $item->mainImage && $image=self::renderThumb($item->mainImage, $imageWidth, $imageHeight, $item->title ) ){
$item->mainImage = $image;
}

if( $item->thumbnail && $image = self::renderThumb($item->thumbnail, $thumbWidth, $thumbHeight) ){
$item->thumbnail = $image;
}
$item->introtext = JHtml::_('content.prepare', $item->introtext);
$item->subtitle = self::substring( $item->title, $titleMaxChars );
$item->description = self::substring( $item->introtext, $descriptionMaxChars );

}
return $items;
}

/**
* build condition query base parameter
*
* @param JParameter $params;
* @return string.
*/
public static function buildConditionQuery( $params ){

$catids = $params->get('category','');
if( !$catids ){
return '';
}
$catids = !is_array($catids) ? $catids : '"'.implode('","',$catids).'"';
$condition = ' AND a.catid IN( '.$catids.' )';
return $condition;
}

/**
* parser a custom tag in the content of article to get the image setting.
*
* @param string $text
* @return array if maching.
*/
public static function parserCustomTag( $text ){
if( preg_match("#{lofimg(.*)}#s", $text, $matches, PREG_OFFSET_CAPTURE) ){
return $matches;
}
return null;
}

/**
* check the folder is existed, if not make a directory and set permission is 755
*
*
* @param array $path
* @access public,
* @return boolean.
*/
public static function makeDir( $path ){
$folders = explode ( '/', ( $path ) );
$tmppath = JPATH_SITE.DS.'images'.DS.'lofthumbs'.DS;
if( !file_exists($tmppath) ) {
JFolder::create( $tmppath, 755 );
};
for( $i = 0; $i < count ( $folders ) - 1; $i ++) {
if (! file_exists ( $tmppath . $folders [$i] ) && ! JFolder::create( $tmppath . $folders [$i], 0755) ) {
return false;
}
$tmppath = $tmppath . $folders [$i] . DS;
}
return true;

/* na więcej nie starczyło limitu znaków :/ */

michal1233
27-02-2010, 20:59
Nie ma problemu z instalacją i działaniem tego modułu. Sprawdź swoją wersję php. Poniżej "5" nie chodzi.


Cytat wyjaśniający sytuację z tematu: http://forum.joomla.pl/showthread.php?37717-Zw%C4%99%C5%BCenie-modu%C5%82u/page2