[TYPO3] Custom Menu/Sitemap?
JoH asenau
info at cybercraft.de
Mon May 28 23:39:44 CEST 2007
>>> I thought of a "TS" 'content-element', which sadly doesn't exists,
>>> because creating that output is easy with HMENU.
>>
>> 1.) Why don't you use HMENU if it's easy? It is not restricted to
>> render menus. It's just a TypoScript element that will render HTML
>> elements on a per page basis. And what you want to get almost looks
>> like a menu with just one element.
>>
> Yes, exactly. I don't use the HMENU, because I would then have to
> use a template and have to define
> a submarker. Setting a submarker at a specific page corrupts the
> whole idea. I /have to/ go though a content-element, as these can be
> set/ordered/maintained in a flexible way.
What makes you think that this is the only way to make use of an HMENU in a
special place?
There are several options you just have to choose what's best for your case.
> But what do you mean by: "It's just a TypoScript element that will
> render HTML elements on a per page basis"? There is no TypoScript
> 'content-element' in that I can sink a HMENU.
Of course there is, you just don't know how to do it :-)
>> 2.) How does the rest of your setup look? Are you using TemplaVoila,
>> a classic HTML template with markers an subparts or just pure
>> TypoScript?
>>
> Classic templates.
Cool, so we got no problems regarding any TV restrictions or specialties so
far.
>> Your problem seems to be to get the output of the HMENU in front of
>> the rest of your content but that's easy as soon as you are able to
>> tell me the answer for question 2 :-)
>>
> Well, it's not about in-front-of, I could hack the specific HMENU
> everywhere, but just in a fixed way.
No, because an HMENU like that
temp.blah = HMENU
temp.blah {
special = updated
special {
value = 1
depth = 20
limit = 1
}
}
would never be "fixed" but always show one page that has been the last one
being updated.
So this is already dynamic, now you just have to find a way to put this into
a content element.
And I agree it would be best to use "menu/sitemap" for that.
> And it's dirty. This 'menu/sitemap' I want is a 'page-content' with
> all it's advantages, it just has to look
> different.
So let's just do it ;-)
First you need to create a new option for the selectbox of this element and
add it to the existing options, just to make sure the default behaviour will
not be overriden.
This can be done with TSconfig, so go to the first (root) page in your tree
(but not the one with the globe icon) and edit the page header.
Now fill this into the TSconfig field:
TCEFORM.tt_content.menu_type {
addItems {
99 = Last updated page with abstract and image
}
}
Now your editors can select this new entry but there's no TS setup for it
yet.
So let's do that now.
Go to the TypoScript template that is responsible for the content rendering.
First create the setup for the new entry as a temp element:
temp.lastUpdated = HMENU
temp.lastUpdated {
special = updated
special {
# value should be the starting page
# of the branch to take into account
value = 1
depth = 20
limit = 1
}
1 = TMENU
1 {
NO {
allWrap = <div class="lastupdated">|</div>
beforeImg {
import = uploads/media/
import.field = media
import.listNum = 0
width = 123
}
beforeImgLink = 1
beforeWrap = <div class="lastupdatedimage">|</div>
linkWrap = <div class="lastupdatedlink">|</div>
after = TEXT
after {
field = abstract
wrap = <div class="lastupdatedtext">|</div>
}
}
}
}
And now this has to be put into the right place of the tt_content setup.
Therefor you can use the TypoScript Object browser to see what is already
there and where to place it.
You will find something like this:
tt_content.menu.20 = CASE
tt_content.menu.20.key.field = menu_type
This means the menu is rendered based on the settings in the "menu_type"
selectbox of the content element "menu/sitemap".
Since we already added a new element 99 we now have to add this here too:
tt_content.menu.20.99 < temp.lastUpdated
Done!
The output will be something like this:
<div class="lastupdated">
<div class="lastupdatedimage">
<a href="blah">
<img src="blah">
</a>
</div>
<div class="lastupdatedlink">
<a href="blah">
Some Link Text
</a>
</div>
<div class="lastupdatedtext">
Some Abstract Text
</div>
</div>
So feel free to add some CSS styles to get a proper layout now.
Have fun with this small tutorial and hopefully this will enlighten you
about
a) How things can be solved in TYPO3 and
b) Which documents to read in the near future
http://typo3.org/documentation/document-library/references/doc_core_tsconfig/current/
http://typo3.org/documentation/document-library/references/doc_core_tsref/current/
http://typo3.org/documentation/document-library/core-documentation/doc_core_tsbyex/current/
Joey
--
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
openBC/Xing: http://www.cybercraft.de
T3 cookbook: http://www.typo3experts.com
More information about the TYPO3-english
mailing list