Add stdWrap support to typolinks "aTagParams"

Submitting your vote...
Rating: 5.0 of 5. 1 vote(s).
Click the rating bar to rate this item.

First create a file named "userFunc.inc" in your fileadmin folder, then fill the file with this content:

 

 

<?
class user_userFunc{ - ERROR: Line 2: Object Name String, "class" was not preceded by any operator, =<>({;Line 15: Object Name String, "class" was not preceded by any operator, =<>({
function addAttributes($content,$conf) { - ERROR: Line 3: Object Name String, "function" was not preceded by any operator, =<>({;Line 16: Object Name String, "function" was not preceded by any operator, =<>({
$aTagParams = $this->cObj->stdWrap($conf['aTagParams'], $conf['aTagParams.']); - ERROR: Line 4: Object Name String, "$aTagParams" contains invalid character "$". Must be alphanumeric or one of: "_-.";Line 17: Object Name String, "$aTagParams" contains invalid character "$". Must be alphanumeric or one of: "_-."
$content["aTagParams"].= ' '.$aTagParams; - ERROR: Line 5: Object Name String, "$content[&quot;aTagParams&quot;]." contains invalid character "$". Must be alphanumeric or one of: "_-.";Line 18: Object Name String, "$content[&quot;aTagParams&quot;]." contains invalid character "$". Must be alphanumeric or one of: "_-."
$content['TAG'] = '<A HREF="'.$content["url"].'"'.$content["targetParams"].$content["aTagParams"].'>'; - ERROR: Line 6: Object Name String, "$content['TAG']" contains invalid character "$". Must be alphanumeric or one of: "_-.";Line 19: Object Name String, "$content['TAG']" contains invalid character "$". Must be alphanumeric or one of: "_-."
return $content['TAG']; - ERROR: Line 7: Object Name String, "return" was not preceded by any operator, =<>({;Line 20: Object Name String, "return" was not preceded by any operator, =<>({
} - ERROR: Line 8: An end brace is in excess.;Line 21: An end brace is in excess.
} - ERROR: Line 9: An end brace is in excess.;Line 22: An end brace is in excess.
?> - ERROR: Line 10: Object Name String, "?" contains invalid character "?". Must be alphanumeric or one of: "_-.";Line 23: Object Name String, "?" contains invalid character "?". Must be alphanumeric or one of: "_-."

 

Then at the top of your typoscript SETUP, you insert a line like this:

 

includeLibs.userFunc= fileadmin/userFunc.inc

 

 

Now you are ready to use the function in your "typolink" setups, where you add it to your existing typolink code like this:

 

typolink.userFunc = user_userFunc->addAttributes
typolink.userFunc.aTagParams.dataWrap = alt="{field:title}" title="{field:title}"

 

The extra "aTagParams" are then added to the normal "aTagParams"

 

This snippet was submitted by Peter Klein


Top 10 Updates

Using Transparent PNG's in IE5/6 without JavaScript geändert am  04-Oct-2008 12:27:15
Using lightbox without extension geändert am  13-Jun-2008 14:20:51
Custom field for GMENU alt text geändert am  13-Jun-2008 13:58:07
Extending typoscript properties with stdWrap geändert am  13-Jun-2008 13:54:32
Create menus using data from other tables than "pages" V2  geändert am  24-Mar-2008 13:02:09
Login geändert am  17-Mar-2008 12:47:52
Forum geändert am  17-Mar-2008 10:07:47
Who is Typo3wizard.com geändert am  26-Dec-2007 16:07:32
Menu as un-nested lists (iphone navigation) geändert am  29-Oct-2007 15:05:53
IF Conditions with AND and OR operators geändert am  16-Oct-2007 19:16:04
Deutsch
Search: