[Typo3] pagination possible in "Menu of subpages"

Dave Chewter typo3 at interonline.co.uk
Tue Oct 11 13:55:43 CEST 2005


"Torsten Schrade" <schrade at lineara.de> wrote in message 
news:mailman.1.1129016921.362.typo3-english at lists.netfielders.de...
> Hi Dave,
>
> huh, after some racking of brains I have "some" solution for this. Let's 
> see if you like it...it's quit a bit of TS:
>
>> We use the "Menu of subpages to these pages" content element a lot within 
>> the site to give a list of sub pages within a category, however sometimes 
>> we have an awful lot of subpages so the menu becomes too long. Is there a 
>> way of adding pagination to the sub pages so for instance if you have 100 
>> subpages, you can show 20 at a time with pagination for the menu to show 
>> the next 20 etc.
>
> The idea is to limit the general number of items the "Menu of subpages to 
> these pages" content element can take using maxItems. Then it is checked 
> with stdWrap if the number of pages that are subpages to the content 
> element exceeds a given number. If this is true a link with a &next= 
> parameter is appended. This parameter is taken up in a condition that sets 
> the starting point of the menu to the first in the "second" set of 
> menuitems using .begin property of HMENU.
>
> So all you have to do with the following snippet is to define the numbers 
> for the "sets" in the .if.value properties and change the .values in your 
> conditions accordingly.
>
> 1.set
>
> config.linkVars = next
>
> 2.Overwrite your default "Menu of subpages to these pages" CE with the 
> following snippet, modifying the numbers to your needs.
>
> tt_content.menu.20.1 = HMENU
> tt_content.menu.20.1 {
>
> special = directory
> special.value.field = pages
>
> # this determines the general number of menuitems that can be shown
> maxItems = 3
> wrap >
>
> # the following wraps the menu dynamically according to the number of 
> existing subpages
> # if the number is greater than .value it appends a &next= parameter that 
> is taken up in a condition
>
> stdWrap.innerWrap = <div class="csc-menu csc-menu-1">|</div>
> stdWrap.innerWrap.if {
> value = 4
> isLessThan.cObject = TEXT
> isLessThan.cObject.numRows {
>        table = pages
>        select {
>           pidInList.data < tt_content.menu.20.1.special.value.field
>           orderBy = sorting
> selectFields = uid
>        }
>     }
> }
> stdWrap.outerWrap = <div class="csc-menu csc-menu-1">|<p><a 
> href="index.php?{TSFE:id}&next=1">next...</a></p></div>
> stdWrap.outerWrap.insertData = 1
> stdWrap.outerWrap.if {
> value = 3
> isGreaterThan.cObject < 
> tt_content.menu.20.1.stdWrap.innerWrap.if.isLessThan.cObject
> }
>
> 1 = TMENU
> 1.target=_top
> 1.NO {
> allWrap = <p>|</p>
> stdWrap.htmlSpecialChars=1
> } }
>
> 3. Set the conditions in your template and change the values accordingly:
>
> ####################
> [globalVar = GP:next = 1]
>
> # this condition sets the starting point for the second "set" of menuitems 
> and appends a next- or backlink accordingly
>
> tt_content.menu.20.1 {
> begin = 4
> stdWrap {
> innerWrap.if.value = 7
> innerWrap = <div class="csc-menu csc-menu-1">|<p><a 
> href="index.php?{TSFE:id}">back...</a></p></div>
> innerWrap.insertData = 1
>
> outerWrap = <div class="csc-menu csc-menu-1">|<p><a 
> href="index.php?{TSFE:id}&next=2">next...</a></p></div>
> outerWrap.if.value = 6
> }
> [global]
>
> ####################
> [globalVar = GP:next = 2]
>
> # this condition sets the starting point for the third "set" of menuitems 
> and appends a next- or backlink accordingly
>
> tt_content.menu.20.1 {
> begin = 7
> stdWrap {
> innerWrap.if.value = 10
> innerWrap = <div class="csc-menu csc-menu-1">|<p><a 
> href="index.php?{TSFE:id}&next=1">back...</a></p></div>
> innerWrap.insertData = 1
>
> outerWrap = <div class="csc-menu csc-menu-1">|<p><a 
> href="index.php?{TSFE:id}&next=3">next...</a></p></div>
> outerWrap.if.value = 9
> }
> [global]
>
> ####################
>
> As you can see in my example I tested it successfully with a page that had 
> nine subpages, taking steps of three menuitems each time. Hope the whole 
> thing somehow makes sense :-)
>
> Have fun and greets,
> Torsten

Hi Torsten

Thank you so much for your reply. I've tried adding it to a page with 9 
subpages and it limits the subpages to 3 fine, but doesn't seem to want to 
add the pagination. I'm sure I'm doing something simple wrong so let me 
explain.

I've added the code you provided to the setup of an ext template in the page 
where I want this funcitonality. I then added a standard Menu of subpages 
content element. I noticed in the source code of the generated page that it 
didn't wrap the menu in the csc-menu-1 div tags.

The page I've added it on is http://www.intersites.co.uk/11333/ Underneath 
I've added a standard Menu of sybpages with abstract (which uses the same 
look and feel) so you can see the difference in the page source.

I'm sure I've done something silly like adding it all to an extension 
template when I shouldn't have or something like that, so any advice would 
be very greatfully received.

Thanks again for the detailed reply and sorry to bug you with more 
questions.

Kind Regards

Dave





More information about the TYPO3-english mailing list