<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Selectable Items per Page Hack for Drupal 6 Views</title>
	<atom:link href="http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/</link>
	<description>Valuable Insights for Better Websites</description>
	<lastBuildDate>Wed, 14 Sep 2011 16:57:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Stephen Ward</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-12841</link>
		<dc:creator>Stephen Ward</dc:creator>
		<pubDate>Sat, 16 Jul 2011 16:17:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-12841</guid>
		<description>All good solutions. Interestingly enough, the D7 version of Views exposed the items per page filter, so it seems this will always be a backwards hack. Yay for open source!</description>
		<content:encoded><![CDATA[<p>All good solutions. Interestingly enough, the D7 version of Views exposed the items per page filter, so it seems this will always be a backwards hack. Yay for open source!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erald</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-11794</link>
		<dc:creator>Erald</dc:creator>
		<pubDate>Tue, 05 Jul 2011 14:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-11794</guid>
		<description>hmm something went wrong with the pasting

the correct code which works
	if ($this-&gt;get_option(&#039;use_pager&#039;) == &#039;0&#039;) {
	    $this-&gt;view-&gt;set_items_per_page($this-&gt;get_option(&#039;items_per_page&#039;));
	} else {
		$this-&gt;view-&gt;set_items_per_page((($_GET[&#039;items-per-page&#039;] &gt; 0) ? $_GET[&#039;items-per-page&#039;] : $this-&gt;get_option(&#039;items_per_page&#039;)));
	}</description>
		<content:encoded><![CDATA[<p>hmm something went wrong with the pasting</p>
<p>the correct code which works<br />
	if ($this-&gt;get_option(&#8216;use_pager&#8217;) == &#8217;0&#8242;) {<br />
	    $this-&gt;view-&gt;set_items_per_page($this-&gt;get_option(&#8216;items_per_page&#8217;));<br />
	} else {<br />
		$this-&gt;view-&gt;set_items_per_page((($_GET['items-per-page'] &gt; 0) ? $_GET['items-per-page'] : $this-&gt;get_option(&#8216;items_per_page&#8217;)));<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erald</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-11772</link>
		<dc:creator>Erald</dc:creator>
		<pubDate>Tue, 05 Jul 2011 09:32:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-11772</guid>
		<description>I like the solution but had some problems with blocks which do not use a pager. so changed things a bit so views on the same page which are not using a pager will not be affected.

?get_option(&#039;use_pager&#039;) == &#039;0&#039;) {
	    $this-&gt;view-&gt;set_items_per_page($this-&gt;get_option(&#039;items_per_page&#039;));
	} else {
		$this-&gt;view-&gt;set_items_per_page((($_GET[&#039;items-per-page&#039;] &gt; 0) ? $_GET[&#039;items-per-page&#039;] : $this-&gt;get_option(&#039;items_per_page&#039;)));
	}
?&gt;

Tried to make a module but probably I am doing something wrong somewhere since got all kinds of weird things. If someone has the complete module code I would appreciate it since hate to hack into the core code.</description>
		<content:encoded><![CDATA[<p>I like the solution but had some problems with blocks which do not use a pager. so changed things a bit so views on the same page which are not using a pager will not be affected.</p>
<p>?get_option(&#8216;use_pager&#8217;) == &#8217;0&#8242;) {<br />
	    $this-&gt;view-&gt;set_items_per_page($this-&gt;get_option(&#8216;items_per_page&#8217;));<br />
	} else {<br />
		$this-&gt;view-&gt;set_items_per_page((($_GET['items-per-page'] &gt; 0) ? $_GET['items-per-page'] : $this-&gt;get_option(&#8216;items_per_page&#8217;)));<br />
	}<br />
?&gt;</p>
<p>Tried to make a module but probably I am doing something wrong somewhere since got all kinds of weird things. If someone has the complete module code I would appreciate it since hate to hack into the core code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Garry</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-9846</link>
		<dc:creator>Garry</dc:creator>
		<pubDate>Tue, 24 May 2011 08:47:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-9846</guid>
		<description>EDIT:

Sorry I hadn&#039;t fully tested that code: here is the working code:

module:

function yourmodulename_views_pre_execute(&amp;$view){
if ($view-&gt;name == ‘yourviewname’) {

$view-&gt;set_items_per_page((($_GET[&#039;items-per-page&#039;] &gt; 0) ? $_GET[&#039;items-per-page&#039;] : &#039;&#039;));

}

}</description>
		<content:encoded><![CDATA[<p>EDIT:</p>
<p>Sorry I hadn&#8217;t fully tested that code: here is the working code:</p>
<p>module:</p>
<p>function yourmodulename_views_pre_execute(&amp;$view){<br />
if ($view-&gt;name == ‘yourviewname’) {</p>
<p>$view-&gt;set_items_per_page((($_GET['items-per-page'] &gt; 0) ? $_GET['items-per-page'] : &#8221;));</p>
<p>}</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Garry</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-9844</link>
		<dc:creator>Garry</dc:creator>
		<pubDate>Tue, 24 May 2011 08:10:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-9844</guid>
		<description>Another version of titoulle&#039;s answer is to have this in a custom module:

function yourmodulename_views_pre_execute(&amp;$view){
  if ($view-&gt;name == &#039;yourviewname&#039;)  {
  	
$view-&gt;set_items_per_page((($_GET[&#039;items-per-page&#039;] &gt; 0) ? $_GET[&#039;items-per-page&#039;] : $view-&gt;get_option(&#039;items_per_page&#039;)));

	}

}

This code is just slightly different from the one above, I didn&#039;t have need to code in the limit amount or use SESSION variables.

Hope this helps anyone who needs it.</description>
		<content:encoded><![CDATA[<p>Another version of titoulle&#8217;s answer is to have this in a custom module:</p>
<p>function yourmodulename_views_pre_execute(&amp;$view){<br />
  if ($view-&gt;name == &#8216;yourviewname&#8217;)  {</p>
<p>$view-&gt;set_items_per_page((($_GET['items-per-page'] &gt; 0) ? $_GET['items-per-page'] : $view-&gt;get_option(&#8216;items_per_page&#8217;)));</p>
<p>	}</p>
<p>}</p>
<p>This code is just slightly different from the one above, I didn&#8217;t have need to code in the limit amount or use SESSION variables.</p>
<p>Hope this helps anyone who needs it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dornelas</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-9063</link>
		<dc:creator>Dornelas</dc:creator>
		<pubDate>Sun, 01 May 2011 10:18:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-9063</guid>
		<description>You guys saved me a lot of time. Thank you very much. 
titouille&#039;s solution works very well.</description>
		<content:encoded><![CDATA[<p>You guys saved me a lot of time. Thank you very much.<br />
titouille&#8217;s solution works very well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: titouille</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-4821</link>
		<dc:creator>titouille</dc:creator>
		<pubDate>Tue, 11 Jan 2011 16:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-4821</guid>
		<description>Another solution I found with your suggestion is to use the hook_views_pre_execute to modify the item_per_page value like this : 

function mymodule_views_pre_execute( &amp;$view ) {

  if( $view-&gt;name == &quot;my_view&quot; ) {

    $display = $view-&gt;current_display;
    
    if( $view-&gt;display[$display]-&gt;display_title == &quot;All my blog posts&quot; ) {
     
      $limit = 12;
      if( isset( $_GET[&quot;limit&quot;] ) ) $limit = $_SESSION[&#039;limit&#039;] = $_GET[&quot;limit&quot;];
      else if( isset( $_SESSION[&#039;limit&#039;] ) ) $limit = $_SESSION[&#039;limit&#039;];
      
      if( intval( $limit ) == 0 ) 
        $limit = 12;

      $view-&gt;set_items_per_page( $limit );
    }
}

Hope this help ;-)</description>
		<content:encoded><![CDATA[<p>Another solution I found with your suggestion is to use the hook_views_pre_execute to modify the item_per_page value like this : </p>
<p>function mymodule_views_pre_execute( &amp;$view ) {</p>
<p>  if( $view-&gt;name == &#8220;my_view&#8221; ) {</p>
<p>    $display = $view-&gt;current_display;</p>
<p>    if( $view-&gt;display[$display]-&gt;display_title == &#8220;All my blog posts&#8221; ) {</p>
<p>      $limit = 12;<br />
      if( isset( $_GET["limit"] ) ) $limit = $_SESSION['limit'] = $_GET["limit"];<br />
      else if( isset( $_SESSION['limit'] ) ) $limit = $_SESSION['limit'];</p>
<p>      if( intval( $limit ) == 0 )<br />
        $limit = 12;</p>
<p>      $view-&gt;set_items_per_page( $limit );<br />
    }<br />
}</p>
<p>Hope this help <img src='http://www.wardontheweb.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Ward</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-4536</link>
		<dc:creator>Stephen Ward</dc:creator>
		<pubDate>Sat, 01 Jan 2011 16:29:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-4536</guid>
		<description>That could be a possible solution, jberg, although I&#039;m not sure if that function can be overridden from template.php.  I&#039;ve never tried it that way, but I imagine it&#039;s possible; pretty much everything in Drupal can be overridden one way or another.</description>
		<content:encoded><![CDATA[<p>That could be a possible solution, jberg, although I&#8217;m not sure if that function can be overridden from template.php.  I&#8217;ve never tried it that way, but I imagine it&#8217;s possible; pretty much everything in Drupal can be overridden one way or another.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jberg</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-4051</link>
		<dc:creator>jberg</dc:creator>
		<pubDate>Thu, 16 Dec 2010 20:22:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-4051</guid>
		<description>Would it also be possible to override the function in the theme template.php file so you didn&#039;t have to hack the module? sites/all/themes/theme_name/template.php
Then it would be specific for the theme on a server running multiple Drupal sites.

Either way, great solution. Surprised someone hasn&#039;t added something like this to views&gt;pager. It would nice to have a &quot;user defined&quot; option, or at least a &quot;view all&quot; option.</description>
		<content:encoded><![CDATA[<p>Would it also be possible to override the function in the theme template.php file so you didn&#8217;t have to hack the module? sites/all/themes/theme_name/template.php<br />
Then it would be specific for the theme on a server running multiple Drupal sites.</p>
<p>Either way, great solution. Surprised someone hasn&#8217;t added something like this to views&gt;pager. It would nice to have a &#8220;user defined&#8221; option, or at least a &#8220;view all&#8221; option.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bronius</title>
		<link>http://www.wardontheweb.com/selectable-items-per-page-hack-for-drupal-6-views/comment-page-1/#comment-1255</link>
		<dc:creator>bronius</dc:creator>
		<pubDate>Mon, 01 Mar 2010 21:28:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.wardontheweb.com/?p=404#comment-1255</guid>
		<description>Note: I think it&#039;s possible to override this value without a .module hack, at least in the case of embedded views. In the case of embedded views, I believe you could simply set $view-&gt;set_items_per_page just like you did in your hack but in the embed.</description>
		<content:encoded><![CDATA[<p>Note: I think it&#8217;s possible to override this value without a .module hack, at least in the case of embedded views. In the case of embedded views, I believe you could simply set $view-&gt;set_items_per_page just like you did in your hack but in the embed.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

