Show single menu levels

The 'normal' mod_datemenu menus show a hierarchical structure of categories based on the settings of he component joomla menu

This layout shows just a single level, for example just 'menu level 3'. This layout can be usefull to show the list of feeds/merchants (See 'AANBIEDERS REIZEN'). Or a list of gender (voor wie)

<?php // no direct access
#
# Copyright brambring.nl
# http://www.affiliatefeeds.nl
Dit e-mailadres is beschermd tegen spambots. U heeft Javascript nodig om het te kunnen zien.
#
defined'_JEXEC' ) or die( 'Restricted access' ); ?>
<?php 
function Datasinglelevel_customMenu(&$dataitems,&$params) {
$moduleclass_sfx=$params->get('moduleclass_sfx');
?>
<div class="module<?php echo $moduleclass_sfx;?>">
<div class="mod_datamenu <?php echo $custom_layout;?>">
<?php 
$dataitems
=&singlelevel_customList($params);
$baselink=$params->get('baselink');
    print 
'<div class="menu'.$params->get('moduleclass_sfx').'">';
    
$select $params->get"levels");
    
# als het er is is het ook een array
          
print '<ul>';
    foreach (
$dataitems as $i ) {
    if ( 
$i['m'] ) {
    print 
'<li>'.
         
make_link($baselink,"q$select",$i['m']).' ('.$i['c'].')'.  
         
'</li>';
    }
    }
          print 
'</ul>';
          print 
'</div>';


?>
</div></div>
<?php 
}

function 
singlelevel_customList( &$params )
    {
        
$db =& JFactory::getDBO();
        
$dataitems=array();
    
$levels $params->get"levels");
        
$alias  $params->get'alias''' );
        
$limit  $params->get'list_count'10 );
        
$limitstart=0;
        
$sort $params->get"list_sort");
        
$volg $params->get"list_volg");
        
$field0 $params->get"field0""Select0" );
        
$groep  $params->get'groep''' );
        
$mod_field0 $params->get"mod_field0""Select0" );
        
$mod_groep  $params->get'mod_groep''' );
        
$field0_2 $params->get"field0_2""" );
        
$groep_2  $params->get'groep_2''' );
        
$sequence$params->get'price_sequence'
                                      
'-100,500-250,2000-1000' );

        
$where_a[]=make_group_select($field0,$groep);
        if ( 
$field0_2 and $groep_2) {
                  
$where_a[]=make_group_select($mod_field0,$mod_groep
                         );
        }
        if ( 
$mod_field0 and $mod_groep) {
                  
$where_a[]=make_group_select($mod_field0,$mod_groep
                         );
        }
        
$v=$levels;
         ${
"select$v"}= $params->get"q$v"'' );
            
$f=$params->get"field$v""Select$v);
            if ( 
$f == 'Prijs' )  {
            if ( 
strlen(${"select$v"} ) >) {
                  list(${
"field$v"},${"select$v"}) = 
                      
where_price($f,${"select$v"},$sequence);
            } else {
                ${
"field$v"}=$f;
            }
            } else {
                 ${
"field$v"}=$f;
                 if ( 
strlen(${"select$v"} ) >) {
                    if (  ${
"field$v"} != 'Empty' ) {
                    }
                 }
             }
        
$where=join(" and ",$where_a);
    
$query'SELECT '.${"field$v"}.' as m,count(*) as c FROM 
           #__dataitems WHERE '
.
         
$where ' GROUP BY '.${"field$v"}.' ORDER BY m';
        
$db->setQuery$query$limitstart,$limit);
        
$dis=$db-> loadAssocList ();
    
        return 
$dis;
    }



Usage

Put the file as singlelevel_custom.php in modules/mod_datamenu/tmpl, and create a add a module mod_datamenu usuing this layout. In the field levels enter the desired 'menu level' from the components configuration. So if you placed the merchant/feed in 'menu level 8' enter 8.

The levels do not refer to the 'Selectx' fields in the feeds configuration. A field must be in components menu configuration

 

Plaats reactie


Beveiligingscode
Vernieuwen

Doneer

Donate $10, $20 or $50! This plugin has cost me countless hours of work, if you use it, please donate a token of your appreciation!