Jump to content

Pagination in profile - Unexpected token < in JSON


aXenDev
 Share

Recommended Posts

Hi,
I have a problem with pagination in user profiles (Tabs).

I create an application:

  1. I'll add a Profile named ProfileClassname.php in Extensions
    image.png.85241e3ca7d4f1a606bd657b12a89c20.png
  2. Its contents have not been changed, except for the render function to:
    	/**
    	 * Display
    	 *
    	 * @return	string
    	 */
    	public function render()
    	{
    		$table = new \IPS\Helpers\Table\Content('IPS\testpagination\TestPagination', $this->member->url()->setQueryString(array('tab' => 'node_testpagination_Profile')));
    		$table->rowsTemplate = array(\IPS\Theme::i()->getTemplate('profile', 'testpagination', 'front'), 'testpaginationRow');
    		$table->limit = 2;
    		$table->noModerate = TRUE;
    
    		return (string) $table;
    	}

     

  3. I have created a testpaginationRow.phtml file with the contents:
    <ips:template parameters="$table, $headers, $rows" />
    {{foreach $rows as $row}}
    test
    {{endforeach}}
  4. IPS\testpagination\TestPagination class content:
    <?php
    
    namespace IPS\testpagination;
    
    /* To prevent PHP errors (extending class does not exist) revealing path */
    
    if (!\defined('\IPS\SUITE_UNIQUE_KEY')) {
      header((isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0') . ' 403 Forbidden');
      exit;
    }
    
    class _TestPagination extends \IPS\Content\Item
    {
      /**
       * @brief	Database Table
       */
      public static $databaseTable = 'testpagination_members';
    
      /**
       * @brief	Application
       */
      public static $application = 'testpagination';
    
      /**
       * @brief	Database Prefix
       */
      public static $databasePrefix = 'testpagination_';
    
      /**
       * @brief	Database Column Map
       */
      public static $databaseColumnMap = array(
        'date'      => 'date'
      );
    }

     

The effect is what I wanted:

image.thumb.png.91ef3256b9f063806dac08be4c35f807.png

But when I change the page, nothing happens and console in the browser shows me an error:

Ajax request failed (parsererror): SyntaxError: Unexpected token < in JSON at position 0

image.png.56332a561912249408db36ecc79a5060.png

 

Here is test application:
test pagination 1.0.0 (1).tar

dev.zip

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...