[Typo3-dev] Templa Voila Named Typoscript Object Hack

davmor (nospam please) dmoring at hotmail.com
Tue Jan 18 17:53:33 CET 2005


OK, so Roger and Kasper are way smarter than I ever am, but here is a 
hack that I added to TemplaVoila that keeps you from having to break into 
the XML  code all the time to map to your ts.objects. (Perhaps there is 
even another way already???)

Overview:
Two hacks to make you Templa Voila life easier--this is open source, no 
warranty, no promise, etc. But it works for us.

The Hacks:

Open up the typo3conf/ext/templavoila/cm1/index.php file and add the 
following lines at the following line numbers (maybe someone add this to 
CVS tree???): 

index.php: line 1828
Add:
==>
 					<option value="NamedTypoScriptObject"'.
($insertDataArray['tx_templavoila']['eType']=='NamedTypoScriptObject' ? 
' selected="selected"' : '').'>Named TypoScript Object Path</option>';
==>

index.php: line 2133
Add:
==>
 						case 'NamedTypoScriptObject':
							unset($elArray[$key]
['TCEforms']['config']);
							//clean up the title
							$objpathname = trim(str_replace
(" ", "_", "$elArray[$key]['tx_templavoila']['title']"));
							$elArray[$key]
['tx_templavoila']['TypoScriptObjPath'] = $elArray[$key]
['tx_templavoila']['eType_EXTRA']['objPath'] ? $elArray[$key]
['tx_templavoila']['eType_EXTRA']['objPath'] : 'lib.'.$objpathname;
						break;
==>

Usage

You will now have a new element editing type ("Named TypoScript Object 
Path"). This editing type is simple, it takes the name of the element 
(replaces spaces with underbars and trims it) and appends it to "lib.". 
So if you have an element named "menu_1", it will be mapped to the 
TypoScript object named "lib.menu_1". Likewise, and element named "foo 
obj" will be mapped to "lib.foo_obj". This is cool because you no longer 
have to change the lib.myObject in the XML again when you add new 
elements with the wizard.

Thanks:
So much thanks for everyone's work...maybe see you at the Snowboard next 
year, if I have a good year...

--d




More information about the TYPO3-dev mailing list