Pagination JEXL Expression/Page Bindings

I am trying to find out if $sys.page will return anything when you test the JEXL expression. The only thing that I get is a null pointer. This might be part of the page bindings that I use as well. I didn’t put the $sys.pagecount into the bindings because I alter the query that is sent to the slot based on some items calculated in velocity. Now I can probably convert these to JEXL if I have to, but I am just making sure that this will work before I undertake this.

If that is not the case, could someone point me in the right direction of using pagination with a slot.

You need to bind the $sys.pagecount variable.

Can you post your bindings, and the Velocity code (and query) you’re using to parameterise the slot?

I really don’t have any bindings other than setting the template for the slot. I tried to force a query for the slot in the bindings but was unable to do so. I thought I remember reading somewhere that I could manually set the bindings from inside of velocity. It has been awhile since I had read that, or even tried to do something like that. Let me know if there is anything that I can do with this.


#set($curr_date = $tools.date.format('yyyy-MM-dd H:mm:ss',$tools.date.getDate()))
#if($sys.item.hasProperty("rx:category"))
	#set($category = $sys.item.getProperty("rx:category").String)
	#set($theqs = "select rx:displaytitle from rx:mtuNews where jcr:path like '//Sites/News/news%/stories%' and rx:categories = '$category' and rx:sys_contentstartdate < '$curr_date' order by rx:sys_contentstartdate desc")
#else
	#set($curr_year = $sys.item.getProperty("rx:sys_contentstartdate").Date)
	$curr_year.add(1,1)
	#set($cyplus1 = $tools.date.format('yyyy',$curr_year))
	#set($cyplus1date = '-01-01')
	$curr_year.add(1,-2)
	#set($cyminus1 = $tools.date.format('yyyy',$curr_year))
	#set($cyminus1date = '-12-31')
	#set($theqs = "select rx:displaytitle from rx:mtuNews where jcr:path like '//Sites/News/news%/stories%' and (rx:sys_contentstartdate > '$cyminus1$cyminus1date' and rx:sys_contentstartdate < '$cyplus1$cyplus1date') and rx:categories <> 'none' and rx:sys_contentstartdate < '$curr_date' order by rx:sys_contentstartdate desc")
#end	

#set($slotparams.query = $theqs.toString())
#set($slotparams.max_results = 9999)
<html>
<body>

#slot('mtuAutoNewsStories' '<div id="categories">' '<div class="item">' '<div class="clearer"></div></div>' '</div>' $slotparams)
#if($sys.currentslot.relresults.size() == 0)
	<h4>No stories currently available for the selected category.</h4>
#end