[TYPO3-english] TS and menu

Marcus 'biesior' Biesioroff vsbies at wp.pl
Sat Feb 7 11:49:47 CET 2009


[THIS IS A MAIL COPY]

 > Dear Marcus,

 > Normally I never write directly to a mailing list member but for some
 > reason netfielders seems to be rejecting my e-mails at the moment.

OK, no problem, probably you're sending mails via standard email client, 
try use of NewsReader [1] instead, it works great :)
[1]http://typo3.org/community/mailing-lists/use-a-news-reader/

 > So, perhaps you would be willing to give me some advice.

 > OKay, here we go. What I would like to do is to create three menus on 
the page.

 > Menu 1 = top_menu; the top menu consists of the following items:
 > about, downloads, contact.
 > Menu 2 = main_menu; the main menu consists of: Home, Projects
 > Menu 3 = footer_menu; the footer menu consists of: disclaimer,
 > sitemap, privacy statement.

I would in this case start with main_menu (which will be most dynamic) 
and create it on the start of the PageTree structure.
Next I would create pages with "Not in menu" checbox selected and use a 
'special = list' type of menu

[ts]
   lib.top_menu = HMENU
   lib.top_menu.special = list

    #comma separated list of uids for required pages
   lib.top_menu.special.value = 99,95,96

    #include menu positions with 'Not in menu' selected
   lib.top_menu.includeNotInMenu = 1
   lib.top_menu.1 = TMENU

    #although NO state is 1 by default
    #using NO = 1 has a special task - read TSref [2]
   lib.top_menu.1.NO = 1

[/ts]

after that you have to copy (<) lib.top_menu into some part of the
page for example:

[ts]
   page = PAGE
   page.10 < lib.top_menu
[/ts]

 > A while ago I was suggested by a typo3 user to sort the content of
 > each menu in sysfolders. It was argued that this would simplify things
 > for the content managers. I can see the advantages here so that's why
 > I'm trying to figure out how to arrange this. Looking at the trouble
 > it has given me so far, I'll just stick to the "normal" page
 > structures unless you have some other perspectives on this...

I was testing some of sysFolder placed menu positions yesterday and
it was working (I'm shame that I wrote that'll NOT work for sure
-sorry ;) ) so maybe you made some mistake or used TS declaration
in wrong order:

[ts]
#include here previous sample with lib.top_menu

lib.sysfolder_menu = HMENU
lib.sysfolder_menu {
   special = directory
   special.value = 146
   # 146 = uid of sysfolder
   1 = TMENU
   1.NO = 1
}

page = PAGE
page.10 < lib.top_menu
page.20 < lib.sysfolder_menu
[/ts]

 > So.. what is this all about..  Well. I have figured out templavoila. I
 > understand the principles behind it except for menu's and TS. I have
 > been unable to find a well written document explaining the principles
 > of TS and menus. Sadly, I have found a huge repository on TS info
 > which in my opinion is really daunting to new users. Why I use TS,
 > because I find it far more easier than "old" template building as
 > explained in the MTB tutorial.

Well when I was starting some time ago I was concentrated on TV!
first too, but in these times there was some problems, so I decided
to work on standard MTB - now I found that MTB is really much easier and
faster (server do not need use its resources for additional rendering
mechanism).

All you need to know about rendering via TS is described in TSref [2]:
[2]http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/toc/0/

you should start with reading the cObject: TEMPLATE section [3]
[3]http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/8/#id4293131

there is sample on the bottom of this section copy it to your TS,
crate fileadmin/test.tmpl (I preffer html extension for templates) and
in the template file use some marks and subparts:

test.tmpl src:
[HTML]

marks stands here: ###Testmark###

<!-- ###HELLO### begin -->
      This subpart will be replaced by TypoScript
<!-- ###HELLO### end -->

[/HTML]

what is most important you can assign your menu to marks or subparts:

page.10.subparts.HELLO < lib.sysfolder_menu

and it's all ot he magick!

 > As you might have guessed by now, I'm in real need of some explanation
 > of TS and menus. Could you give me some advice as in where to start
 > learning?

The best reource for all TypoScript matter is TSref [2] and it's 
sections, for example HMENU section [4]:

[4]http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/8/#id4251386

Generally it looks difficult but when you'll be more familiar with TSref 
[2] you'll be surprised how easy and powerful it is ;)

 > Thanks in advance!

 > Kind regards,

 > Marco


Best wishes and good luck :)
-- 
Marcus 'biesior' Biesioroff
a.k.a. Marek Krawczyk (original)

Polish TYPO3 Community Proud Member
http://typo3.pl


More information about the TYPO3-english mailing list