0

I read and understand that getUserStateFromRequest stores information in session.

The session storage is causing an issue on site Is there an alternate way by which i can avoid in session storage on pagination pages

Below is code in model/list.php

protected function populateState($ordering = null, $direction = null)
{
    // Initialise variables.
    $app = JFactory::getApplication();

    // List state information
    $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'));
    $this->setState('list.limit', $limit);

    $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0);
    $this->setState('list.start', $limitstart);

    if ($list = $app->getUserStateFromRequest($this->context . '.list', 'list', array(), 'array'))
    {
    {
        foreach ($list as $name => $value)
        {
            // Extra validations
            switch ($name)
            {
                case 'fullordering':
                    $orderingParts = explode(' ', $value);

                    if (count($orderingParts) >= 2)
                    {
                        // Latest part will be considered the direction
                        $fullDirection = end($orderingParts);

                        if (in_array(strtoupper($fullDirection), array('ASC', 'DESC', '')))
                        {
                            $this->setState('list.direction', $fullDirection);
                        }

                        unset($orderingParts[count($orderingParts) - 1]);

                        // The rest will be the ordering
                        $fullOrdering = implode(' ', $orderingParts);

                        if (in_array($fullOrdering, $this->filter_fields))
                        {
                            $this->setState('list.ordering', $fullOrdering);
                        }
                    }
                    else
                    {
                        $this->setState('list.ordering', $ordering);
                        $this->setState('list.direction', $direction);
                    }
                    break;
1

If you do not want to use session storage, just directly get the values from request.

$limit = $app->input->getInt('limit', $app->get('list_limit'));

Please note that the above answer is based on assumption that the code you mentioned is from your custom component. For core component, you need to either modify the core files (not recommended) or live with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.