Skip to main content

Settings the number of items shown [1578]

More
11 years 9 months ago - 11 years 9 months ago #964 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:
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