[TYPO3-english] Special content in submenu + What to do with HMENU/stdWrap
Christopher Torgalson
bedlamhotel at gmail.com
Wed Oct 29 16:47:05 CET 2008
Hi,
On 29-Oct-08, at 7:00 AM, Tyler Kraft wrote:
> Hi
>
> It's great, I've used it to build all kinds of things.
>
> When you think about it slightly abstractly a menu is just a list of
> records in the beginning. So using the stdWrap (and all tis different
> properties, including the ability to return a list from a select) on
> the
> 'value' of the HMENU 'special' property you can load your menu with
> just
> about any list of numbers. And then using the before and after
> properties for menu items you can render just about anything you want,
> from any table you want and in any layout you want, with any
> additional
> functionality you want (eg javascript calls, etc)
Just to follow up on this with a concrete example of how powerful
HMENU + stdWrap is (without even listing a table other than pages):
My extension bh_firtools (which is basically just a lot of Typoscript
objects) is made to help produce image-replacement menus with
Typoscript. This means we need (1) to build a background image for
every page in the menu, (2) to build a CSS declaration for each page's
menu item, and (3) to output a menu with an id attribute in the list
item or link that matches the declaration from (2).
(3) is simple enough, just a standard HMENU with TMENU + stdWrap to
build an id attribute like 'id="menu_item_356" where '356' is the uid
of the page in question. (1) and (2) combine by using HMENU/TMENU +
stdWrap to build an IMG_RESOURCE cObject (i.e. just the path to a
GIFBUILDER image) something like 'typo3temp/GB/foo.gif,' and then
including that in a CSS declaration something like this:
/* Dynamic CSS for "Foo" menu item */
#menu_item_356 a {
background-image:url(typo3temp/GB/foo.gif);
background-position:0 0
/* Etc… */
}
To give a further idea of how well this works in TYPO3, the 'menu' of
CSS declarations shown above is output to a page in the BE that's
configured using TS to send the appropriate headers for a CSS file and
which is linked to from the head of every page. Finally, using
RealURL, it's possible to give that page a file name making it a real
CSS document for all intents.
You can see this in use at www.typo3apprentice.com/ (look at the main
menu and the link to 'dynamic-css/style.css' in the head of the pages)
--
Christopher Torgalson
http://www.typo3apprentice.com/
More information about the TYPO3-english
mailing list