hallo
Ich möchte einen Parameter Anzahl Einträge pro Seite einbauen so dass eine Nummerierung und Seitengenerierung möglich wird.
Wenn wir von einem einfachen Modul in Joomla ausgehen würden, z.B. dem Modul mod_sections (Bereiche).
dies beinhaltet die default.php
PHP-Code:
<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<ul class="sections<?php echo $params->get('moduleclass_sfx'); ?>"><?php
foreach ($list as $item) :
?>
<li>
<a href="<?php echo JRoute::_(ContentHelperRoute::getSectionRoute($item->id)); ?>">
<?php echo $item->title;?></a>
</li>
<?php endforeach; ?>
</ul>
die mod_sections.php
PHP-Code:
/// no direct access
defined('_JEXEC') or die('Restricted access');
// Include the syndicate functions only once
require_once (dirname(__FILE__).DS.'helper.php');
$list = modSectionsHelper::getList($params);
if (!count($list)) {
return;
}
require(JModuleHelper::getLayoutPath('mod_sections'));
und die helper.php
PHP-Code:
/// no direct access
defined('_JEXEC') or die('Restricted access');
require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
class modSectionsHelper
{
function getList(&$params)
{
global $mainframe;
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$count = intval($params->get('count', 20));
$contentConfig = &JComponentHelper::getParams( 'com_content' );
$access = !$contentConfig->get('show_noauth');
$gid = $user->get('aid', 0);
$now = date('Y-m-d H:i:s', time() + $mainframe->getCfg('offset') * 60 * 60);
$nullDate = $db->getNullDate();
$query = 'SELECT a.id AS id, a.title AS title, COUNT(b.id) as cnt' .
' FROM #__sections as a' .
' LEFT JOIN #__content as b ON a.id = b.sectionid' .
($access ? ' AND b.access <= '.(int) $gid : '') .
' AND ( b.publish_up = '.$db->Quote($nullDate).' OR b.publish_up <= '.$db->Quote($now).' )' .
' AND ( b.publish_down = '.$db->Quote($nullDate).' OR b.publish_down >= '.$db->Quote($now).' )' .
' WHERE a.scope = "content"' .
' AND a.published = 1' .
($access ? ' AND a.access <= '.(int) $gid : '') .
' GROUP BY a.id '.
' HAVING COUNT( b.id ) > 0' .
' ORDER BY a.ordering';
$db->setQuery($query, 0, $count);
$rows = $db->loadObjectList();
return $rows;
}
}
Wie oder wo müsste man denn da ansetzen um die automatische Seitengenerierung zu implementieren wenn wir in der xml den Parameter $anzahl_bereiche_proS für den User zur Definition hätten?
Lesezeichen