We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3914
    • 12 Posts
    I build a plugin with a subscription form. If there are subscribers already they are shown on the same page. For my issue, see this page: http://www.adelaar.org/baanmod/evenementen/form/bos6b2kmvupe0d8mc7t1e9s1b4 and a page which is ok is for example: http://www.adelaar.org/baanmod/evenementen/form/sum6st8nj3li3t920c6t63pano.

    The problem is imho in the number of subscribers. As you can see the first page has a lot more...

    Consider the following code:
    $matchRegSubscribers = $this->modx->getCollection( 'MatchRegistration', $matchRegSubscribers );
    			if( count( $matchRegSubscribers ) > 0 )
    			{
    				foreach( $matchRegSubscribers as $subscriber ) {
    					$aSubscribers = $subscriber->toArray();
    					foreach( $aCats as $key => $val )
    					{
    						if( $aSubscribers['category'] == $key ) { $aSubscribers['category'] = $val; }
    					}
    					$rowsOutput .= $this->getChunk( $this->getProperty( 'subscriber' ), $aSubscribers );
    				}
    			} else {
    				$rowsOutput = $this->modx->lexicon( 'matchplanner.nosubscribers' );
    			}
    			$aOuterTpl = array();
    			$aOuterTpl['subscriberslist'] = $rowsOutput;
    			$content['count'] = count( $matchRegSubscribers );
    			$content['content'] = $this->getChunk( $this->getProperty( 'subscribers' ), $aOuterTpl );
    


    and chunk subscribers.chunk.tpl:
    [[!If?
    	&subject=`[[+eventsubscriberscount]]`
    	&operator=`>`
    	&operand=`0`
    	&then=`<table>
    				<thead>
    					<tr>
    						<th><b>Categorie</b></th>
    						<th><b>Persoon</b></th>
    					</tr>
    				</thead>
    				<tbody>
    					[[+subscriberslist]]
    				</tbody>
    			</table>`
    	&else=`[[+subscriberslist]]`
    ]]
    


    and subscriber.chunk.tpl:
    <tr><td>[[+category]]</td><td>[[+lastName]], [[+firstName]] [[+middleName]] ([[+nationality]])</td></tr>
    


    So what happens? A table with subscribers is build. The problem is in the end of the list. In my second link with a lot of subscribers, the html of the table is not finished. Also, there are more subscribers than you can see in the list. At strlen($rowsOutput) = 7065 the loop is exited.

    When I change the subscriber.chunk.tpl to:
    <tr><td>[[+lastName]]</td></tr>


    I get all results, so it seems $rowsOutput has a maximum length. Is there a limit on a chunk length or am I doing something wrong?
      • 11055 ☆ A M B ☆
      • 3,112 Posts
      You better consider to use an AJAX table, which has pagination or infinite scroll.
      Outputing all of huge data in one shot is really not efficient.
      I'm not suggesting ExtJs because its license.
      Try Dojo ( http://dojofoundation.org/packages/dgrid/ or http://oria.github.io/gridx/ )
        Rico
        Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
        MODx is great, but knowing how to use it well makes it perfect!

        www.virtudraft.com

        Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

        Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

        Maintainter/contributor of Babel

        Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.