[TYPO3-project-formidable] Number of Results (renderlet:LISTER)

Loredana ZECA l.zeca at ameos.com
Fri Feb 29 10:56:43 CET 2008


Hy again,

There is another way to get the number of filtered results from a lister.

So, you can use something like this:

	<renderlet:BOX name="filterresults" mode="inline">
		<html>
			<userobj>
				<php><![CDATA[/*<?php*/
			
					return $this->aORenderlets["mylister"]->aPager["numrows"];
			
				/*?>*/]]></php>
			</userobj>
		</html>
	</renderlet:BOX>

It is very important to put this renderlet after the definition of your 
renderlet:LISTER, so you can already access his properties. So I moved 
all the renderlet:BOX at the end of the document.

You can see the new code at:
	XML:	http://pastebin.com/f4da03d38
	HTML:	http://pastebin.com/f6479d29c


Now, I’m wondering why you couldn’t use the code line 
{mylister.pager.numrows} into your template file. Maybe, you don’t have 
the latest version of formidable? Which version do you have? If you want 
to get the latest version of formidable, please visit 
http://www.ameos.com/formidable (SVN builds -> Revision 162 to 164)

Good luck!
Loredana Zeca


Simon Rimkus a écrit :
> Hi Loredana,
> 
> thank you very much for your great support!
> 
> Unfortunately in my example the template string {lister.pager.numrows} 
> returns an empty result, though the name of the lister is right etc.
> 
> Is there a way to return this data in the xml file to display it myself?
> 
> Something like:
> 
> $aNum = $this->oIdontKnow->_getPaging();
> return $aNum["numrows"];
> 
> Again many thanks in advance :-)
> 
> Simon
> 
> Loredana ZECA wrote:
> 
>> Hy Simon,
>>
>>
>>
>> We are glad that you like formidable and we are glad to help you.
>>
>>
>>
>> There is something you to have to know about your question:
>>
>>  1.. {num_blank} - it doesn't already exists in formidable, so you 
>> will need to calculate it
>>  2.. {num_filter} - it exists in formidable and it can be accessible 
>> directly into your HTML file, like this: {lister.pager.numrows}
>>
>>
>> So what you have to do is to follow the next steps:
>>
>>
>>
>>  1.. create the XML file for your search form and lister
>>
>>  2.. create all datasources you need for creating your search / 
>> results form:
>>
>> You will need to create the datasource for you search form (in our 
>> case "fruitlister") and write this line code:
>>
>>
>>
>> <renderlet:SEARCHFORM name="mysearchform">
>>
>> ..
>>
>> <datasource use="fruitlister" />
>>
>> ..
>>
>> </renderlet:SEARCHFORM>
>>
>>
>>
>> For your lister, you must specify which search form is using, 
>> something like this:
>>
>> <searchform use="mysearchform" />
>>
>>
>>
>>  3.. create a renderlet:BOX for the total number of results (ex: 
>> {num_blank}), something like this:
>>
>> <renderlet:BOX name="totalresults" mode="inline">
>>
>>            <html>
>>
>>                        <userobj>
>>
>>                                   <php><![CDATA[/*<?php*/
>>
>>
>>
>>                                               $aData = 
>> $this->aODataSources["fruitlister"]->_fetchData();
>>
>>                                               return $aData["numrows"];
>>
>>
>>
>>                                   /*?>*/]]></php>
>>
>>                        </userobj>
>>
>>            </html>
>>
>> </renderlet:BOX>
>>
>>
>>
>> Where the datasource "fruitlister" must be the same datasource used 
>> for your search form (ex: mysearchform)
>>
>>
>>
>>  4.. create the HTML for the template file
>>
>> Here you must specify this html:
>>
>> {lister.pager.numrows} results from a total of {totalresults} items
>>
>>
>>
>> Finally, you will have a form like the one attached to this email (see 
>> "form.jpg").
>>
>>
>>
>>
>>
>> To see the entire code, please go to the following links:
>>
>>    XML:    http://pastebin.com/f4f11349b
>>
>>    HTML: http://pastebin.com/f2469d594
>>
>>
>>
>>
>>
>> Hope this will helps you.
>>
>>
>>
>> Loredana Zeca
>>
>>
>>
>>
>> "Simon Rimkus" <simon at bacuba.com> a ?crit dans le message de news: 
>> mailman.3380.1204050220.5943.typo3-project-formidable at lists.netfielders.de... 
>>
>>  
>>
>>> Hello everybody,
>>>
>>> first of all I'd like to pay you a big compliment for this impressing
>>> project!
>>>
>>> I have a question that might sound very easy to you. But since I am a
>>> raw beginner to this, I don't find a solution.
>>>
>>> I'd like to display the following in the head of my renderlet:LISTER
>>> (combined with a searchform):
>>>
>>> {num_blank} = number of results without any filter by the searchform
>>> {num_filter} = number of results filtered by the searchform
>>>
>>> --> e.g. {num_filter} of {num_blank} items
>>>
>>> How can I return this data and how can I display this text in my 
>>> template?
>>>
>>> Many thanks in advance for your help
>>> Simon
>>>   
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> TYPO3-project-formidable mailing list
>> TYPO3-project-formidable at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable 
>>
>>


More information about the TYPO3-project-formidable mailing list