We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19164
    • 1,215 Posts
    I have disable PHx and splitPagination is beginning to work. It seems that when PHx is on, snippet can’t to get placeholders values with getPlaceholder() function. Array $modx->placeholders in that case has only one item $modx->placeholders[’phx’] = "&_PHX_INTERNAL_&"
      DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

      Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

      [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
      • 6726
      • 7,075 Posts
      Could something like pixelchute’s workaround for eForm w/PHx help in this case ?

        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 19164
        • 1,215 Posts
        I thinks that it is not that we need. Placeholders array in SplitPagination is only a way to take some variables from ditto (like numbers of documents, docs per page and so on).
          DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

          Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

          [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
          • 19164
          • 1,215 Posts
          Here is a PHx modificator to make a Ditto pagination (as davidm wish smiley ). Useful if you are useing PHx on your site.

          This modificator is using a very big part of SplitPagination snippet code.

          Create file in assets\plugins\phx\modifiers with the name dittopages.phx.php and copy code
          <?php
          
          list($id, $total, $summarize) = explode(",", str_replace(" ","", $options));
          
          if (!function_exists("generatePagination")) {
          	function generatePagination($curPage, $totResults, $resultsPerPage)
          	{
          		$totPages = ceil($totResults / $resultsPerPage);
          		
          		$pagesBefore = $curPage - 1;
          		$pagesAfter = $totPages - $curPage;
          		
          		$tabArr = array();
          		
          		if($totPages > 15) {
          			
          			if($pagesBefore > 7) {
          				$tabArr = array(1,2,0);
          				
          				if($pagesAfter > 7)
          				{
          					for($i=($curPage-(4)); $i<$curPage; $i++) { $tabArr[] = $i; }
          				} else {
          					for($i=($totPages-11); $i<$curPage; $i++) { $tabArr[] = $i; }
          				}
          			} else {
          				for($i=1; $i<$curPage; $i++) { $tabArr[] = $i; }
          			}
          			
          			$tabArr[] = $curPage;
          			
          			if($pagesAfter > 7) {
          				if($pagesBefore > 7) {				
          					for($i=($curPage+1); $i<=$curPage+4; $i++) { $tabArr[] = $i; }
          				} else {
          					for($i=($curPage+1); $i<13; $i++) { $tabArr[] = $i; }
          				}
          				$tabArr[] = 0;
          				$tabArr[] = $totPages-1;
          				$tabArr[] = $totPages;
          			} else {
          				for($i=($curPage+1); $i<=$totPages; $i++) { $tabArr[] = $i; }
          			}
          			
          		} else {
          			for($i=1;$i<=$totPages;$i++) { $tabArr[] = $i; }
          		}
          				
          		return $tabArr;	
          	}
          }
          
          $id = $id ? $id."_" : "";
          $landing = $modx->documentObject['id'];
          
          if ($total == 0 || $summarize==0) {
          	return false;
          }
          $page = ($start/$summarize)+1;
          
          $paginationArray = generatePagination($page, $total, $summarize);
          $ph = "";
          $cInc = $_GET[$id.'start'];
          foreach($paginationArray as $page) {
          	$inc = ($page-1)*$summarize;
          	if($page == 0) {
          		$ph .= "..."; // print an elipse, representing pages that aren't displayed
          	} else if ($inc==$cInc) {
          		$ph .= "<span class=\"ditto_currentpage\">$page</span>";		
          	} else {
          		$ph .= "<a class=\"ditto_page\" href='".ditto::buildURL("start=".$inc,$landing,$id)."'>$page</a>";
          	}
          }
          
          return $ph;
          
          ?>


          Using on the page - insert after Ditto call

          Ditto call w/o &id: [+phx:dittopages=`,[+total+],[+perPage+]`+]

          If you are using id parameter in the ditto call like [[Ditto? ... &id=’myid’ ]]

          Ditto call with &id=`myid`: [+phx:dittopages=`myid,[+myid_total+],[+myid_perPage+]`+]
            DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

            Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

            [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
            • 8471
            • 333 Posts
            I’ve a problem.
            This is my call:
            [!Ditto? &startID=`14` &depth=`1` &extenders=`summary` &tpl=`NewslistingTemplate` &summarize=`5` &commentsChunk=`commentsChunk` &paginate=`1` &truncText=`Leggi tutto...` &trunc =`1`  &dateFormat=`%d-%b-%y` &truncLen=`150`  &tagData=`tvblogTags` &tagDelimiter=`,` &tagMode=`onlyTags` &tags=` gruppo,branco,reparto,noviziato,clan` &tagDocumentID=`132`!]
            [!splitPagination!]
            <div id="ditto_pages">[+previous+] [+splitPages+] [+next+]</div>
            


            the result is strange:

            What I did wrong? (I’m using Ditto 2.1)
              Sorry for my bad English grin
              • 36416
              • 589 Posts
              Quote from: edipo at Jan 28, 2009, 07:41 AM

              What I did wrong? (I’m using Ditto 2.1)

              I don’t have original SplitPagination source here, but IIRC some internal Ditto placeholders changed names in 2.1 (start to urlStart ?) breaking page calculations...
                • 8471
                • 333 Posts
                Umm thank you Eol... Maybe Mark (the author of splitPagination) can do something for this...
                  Sorry for my bad English grin
                  • 32645
                  • 377 Posts
                  Is it possible to use splitPagination for non MODX tables -- ie, does it actually do the pagination for you, on a table?
                    • 21295
                    • 22 Posts
                    Its me or the code to the original code its down? sad
                      • 25951
                      • 9 Posts
                      Quote from: davidm at Mar 19, 2008, 04:26 PM

                      splitPagination is exactly what I’ve been looking for, but I get strange results even after reading all this.

                      I am getting something like this :

                      < Previous 1 1,2 2,2 3,2 4,2 5,2 6,2 7,2 8,2 9,2 10,2 11,2 12,2...17 18 Next >

                      For others who’re getting results like that with splitPagination. It’s an issue related to the id-parameter. I came across as I used the same code on a homepage of my website and on a newsarchive. The code at the newsarchive has shown the weird pagination. I tried changing the id-parameter - et voilà, c’est ça. It worked then.

                      What I still have to find out is, how to change the numbers of pages shown. Just because in a narrow column the pagination busts the container.