Hi zusammen,
es gibt ja dieses erweiterte Joomla-Core Modul für Latest News und zwar mit der Option, den Introtext mit anzeigen zu lassen. Soweit so gut.
Nun meine Frage: Gibt es eine einfache Möglichkeit, dieses Modul mit einem einfachen Code-Zusatz nur für „verwandte Artikel“, sprich mit gleichem META-Schlüsselwort, zu erweitern?
Solltet ihr wissen wollen, warum ich gerade dieses Modul so abgeändert haben möchte, kann ich euch das gerne erläutern. Nur soviel vorweg: Andere Module bzgl. related Items haben mir bisher nicht weitergeholfen...
Hier mal die Codes des Moduls:
helper.php
mod_latestnewswithintro.phpPHP-Code:<?php
/**
* @copyright Copyright (C) 2010 OpenSource Technologies Pvt. Ltd. All rights reserved.
* @license GNU/GPL, see http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
class modLatestNewsWithIntroHelper
{
function getList(&$params)
{
global $mainframe;
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$userId = (int) $user->get('id');
$count = (int) $params->get('count', 5);
$catid = trim( $params->get('catid') );
$category = $params->get('category',0);
$intro_text = $params->get('intro_text',0);
$show_front = $params->get('show_front', 1);
$aid = $user->get('aid', 0);
$contentConfig = &JComponentHelper::getParams( 'com_content' );
$access = !$contentConfig->get('show_noauth');
$nullDate = $db->getNullDate();
$date =& JFactory::getDate();
$now = $date->toMySQL();
$where = 'a.state = 1'
. ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )'
. ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )'
;
// User Filter
switch ($params->get( 'user_id' ))
{
case 'by_me':
$where .= ' AND (created_by = ' . (int) $userId . ' OR modified_by = ' . (int) $userId . ')';
break;
case 'not_me':
$where .= ' AND (created_by <> ' . (int) $userId . ' AND modified_by <> ' . (int) $userId . ')';
break;
}
// Ordering
switch ($params->get( 'ordering' ))
{
case 'm_dsc':
$ordering = 'a.modified DESC, a.created DESC';
break;
case 'c_dsc':
default:
$ordering = 'a.created DESC';
break;
}
if ($catid)
{
$ids = explode( ',', $catid );
JArrayHelper::toInteger( $ids );
$catCondition = ' AND (cc.id=' . implode( ' OR cc.id=', $ids ) . ')';
}
if ($intro_text)
{
$introCondition= '';
}
// Content Items only
$query = 'SELECT a.title as at, introtext as it, cc.title as ct , ' .
' 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'.
' FROM #__content AS a ' .
($show_front == '0' ? ' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' : '') .
' INNER JOIN #__categories AS cc ON cc.id = a.catid' .
' INNER JOIN #__assets AS aa ON aa.id = a.asset_id' .
' WHERE '. $where .
($catid ? $catCondition : '').
($show_front == '0' ? ' AND f.content_id IS NULL ' : '').
' AND cc.published = 1' .
' ORDER BY '. $ordering;
$db->setQuery($query, 0, $count);
$rows = $db->loadObjectList();
$i = 0;
$lists = array();
foreach ( $rows as $row )
{
if($row->access <= $aid)
{
$lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->asset_id));
} else {
$lists[$i]->link = JRoute::_('index.php?option=com_user&view=login');
}
$lists[$i]->text1 = htmlspecialchars( $row->at );
$lists[$i]->text2 = htmlspecialchars( $row->ct );
$lists[$i]->text3 = $row->it;
$i++;
}
return $lists;
}
}
mod_latestnewswithintro.xmlPHP-Code:<?php
/**
* @copyright Copyright (C) 2010 OpenSource Technologies Pvt. Ltd. All rights reserved.
* @license GNU/GPL, see http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// Include the syndicate functions only once
require_once (dirname(__FILE__).DS.'helper.php');
$list = modLatestNewsWithIntroHelper::getList($params);
require(JModuleHelper::getLayoutPath('mod_latestnewswithintro'));
template: default.phpCode:<?xml version="1.0" encoding="utf-8"?> <extension type="module" version="1.7.0" client="site" method="upgrade"> <name>Latest News with Intro</name> <author>OpenSource Technologies</author> <creationDate>Feb 2011</creationDate> <copyright>Copyright (C) 2011 OpenSource Technologies Pvt. Ltd. All rights reserved.</copyright> <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license> <authorEmail>sales@opensourcetechnologies.com</authorEmail> <authorUrl>http://www.opensourcetechnologies.com/</authorUrl> <version>1.7.0</version> <description>This modules displays the Latest News with Intro text, Category Name</description> <files> <filename module="mod_latestnewswithintro">mod_latestnewswithintro.php</filename> <folder>tmpl</folder> <filename>helper.php</filename> <filename>index.html</filename> <filename>mod_latestnewswithintro.xml</filename> <filename>tmpl/default.php</filename> <filename>tmpl/index.html</filename> </files> <config> <fields name="params"> <fieldset name="basic"> <field name="count" type="text" default="5" label="Count" description="The number of items to display (default 5)"> </field> <field name="ordering" type="list" default="create_dsc" label="Ordering" description="Ordering options"> <option value="c_dsc">Recently Added First</option> <option value="m_dsc">Recently Modified First</option> </field> <field name="user_id" type="list" default="0" label="Authors" description="A filter for the authors"> <option value="0">Anyone</option> <option value="by_me">Added or modified by me</option> <option value="not_me">Not added or modified by me</option> </field> <field name="show_front" type="radio" default="1" label="Frontpage Items" description="PARAMFRONTPAGEITEMS"> <option value="1">show</option> <option value="0">hide</option> </field> <field name="catid" type="text" label="Category ID" description="PARAMCATEGORYID"> </field> <field name="category" type="radio" default="0" label="Category Name" description="PARAMINTROTEXT"> <option value="1">show</option> <option value="0">hide</option> </field> <field name="intro_text" type="radio" default="0" label="Intro Text" description="PARAMINTROTEXT"> <option value="1">show</option> <option value="0">hide</option> </field> <field name="@spacer" type="spacer" default="" label="" description=""> </field> </fieldset> <fieldset name="advanced"> <field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL" description="JFIELD_ALT_MODULE_LAYOUT_DESC" /> <field name="moduleclass_sfx" type="text" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" /> <field name="cache" type="list" default="1" label="COM_MODULES_FIELD_CACHING_LABEL" description="COM_MODULES_FIELD_CACHING_DESC"> <option value="1">JGLOBAL_USE_GLOBAL</option> <option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option> </field> <field name="cache_time" type="text" default="900" label="COM_MODULES_FIELD_CACHE_TIME_LABEL" description="COM_MODULES_FIELD_CACHE_TIME_DESC" /> <field name="cachemode" type="hidden" default="static"> <option value="static"></option> </field> </fieldset> </fields> </config> </extension>
Würde mich freuen, wenn es da eine einfache Lösung gibt und ihr mir die verraten könntet.PHP-Code:<?php
/**
* @copyright Copyright (C) 2010 OpenSource Technologies Pvt. Ltd. All rights reserved.
* @license GNU/GPL, see http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<ul class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>">
<?php foreach ($list as $item) : ?>
<li class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>">
<a href="<?php echo $item->link; ?>" class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>">
<?php
if ( $params->get('category')==1)
echo '<i>'.$item->text2.'</i>';
if ( $params->get('intro_text')==1)
echo '<br/>'.$item->text3;
?>
</a>
</li>
<?php endforeach; ?>
</ul>![]()


LinkBack URL
About LinkBacks
Zitieren
Lesezeichen