[TYPO3-project-formidable] FORMidable custom pager
Manuel Rego Casasnovas
mrego at igalia.com
Fri May 25 19:30:13 CEST 2007
Hi!
I've modified the class tx_dhlister and I've added two new markers
(###PREWINDOW### and ###POSTWINDOW###) and I've corrected the code to
create the pages in the window.
With these changes I can create a pager like I wanted, something like:
*1* 2 3 ... 15 next
prev 1 *2* 3 4 ... 15 next
prev 1 2 3 *4* 5 6 ... 15 next
prev 1 ... 7 8 *9* 10 11 ... 15 next
prev 1 ... 11 12 *13* 14 15 next
prev 1 ... 13 14 15
I send the file with this changes attached, but I've more changes in
this file (for remove the javascript in the pagres) and I don't
recommend you to use directly, I think that is better to copy the new
code manually.
Furthermore I've added other marker ###IFEMPTY### that allow me to put
in my template the next lines:
<!-- ###MY_LIST### begin-->
...
<!-- ###IFEMPTY### begin-->
<b>{message}</b>
<!-- ###IFEMPTY### end-->
...
<!-- ###MY_LIST### end-->
I can apply style to my message when there aren't results, and I can put
it where I want.
I hope that this can be help. ;-)
Best regards,
Rego
--
http://www.igalia.com
Manuel Rego Casasnovas escribió:
> Hi everyone.
>
> I'd like to do a custom pager for my FORMidable list.
>
> I've set the value for the tag /nav/window to 3.
>
> And my template is the next:
> <div class="pagination">
>
> <!-- ###LINKPREV### begin--><a href = "{link}">previous</a> |<!--
> ###LINKPREV### end-->
>
> <!-- ###LINKFIRST### begin--><a href = "{link}">1</a> |<!--
> ###LINKFIRST### end-->
>
> <!-- ###WINDOW### begin-->
> ... |
> <!-- ###WINDOWLINKS### begin-->
> <!-- ###NORMAL### begin--><a href = "{link}">{page}</a> | <!--
> ###NORMAL### end-->
> <!-- ###ACTIVE### begin-->{page} |<!-- ###ACTIVE### end-->
> <!-- ###WINDOWLINKS### end-->
> ... |
> <!-- ###WINDOW### end-->
>
> <!-- ###LINKLAST### begin--><a href = "{link}"><!-- ###PAGER###
> begin-->{pagemax}<!-- ###PAGER### end--></a> |<!-- ###LINKLAST### end-->
>
> <!-- ###LINKNEXT### begin--><a href = "{link}">next</a><!--
> ###LINKNEXT### end-->
>
> </div>
>
>
> I use the code from last SVN revision in the dhlister, the code for
> current 0.7 version have problems with the links:
> ------------------------
> $iStart = $iPage - $iWindow;
> if($iStart < 0) {
> $iStart = 0;
> }
>
> $iEnd = $iPage + 1;
> if($iEnd > $iPageMax) {
> $iEnd = $iPageMax;
> }
>
> for($k = $iStart; $k <= $iEnd; $k++) {
> $aWindow[($k + 1)] =
> "javascript:void(Formidable.Lister.Pager.goTo('" . $sFormUniqueId . "',
> " . $k . "));";
> }
> ------------------------
>
> I've changed the first line, I've put $iWindow instead of 3 (I think
> that this is a little bug).
>
> I've get a good pager with this, something like this:
> previous | 1 | ... | 3 | 4 | 5 | 6 | 7 | ... | 10 | next
>
> But when I go to the first page, I get the next result:
> ... | 1 | 2 | 3 | ... | 10 | next
>
> This isn't bad but I'd like that don't show the first ... |, and get
> something like:
> 1 | 2 | 3 | ... | 10 | next
>
> I don't know exactly how to work the tag ###WINDOW### and ###WINDOWLINKS###.
>
> Somebody has done a custom pager similar before?
>
>
> Thank you very much,
> Rego
>
> --
> http://www.igalia.com
> _______________________________________________
> 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