4
votes

I have custom library and need to set limit start for list view records from this library.

Code is as follows:

$limitStart = $input->json->get('limit_start');
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
$model->setState("list.limit", $limitStart);

I did this but it's set default value to zero. Can we override the limit start in joomla.

Thanks in advance.

3

3 Answers

1
votes

I think you need to use following method to set the limitstart

$limitStart = 5;
$app = JFactory::getApplication();
$app->setUserState($this->context . '.limitstart', $limitStart);
0
votes
Yes Can override the limitstart for your own library joomla framework 
please flow this way

Open =>joomlaFile/configuration.php/for this code line no "7" default set 20
public $list_limit = '20' Can you change to your Own PageLimit public $list_limit = '5'

//simply read this

$config = JFactory::getConfig();
$limitStart = $config->get('list_limit');
0
votes

you need system plugin to do this. see example for native tags component (the condition is needed to avoid rune code on wrong place )

    public function onAfterRoute()
{
    $app  = JFactory::getApplication();
    if ($app->input->getRaw('option') == 'com_tags' && $app->input->getRaw('view') == 'tag') {
    $app->set('list_limit', 12);
    }
}