Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a numeric navigation

How do I create a menu which automatecaly names the involved page into a numeric navigation?

This would be my page tree:

News
|--- Newsarticle tom (contains 9 content elements)
|--- Skeet's stuff (contains 9 content elements)
|--- Jessicas 5 articles (contains 4 content elements)

In the frontent all 3 pages will be simply displayed as a numeric navi:

(Imagin the 9 textpic elements of "Newsarticle tom" in here)
1 - 2 - 3

like image 651
Tomkay Avatar asked Oct 10 '22 22:10

Tomkay


2 Answers

{register:count_HMENU_MENUOBJ} should do the trick - I found it in the comments here http://www.typo3wizard.com/de/snippets/menus/nummeriertes-menue.html. (german)

Here I used @konsolenfreddies HMENU example, modified for your demands. (Untested).

temp.menu = HMENU
temp.menu {
    1 = TMENU
    1 {
        noBlur = 1
        wrap = <ul>|</ul>
        NO = 1
        NO {
            wrapItemAndSub = <li>|</li>
            altText = subtitle // title
            title = subtitle // title
        }
        CUR < .NO
        CUR.wrapItemAndSub = <li class="active">|</li>
        ACT < .CUR
    }

    2 < .1
    2 {
        wrap = <ol>|</ol>
        NO {
            allWrap = <span>Nr.{register:count_HMENU_MENUOBJ}|</span>
            allWrap.insertData = 1
            ATagBeforeWrap = 1
            }
        CUR < .NO
        CUR.wrapItemAndSub = <li class="active"><span>|</span></li>
        ACT < .CUR
    }
}

In this case, I guess all subpages are taken in account when numbering. And the full setup as described on the site is far more complicated. But if you know your typoscript, you'll understand.

like image 177
Mateng Avatar answered Oct 13 '22 11:10

Mateng


First off, you could use the alternative navigation title to name them individually, but that might be tedious in a larger page tree.

a solution would be to create a OL navigation and remove the title via CSS. That way the navigation is still accessible and gives some hints about what's behind the numbers:

temp.menu = HMENU
temp.menu {
    1 = TMENU
    1 {

        noBlur = 1
        wrap = <ul>|</ul>
        NO = 1
        NO {
            wrapItemAndSub = <li>|</li>
            altText = subtitle // title
            title = subtitle // title
        }
        CUR < .NO
        CUR.wrapItemAndSub = <li class="active">|</li>
        ACT < .CUR
    }

    2 < .1
    2 {
        wrap = <ol>|</ol>
        NO.wrapItemAndSub = <li><span>|</span></li>
        CUR < .NO
        CUR.wrapItemAndSub = <li class="active"><span>|</span></li>
        ACT < .CUR
    }
}

The corresponding CSS:

ol li span {display:none;}
like image 39
konsolenfreddy Avatar answered Oct 13 '22 10:10

konsolenfreddy