How-to create dynamic XML for Flash menu based on TYPO3 pagetree
Русская версия статьи / Russian version
TYPO3 features not limited to HTML pages, you can provide user with any type of web content. It’s absolutely not required to install special extension for XML-based content, but there are lots of them in TYPO3-repository.
I not like use extensions, if there exists TYPO3-solution with typoscript. Here I will provide example how to generate XML with pagetree data for Flash menu. Using this technique you can crate any type of XML-data, Google Sitemaps, WML, etc.
XML for Flash menu application looks something like this:
1 2 3 4 5 6 7 8 9 10 11 | <?xml version="1.0" encoding="UTF-8"?> <menu> <item url="index.php?id=1" title="Page 1" /> <item url="index.php?id=2" title="Page 2" /> <item url="index.php?id=3" title="Page 3"> <item url="index.php?id=4" title="Page 3-1" /> <item url="index.php?id=5" title="Page 3-2" /> <item url="index.php?id=6" title="Page 3-3"> </item> <item url="index.php?id=7" title="Page 4"/> </menu> |
Typoscipt for generating this XML:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ######################################## # PAGETREE TO XML ######################################## xmlmenu = PAGE xmlmenu.typeNum = 111 # Disable all standard header generation by TYPO3 xmlmenu.config.disableAllHeaderCode = 1 # Setup correct content type header for XML xmlmenu.config.additionalHeaders = Content-Type: application/xml # Output XML header xmlmenu.10 = TEXT xmlmenu.10.value = <?xml version="1.0" encoding="UTF-8"?> xmlmenu.10.postCObject = TEXT xmlmenu.10.postCObject.char = 10 # Output XML data of pagetree xmlmenu.20 = HMENU xmlmenu.20 { wrap = <menu>|</menu> entryLevel = 0 1 = TMENU 1 { expAll = 1 NO { doNoShowLink = 1 allStdWrap.cObject = COA allStdWrap.cObject.10 = TEXT allStdWrap.cObject.10.typolink.parameter.field = uid allStdWrap.cObject.10.typolink.returnLast = url allStdWrap.cObject.10.noTrimWrap = |<item url="|" | allStdWrap.cObject.20 = TEXT allStdWrap.cObject.20.field = nav_title // title allStdWrap.cObject.20.wrap = title="|"/> } # We need too surround subitems with <item></item> IFSUB < .NO IFSUB = 1 IFSUB { # Added closing </item> wrapItemAndSub = |</item> # Raplace <item ... /> with <item ...> allStdWrap.cObject.20.wrap = title="|"> } } 2 < .1 3 < .1 4 < .1 5 < .1 } |
Flash application can now access XML data with address “index.php?type=111″
You can add content output into TYPO3 if required, and use this for Full Flash sites and use TYPO3 as your backend.
So, no extensions, just TYPO3 and typoscript…
P.S.: Dear, Readers, if you interested in English versions of articles about TYPO3 and TYPO3 snippets please let me know. Leave comments in my blog.
One Response to “How-to create dynamic XML for Flash menu based on TYPO3 pagetree”
Leave a Reply










Создаем XML дерева страниц TYPO3 для Flash меню at Codeline on May 22nd, 2008
[...] English version / Английская версия статьи [...]