[TYPO3-english] Menu with picture, multiple wraps and real url. Problem: replace spaces with "-"

Brian Hauge Hansen b.hansen at mobilethink.com
Sun Oct 23 12:58:28 CEST 2011


Hi list

I'm trying to create a menu that include some span's and a subtitle:

<ul id="sdt_menu" class="sdt_menu">
<li>
<a href="http://basic.brianhauge.dk/the-club">
<img src="uploads/media/2.jpg" width="170" height="170" border="0" alt="" />
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">The club</span>
<span class="sdt_descr">About the club</span>
</span>
</a>
</li>
<li>
<a href="http://basic.brianhauge.dk/other">
<img src="uploads/media/2.jpg" width="170" height="170" border="0" alt="" />
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">Other</span>
<span class="sdt_descr">Some other page</span>
</span>
</a>
</li>
…
</ul>

Ive tried to realize this with the following typoscript, which build realurl links. But my problem comes with links (title) that has spaces in them. How can I replace the spaces with "-" ?

Ex: The club, should be "the-club" and not "the club". Triede to use replaceString an the space:


## Menu [Begin]
lib.mainMenu = HMENU
lib.mainMenu.entryLevel = 0
lib.mainMenu.wrap = <ul id="sdt_menu" class="sdt_menu">|</ul>

lib.mainMenu.1 = TMENU
lib.mainMenu.1.NO {
stdWrap.cObject = COA
stdWrap.cObject {
10 = TEXT
10.field = title
10.wrap := replaceString( |-)
10.case = lower
10.wrap = <li><a href="{$site.url}/|">
20 = IMAGE
20.file.import = uploads/media/
20.file.import.field = media
20.file.import.listNum = 0
30 = TEXT
30.value = <span class="sdt_active"></span><span class="sdt_wrap"><span class="sdt_link">
40 = TEXT
40.field = title
}
doNotLinkIt = 1
stdWrap.wrap = |*| | |*|
after.data = field:subtitle
after.wrap = </span><span class="sdt_descr">|</span></span></a></li>
}
## Menu [End]

--
Best Regards / Med venlig hilsen
Brian Hauge Hansen


More information about the TYPO3-english mailing list