[TYPO3-mvc] Typolink extbase fluid

Georg Ringer typo3 at ringerge.org
Mon Nov 28 07:12:22 CET 2011


Hi,

Am 25.11.2011 17:18, schrieb Matt Janus:
> Thanks for all your help and guidance with this!!
>
> I was still having issues getting external links to open in a new
> window/tab. I did a bit of hunting around and came across an idea in
> another post. This was to use conditions to kind of evaluate if the
> link was a number i.e less than 10000 (my site has way less pages!!).

don't do such things, there are so many headaches I got with it (you 
can't use this template in other systems and so on).

A way how I did it in projects:
Link is set in BE using the wizard and therefore the editor can set the 
target there on his own and the field contains something like 123 _blank.

so all i did is this viewhelper:
-------------
class Tx_FoBanner_ViewHelpers_TargetLinkViewHelper extends 
Tx_Fluid_Core_ViewHelper_AbstractViewHelper {

	/**
	 * @param string $link
	 */
	public function render($link) {
		return (strpos($link, ' _blank') === FALSE) ? '' : '_blank';
	}
}
---------------


and called it in the template
---------
<f:link.page pageUid="{teaser.link}" 
target="{bv:targetLink(link:teaser.link)}">
---------

georg


More information about the TYPO3-project-typo3v4mvc mailing list