سلام دوستان
ماژول پارسا گلوبال نیوز 2.5 یکی از دوستان(آقای تهرانی ) قبلا برایم تغییراتی داده بود و سفارشی کرده بودن . این ماژول به صورت پیش فرض عکس در متن مقدمه خبر را در صفحه اصلی نمایش می دهد. که با تغییر که داده بودیم عکس را از فیلد تصویر مقدمه می آورد و نمایش میدهد
همین mod vtem slides حالا می خواهم برای همین ماژول اسلایدر
تغییر را بدهم و عکس تصویر متن مقدمه را نمایش دهد
خیلی لطف بزرگی می کنید اگر برایم اصلاحش کنید..
است که می خواهم اصلاح شودmod vtem slides مربوط به helper.php این فایل
<?php
/**
* @Copyright Copyright (C) 2010 VTEM . All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
* @link http://www.vtem.net
**/
// no direct access
defined('_JEXEC') or die;
jimport('joomla.application.component.model');
$com_path = JPATH_SITE.DS.'components'.DS.'com_content';
require_once $com_path.DS.'router.php';
require_once $com_path.DS.'helpers'.DS.'route.php';
jimport('joomla.application.component.model');
JModel::addIncludePath($com_path.DS.'models');
abstract class modVtemSlidesHelper
{
public static function getList(&$params)
{
// Get an instance of the generic articles model
$articles = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
// Set application parameters in model
$app = JFactory::getApplication();
$appParams = $app->getParams();
$articles->setState('params', $appParams);
// Set the filters based on the module params
$articles->setState('list.start', 0);
$articles->setState('list.limit', (int) $params->get('count', 0));
$articles->setState('filter.published', 1);
// Access filter
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$articles->setState('filter.access', $access);
// Prep for Normal or Dynamic Modes
$mode = $params->get('mode', 'normal');
switch ($mode)
{
case 'dynamic':
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
if ($option === 'com_content') {
switch($view)
{
case 'category':
$catids = array(JRequest::getInt('id'));
break;
case 'categories':
$catids = array(JRequest::getInt('id'));
break;
case 'article':
if ($params->get('show_on_article_page', 1)) {
$article_id = JRequest::getInt('id');
$catid = JRequest::getInt('catid');
if (!$catid) {
// Get an instance of the generic article model
$article = JModel::getInstance('Article', 'ContentModel', array('ignore_request' => true));
$article->setState('params', $appParams);
$article->setState('filter.published', 1);
$article->setState('article.id', (int) $article_id);
$item = $article->getItem();
$catids = array($item->catid);
}
else {
$catids = array($catid);
}
}
else {
// Return right away if show_on_article_page option is off
return;
}
break;
case 'featured':
default:
// Return right away if not on the category or article views
return;
}
}
else {
// Return right away if not on a com_content page
return;
}
break;
case 'normal':
default:
$catids = $params->get('catid');
$articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1));
break;
}
// Category filter
if ($catids) {
if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) {
// Get an instance of the generic categories model
$categories = JModel::getInstance('Categories', 'ContentModel', array('ignore_request' => true));
$categories->setState('params', $appParams);
$levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999;
$categories->setState('filter.get_children', $levels);
$categories->setState('filter.published', 1);
$categories->setState('filter.access', $access);
$additional_catids = array();
foreach($catids as $catid)
{
$categories->setState('filter.parentId', $catid);
$recursive = true;
$items = $categories->getItems($recursive);
foreach($items as $category)
{
$condition = (($category->level - $categories->getParent()->level) <= $levels);
if ($condition) {
$additional_catids[] = $category->id;
}
}
}
$catids = array_unique(array_merge($catids, $additional_catids));
}
$articles->setState('filter.category_id', $catids);
}
// Ordering
$articles->setState('list.ordering', $params->get('article_ordering', 'a.ordering'));
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
// New Parameters
$articles->setState('filter.featured', $params->get('show_front', 'show'));
$articles->setState('filter.author_id', $params->get('created_by', ""));
$articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1));
$articles->setState('filter.author_alias', $params->get('created_by_alias', ""));
$articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1));
$excluded_articles = $params->get('excluded_articles', '');
$articleID_filtering = $params->get('articleID_filtering', 1);
if ($excluded_articles) {
$excluded_articles = explode("\r\n", $excluded_articles);
$articles->setState('filter.article_id', $excluded_articles);
if($articleID_filtering == 1){
$articles->setState('filter.article_id.include', false); // Exclude
}else{
$articles->setState('filter.article_id.include', true); // Include
}
}
$date_filtering = $params->get('date_filtering', 'off');
if ($date_filtering !== 'off') {
$articles->setState('filter.date_filtering', $date_filtering);
$articles->setState('filter.date_field', $params->get('date_field', 'a.created'));
$articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00'));
$articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59'));
$articles->setState('filter.relative_date', $params->get('relative_date', 30));
}
// Filter by language
$articles->setState('filter.language',$app->getLanguageFilter());
$items = $articles->getItems();
// Display options
$show_date = $params->get('show_date', 0);
$show_date_field = $params->get('show_date_field', 'created');
$show_date_format = $params->get('show_date_format', 'Y-m-d H:i:s');
$show_category = $params->get('show_category', 0);
$show_hits = $params->get('show_hits', 0);
$show_author = $params->get('show_author', 0);
$show_introtext = $params->get('show_introtext', 0);
$introtext_limit = $params->get('introtext_limit', 100);
// Find current Article ID if on an article page
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
if ($option === 'com_content' && $view === 'article') {
$active_article_id = JRequest::getInt('id');
}
else {
$active_article_id = 0;
}
// Prepare data for display using display options
foreach ($items as &$item)
{
$item->slug = $item->id.':'.$item->alias;
$item->catslug = $item->catid ? $item->catid .':'.$item->category_alias : $item->catid;
if ($access || in_array($item->access, $authorised)) {
// We know that user has the privilege to view the article
$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
}
else {
// Angie Fixed Routing
$app = JFactory::getApplication();
$menu = $app->getMenu();
$menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login');
if(isset($menuitems[0])) {
$Itemid = $menuitems[0]->id;
} else if (JRequest::getInt('Itemid') > 0) { //use Itemid from requesting page only if there is no existing menu
$Itemid = JRequest::getInt('Itemid');
}
$item->link = JRoute::_('index.php?option=com_users&view=login&Itemid='.$Itemid);
}
// Used for styling the active article
$item->active = $item->id == $active_article_id ? 'active' : '';
$item->displayDate = '';
if ($show_date) {
$date = new JDate($item->$show_date_field);
$item->displayDate= $date->format($show_date_format);
}
if ($item->catid) {
$item->displayCategoryLink = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid));
$item->displayCategoryTitle = $show_category ? '<a href="'.$item->displayCategoryLink.'">'.$item->category_title.'</a>' : '';
}
else {
$item->displayCategoryTitle = $show_category ? $item->category_title : '';
}
$item->displayHits = $show_hits ? $item->hits : '';
$item->displayAuthorName = $show_author ? $item->author : '';
$item->introtext = JHtml::_('content.prepare', $item->introtext);
$imgSPos = JString::strpos($item->introtext,'src="');
if($imgSPos)
{
$imgEPos = JString::strpos($item->introtext,'"',$imgSPos+5);
}
if($imgSPos > 0)
{
$item->displayImage = JString::substr($item->introtext, ($imgSPos+5), ($imgEPos-($imgSPos+5)));
}
if($params->get('clean_xhtml') == 1){
$item->introtext = self::_cleanIntrotext($item->introtext);
}
$item->introtext = preg_replace( '/<img[^>]*>/', '', $item->introtext );
if($params->get('introtext_limit') == 0){
$item->displayIntrotext = $item->introtext;
}else{
$item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit) : '';
}
$item->displayReadmore = $item->alternative_readmore;
}
return $items;
}
public static function _cleanIntrotext($introtext)
{
$introtext = str_replace('<p>', ' ', $introtext);
$introtext = str_replace('</p>', ' ', $introtext);
$introtext = strip_tags($introtext, '');
$introtext = trim($introtext);
return $introtext;
}
/**
* This is a better truncate implementation than what we
* currently have available in the library. In particular,
* on index.php/Banners/Banners/site-map.html JHtml's truncate
* method would only return "Article...". This implementation
* was taken directly from the Stack Overflow thread referenced
* below. It was then modified to return a string rather than
* print out the output and made to use the relevant JString
* methods.
*
* @link http://stackoverflow.com/questions/1193500/php-truncate-html-ignoring-tags
* @param mixed $html
* @param mixed $maxLength
*/
public static function truncate($html, $maxLength = 0)
{
$printedLength = 0;
$position = 0;
$tags = array();
$output = '';
if (empty($html)) {
return $output;
}
while ($printedLength < $maxLength && preg_match('{</?([a-z]+)[^>]*>|?[a-zA-Z0-9]+;}', $html, $match, PREG_OFFSET_CAPTURE, $position))
{
list($tag, $tagPosition) = $match[0];
// Print text leading up to the tag.
$str = JString::substr($html, $position, $tagPosition - $position);
if ($printedLength + JString::strlen($str) > $maxLength) {
$output .= JString::substr($str, 0, $maxLength - $printedLength);
$printedLength = $maxLength;
break;
}
$output .= $str;
$lastCharacterIsOpenBracket = (JString::substr($output, -1, 1) === '<');
if ($lastCharacterIsOpenBracket) {
$output = JString::substr($output, 0, JString::strlen($output) - 1);
}
$printedLength += JString::strlen($str);
if ($tag[0] == '&') {
// Handle the entity.
$output .= $tag;
$printedLength++;
}
else {
// Handle the tag.
$tagName = $match[1][0];
if ($tag[1] == '/') {
// This is a closing tag.
$openingTag = array_pop($tags);
$output .= $tag;
}
else if ($tag[JString::strlen($tag) - 2] == '/') {
// Self-closing tag.
$output .= $tag;
}
else {
// Opening tag.
$output .= $tag;
$tags[] = $tagName;
}
}
// Continue after the tag.
if ($lastCharacterIsOpenBracket) {
$position = ($tagPosition - 1) + JString::strlen($tag);
}
else {
$position = $tagPosition + JString::strlen($tag);
}
}
// Print any remaining text.
if ($printedLength < $maxLength && $position < JString::strlen($html)) {
$output .= JString::substr($html, $position, $maxLength - $printedLength);
}
// Close any open tags.
while (!empty($tags))
{
$output .= sprintf('</%s>', array_pop($tags));
}
$length = JString::strlen($output);
$lastChar = JString::substr($output, ($length - 1), 1);
$characterNumber = ord($lastChar);
if ($characterNumber === 194) {
$output = JString::substr($output, 0, JString::strlen($output) - 1);
}
$output = JString::rtrim($output);
return $output.'…';
}
}
این هم فایل
helper.php
پارسا گلوبال نیوز 2.5 که با تغییر که داده بودیم عکس را از فیلد تصویر متن مقدمه می آورد و نمایش میدهد
<?php
/*------------------------------------------------------------------------
# mod_globalnews - Global News Module
# ------------------------------------------------------------------------
# author Joomla!Vargas
# copyright Copyright (C) 2010 joomla.vargas.co.cr. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://joomla.vargas.co.cr
# Technical Support: Forum - http://joomla.vargas.co.cr/forum
-------------------------------------------------------------------------*/
// no direct access
defined('_JEXEC') or die;
require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
jimport('joomla.application.component.model');
JModel::addIncludePath(JPATH_SITE.'/components/com_content/models', 'ContentModel');
abstract class modGlobalNewsHelper {
public static function getGN_Img( &$params, $link, $img, $pfx ) {
$align = $params->get( $pfx.'_img_align', 'left' );
$margin = $params->get( $pfx.'_img_margin', '3px' );
$width = (int)$params->get( $pfx.'_img_width', '' );
$height = (int)$params->get( $pfx.'_img_height', '' );
$border = $params->get( $pfx.'_img_border', '0' );
if ( $align == 'left' ) :
$style = 'float:left;';
if ( $pfx == 'cat' ) {
$style .= 'margin-right:' . $margin . ';';
} else {
$style .= 'margin:' . $margin . ';';
}
endif;
if ( $align == 'right' ) :
$style = 'float:right;';
if ( $pfx == 'cat' ) {
$style .= 'margin-left:' . $margin . ';';
} else {
$style .= 'margin:' . $margin . ';';
}
endif;
$style .= 'border:' . $border . ';';
$attribs = array ('style' => $style);
if ( $height )
$attribs = array('height' => $height, $attribs);
if ( $width )
$attribs = array('width' => $width, $attribs );
$image = JHTML::_('image', $img, JText::_('IMAGE'), $attribs );
if ( $link )
$image = JHTML::_('link', $link, $image);
if ( $align = 'center')
$image = '<center>' . $image . '</center>';
return $image;
}
public static function getGN_Cats(&$params)
{
$db = JFactory::getDBO();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$catid = $params->get('catid', '');
$curcat = $params->get('curcat', 0);
$current = $params->get('current', 1);
$show_cat = $params->get('show_cat', 1);
$cat_title = $params->get('cat_title', 1);
$cat_img = $params->get( 'cat_img_align', 0);
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$group_id = $condition = '';
switch ($params->get( 'cat_order', 1))
{
case '0':
$ordering = 'rand()';
break;
case '1':
$ordering = 'c.id ASC';
break;
case '2':
$ordering = 'c.title ASC';
break;
case '3':
default:
$ordering = 'c.lft ASC';
break;
}
if ( $curcat == 1 || $current != 1 ) :
if ( JRequest::getCmd('option') == 'com_content' ) {
$view = JRequest::getCmd('view');
$temp = JRequest::getString('id');
$temp = explode(':', $temp);
$id = $temp[0];
}
endif;
$catids = $params->get('catid');
JArrayHelper::toInteger($catids);
$catids = implode(',', $catids);
if (!empty($catids)) {
$condition .= ' AND c.id IN ('.$catids.')';
}
$query = 'SELECT c.*, ' .
' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as slug' .
' FROM #__categories AS c' .
' WHERE c.published = 1 AND c.extension = "com_content"' .
($access ? ' AND c.access IN ('.$groups.')' : '').
($condition!='' ? $condition : '').
' ORDER BY '. $ordering;
$db->setQuery($query);
$cats = $db->loadObjectList();
foreach ( $cats as &$cat ) {
$cat->link = JRoute::_(ContentHelperRoute::getCategoryRoute( $cat->slug ));
$cat->cond = $cat->id;
$cat->image = '';
if ( $cat_img ) {
$catParams = new JRegistry;
$catParams->loadString($cat->params);
if ( $image = $catParams->get('image')) {
$cat->image .= modGlobalNewsHelper::getGN_Img( $params, $cat->link, $image, 'cat' );
}
}
if ( $group_id == $cat->id && $curcat == 1 ) {
$cat->link = '';
}
if ( $cat_title != 0 ) {
$tags = array(array('',''),array('',''),array('<strong>','</strong>'),array('<u>','</u>'),array('<strong><u>','</u></strong>'),array('<h1>','</h1>'),array('<h2>','</h2>'),array('<h3>','</h3>'),array('<h4>','</h4>'),array('<h5>','</h5>'),array('<h6>','</h6>'));
if ( $show_cat == 2 ) {
$cat->title = $tags[$cat_title][0] . $cat->title . $tags[$cat_title][1];
} else {
$cat->title = ( $cat_title > 4 ? $tags[$cat_title][0] : '' ) . ( $cat->link ? '<a target="_blank" href="' . $cat->link. '">' : '' ) . ( $cat_title < 5 ? $tags[$cat_title][0] : '' ) . $cat->title . ( $cat_title < 5 ? $tags[$cat_title][1] : '' ) . ( $cat->link ? '</a>' : '' ) . ( $cat_title > 4 ? $tags[$cat_title][1] : '' );
}
} else {
$cat->title = '';
}
}
return $cats;
}
public static function getGN_List(&$params,$catid)
{
$db = JFactory::getDBO();
$user = JFactory::getUser();
$userId = (int) $user->get('id');
$groups = implode(',', $user->getAuthorisedViewLevels());
$count = trim( $params->get('count', 5) );
$current = trim( $params->get('current', 1) );
$layout = $params->get('layout', 'list');
$html = $params->get('html');
$show_front = $params->get('show_front', 1);
$aid = $user->get('aid', 0);
$limittitle = $params->get('limittitle', '');
$nullDate = $db->getNullDate();
jimport('joomla.utilities.date');
$date = new JDate();
$now = $date->toMySQL();
$article_id = 0;
if ($current != 1 && JRequest::getCmd('option') === 'com_content' && JRequest::getCmd('view') === 'article') {
$article_id = JRequest::getInt('id');
}
$articles = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
$app = JFactory::getApplication();
$appParams = $app->getParams();
$articles->setState('params', $appParams);
$articles->setState('list.start', 0);
$articles->setState('list.limit', (int) $params->get('count', 5));
$articles->setState('filter.published', 1);
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$articles->setState('filter.access', $access);
if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) {
$categories = JModel::getInstance('Categories', 'ContentModel', array('ignore_request' => true));
$categories->setState('params', $appParams);
$levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999;
$categories->setState('filter.get_children', $levels);
$categories->setState('filter.published', 1);
$categories->setState('filter.access', $access);
$additional_catids = array();
$categories->setState('filter.parentId', $catid);
$recursive = true;
$items = $categories->getItems($recursive);
if ($items)
{
foreach($items as $category)
{
$condition = (($category->level - $categories->getParent()->level) <= $levels);
if ($condition) {
$additional_catids[] = $category->id;
}
}
}
$catid = array_unique(array_merge(array($catid), $additional_catids));
}
$articles->setState('filter.category_id', $catid);
$articles->setState('list.ordering', $params->get('article_ordering', 'a.ordering'));
if ($params->get('article_ordering') != 'rand()') {
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
} else {
$articles->setState('list.direction', '');
}
$articles->setState('filter.featured', $params->get('show_front', 'show'));
$articles->setState('filter.author_id', $params->get('created_by', ""));
$articles->setState('filter.author_id.include', 1);
if ( $article_id && $current == 0 )
{
$articles->setState('filter.article_id', $article_id);
$articles->setState('filter.article_id.include', false); // Exclude
}
$rows = $articles->getItems();
foreach ( $rows as &$row ) {
if ( $article_id == $row->id && $current == 2 ) {
$link = '';
} else {
$row->slug = $row->id.':'.$row->alias;
$row->catslug = $row->catid ? $row->catid .':'.$row->category_alias : $row->catid;
$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug));
}
if ( $limittitle && strlen( $row->title ) > $limittitle ) {
$row->title = $row->rotitr . substr( $row->title, 0, $limittitle ). '...';
}
if ( $link ) {
$row->title = '<a href="'.$link.'" target="_blank" >'.'<span class="rt2">' . $row->rotitr . '</span>' . '<br/>' .htmlspecialchars( $row->title ).'</a>';
} else {
$row->title = '<span class="r2t">' . $row->rotitr . '</span>' . '<br/>' . htmlspecialchars( $row->title );
}
if ( $layout != 'list' ) :
$gn_image = '';
$gn_title = '';
$gn_created = '';
$gn_author = '';
$gn_text = '';
$gn_readmore = '';
$gn_comments = '';
if ( preg_match("/GN_title/", $html) ) {
$gn_title = $row->title;
$gn_title = preg_replace('/\$/','$-',$gn_title);
}
if ( preg_match("/GN_date/", $html) ) {
$gn_created = JHTML::_('date', ($params->get( 'date' ) == 'created' ? $row->created : $row->modified ), $params->get('date_format', '' ) );
}
if ( preg_match("/GN_author/", $html) ) {
$author = $params->get( 'author' );
if ( $author != 'alias' ) {
$query = "SELECT " . $author . " FROM #__users WHERE id = " . $row->created_by;
$db->setQuery($query);
$gn_author = $db->loadResult();
} else {
$gn_author = $row->created_by_alias;
}
}
if ( preg_match("/GN_image/", $html) ) {
$images = json_decode($row->images);
if (isset($images->image_intro) and !empty($images->image_intro)) :
$gn_image = modGlobalNewsHelper::getGN_Img ( $params, $link, $images->image_intro, 'item' );
elseif (isset($images->image_fulltext) and !empty($images->image_fulltext)) :
$gn_image = modGlobalNewsHelper::getGN_Img ( $params, $link, $images->image_fulltext, 'item' );
else :
$regex = "/<img[^>]+src\s*=\s*[\"']\/?([^\"']+)[\"'][^>]*\>/";
$search = $row->introtext;
preg_match ($regex, $search, $matches);
$images = (count($matches)) ? $matches : array();
if ( count($images) ) {
$gn_image = modGlobalNewsHelper::getGN_Img ( $params, $link, $images[1], 'item' );
}
endif;
}
if ( preg_match("/GN_text/", $html) ) {
$limit = trim( $params->get('limittext', '150') );
$gn_text = $row->introtext;
if ( $params->get('striptext', '1'))
$gn_text = trim( strip_tags( $gn_text, $params->get('allowedtags', '') ) );
$pattern = array("/[\n\t\r]+/",'/{(\w+)[^}]*}.*{\/\1}|{(\w+)[^}]*}/Us', '/\$/');
$replace = array(' ', '', '$-');
$gn_text = preg_replace( $pattern, $replace, $gn_text );
if ( $limit && strlen( $gn_text ) > $limit ) {
$gn_text = substr( $gn_text, 0, $limit );
$space = strrpos( $gn_text, ' ' );
$gn_text = substr( $gn_text, 0, $space ). '...';
}
}
if ( preg_match("/GN_readmore/", $html) && $link ) {
$gn_readmore = JHTML::_('link', $link, JText::_('MOD_GLOBALNEWS_READ_MORE_TITLE'));
}
$code = array("/GN_image/", "/GN_title/", "/GN_date/", "/GN_author/", "/GN_text/", "/GN_readmore/", "/GN_comments/","/GN_break/","/GN_space/","/GN_hits_label/","/GN_hits_value/");
$rplc = array( $gn_image, $gn_title, $gn_created, $gn_author, $gn_text, $gn_readmore, $gn_comments, "<br />", " ", JText::_('MOD_GLOBALNEWS_HITS_LABEL'), $row->hits);
$row->content = preg_replace($code, $rplc, $html);
$row->content = preg_replace('/\$-/','$',$row->content);
endif;
}
return $rows;
}
public static function addGN_CSS(&$params, $layout, $globalnews_id, $total) {
$doc = JFactory::getDocument();
$layout = $params->get( 'layout', 'list' );
$padding = (int)$params->get('padding', '5px');
$border = $params->get('border', '1px solid #EFEFEF');
$color = $params->get('color', '#FFFFFF');
$show_cat = $params->get('show_cat', '1');
$css = '';
if ( $globalnews_id == 1 ) :
$css .= ".gn_clear { clear:both; height:0; line-height:0; }\n";
endif;
$header = '.gn_header_' . $globalnews_id . ' {'
.' background-color:' . $params->get('header_color', '#EFEFEF') . ';'
.' border:' . $border . ';'
.' border-bottom:none;'
.' padding:' . (int)$params->get('header_padding', '5px') . 'px;'
.' }';
$marquee = ' border:' . $border . ';'
. ( $show_cat != 0 ? ' border-top:none;' : '' )
.' padding:' . $padding . 'px;'
.' height:' . $params->get('height', '100px') . ';'
.' background-color:' . $color . ';'
.' overflow:hidden;';
switch ( $layout ) {
case 'list' :
$css .= $header . "\n"
.".gn_list_" . $globalnews_id . " {"
. $marquee
." }";
break;
case 'static' :
$css .= $header . "\n"
.".gn_static_" . $globalnews_id . " {"
. $marquee
." }";
break;
case 'slider' :
$css .= $header . "\n"
.".gn_slider_" . $globalnews_id . " {"
. $marquee
." border-bottom:none;"
." }" . "\n"
.".gn_slider_" . $globalnews_id . " .gn_opacitylayer {"
." height:100%;"
." filter:progid:DXImageTransform.Microsoft.alpha(opacity=100);"
." -moz-opacity:1;"
." opacity:1;"
." }" . "\n"
.".gn_pagination_" . $globalnews_id . " {"
." border:" . $border . ";"
." border-top:none;"
." padding:2px " . $padding . "px;"
." text-align:right;"
." background-color:" . $color . ";"
." }" . "\n"
.".gn_pagination_" . $globalnews_id . " a:link {"
." font-weight:bold;"
." padding:0 2px;"
." }" . "\n"
.".gn_pagination_" . $globalnews_id . " a:hover, .gn_pagination_" . $globalnews_id . " a.selected {"
." color:#000;"
." }";
break;
case 'browser' :
$containerIds = array();
for ($m=0;$m<$total;$m++) {
$containerIds[$m] = '#gn_container_' . $globalnews_id . '_' . ($m+1); }
$css .= $header . "\n"
. implode(',' , $containerIds) . " {"
. $marquee
." position: relative;"
." }";
break;
case 'scroller' :
$scrollerIds = array();
for ($m=0;$m<$total;$m++) {
$scrollerIds[$m] = '#gn_scroller_' . $globalnews_id . '_' . ($m+1); }
$css .= $header . "\n"
. implode(',' , $scrollerIds) . " {"
. $marquee
." }";
break;
}
return $doc->addStyleDeclaration($css);
}
}