- Posts: 1421
- Thank you received: 234
Settings the number of items shown [1578]
11 years 9 months ago - 11 years 9 months ago #964
by redactie
Settings the number of items shown [1578] was created by redactie
from version 1578 you can add the number of items shown to the url
demos.affiliatefeeds.nl/shop/vakantie.html?num=2
there is a hard coded limit of 100 items, this to avoid f*ck ups
code example:
to get the actual count of items available this code must be in a components layout. You can use the code in a module: remove the two marked lines, however the form might display num options larger then the number of items available.
demos.affiliatefeeds.nl/shop/vakantie.html?num=2
there is a hard coded limit of 100 items, this to avoid f*ck ups
code example:
Code:
echo '<form class="numbar">';
$n=JRequest::GetInt("num",'','' );
$this_page=JURI::current();
$num=array(5,10,20,30);
@$count=$this->where['count']; #works only in component !
$options='';
foreach ( $num as $v ) {
if ( $v > $count ) continue ;#works only in component !
if ( $v == $n ) {
$selected='selected';
} else {
$selected='';
}
$options .= '<option value='.$v.' '.$selected.'>'.$v.'</option>';
}
if ( $options ) { # this avoids displa of empty form
print '<select onchange="this.form.submit();" name="num">';
print '<option value="clear"></option>';
print $options;
echo '</select>';
echo '</form>';
}
to get the actual count of items available this code must be in a components layout. You can use the code in a module: remove the two marked lines, however the form might display num options larger then the number of items available.
Last edit: 11 years 9 months ago by redactie.
Please Log in to join the conversation.
Time to create page: 0.468 seconds