문제

I'm working with the Typo3 6.1 and Fluid templates, using the fedext.net set of tools. I have the content element back-end template defined like this:

{namespace flux=Tx_Flux_ViewHelpers}
{namespace v=Tx_Vhs_ViewHelpers}
<f:layout name="Content" />
<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:flux="http://fedext.net/ns/flux/ViewHelpers"
     xmlns:v="http://fedext.net/ns/vhs/ViewHelpers"
     xmlns:f="http://fedext.net/ns/fluid/ViewHelpers">

...

<flux:flexform.object name="item">
    <flux:flexform.field.input name="url">
        <flux:flexform.field.wizard.link />
    </flux:flexform.field.input>
</flux:flexform.object>

And then I'm rendering it in the front-end like this

<f:link.external uri="{section.item.url}">
    {section.item.url}
</f:link.external>

And the problem is that link backend wizards allows user to set the links like http://www.google.com/ _blank - Google which stands for href target css-class title and that ends up in the following front-end HTML render:

<a href="http://www.google.com/ _blank - Google">
    http://www.google.com/ _blank - Google
</a>

I wonder is there already any ViewHelper which allows to render link widget data properly? Or I should implement one myself? I already checked these docs:

and I've sticked to the first one, but it is a bit simpler than what I really need. Probably there is also a ViewHelper which can split the link data by space character and then I can render the link but sound like a not reliable work-around.

도움이 되었습니까?

해결책

The simple answer is that flux and fluidcontent themselves dont provide a ViewHelper for those.

You have to use a foreign ViewHelper like this one . I added a variant of it to the VHS ViewHelper collection extension. Similar to the fluid core, we added 2 new ViewHelpers to the VHS companion extension (v:link.typolink & v:uri.typolink):

After installing it, import the Namespace to your Template like this:

{namespace v=Tx_Vhs_ViewHelpers}

and use it in your template:

<v:uri.typolink parameter="{parameter: section.item.url}" />

That should do the trick.

Additionally, as this only renders the uri generated by typolink, there's a second very similar ViewHelper in vhs you can use to generate links:

<v:link.typolink parameter="{parameter: section.item.url}">Beautiful link</v:link.typolink>

Thx to kimomat for pointing this out in the answer below.

다른 팁

If i render the example in a fluidcontent Main Section (TYPO3 6.2, VHS 1.9.1, Fluidcontent 4.0.0) the ViewHelper only outputs the link url, no link.

<p><v:uri.typolink configuration="{parameter: '13', additionalParams: '&print=1', title: 'Follow the link'}">Click Me!</v:uri.typolink></p>

This code will render:

<p>/products/?print=1</p>

The PageUid 13 is the products page. I would have expected a a tag.

Ok, i got it. I need the ViewHelper v:link.typolink:

<v:link.typolink configuration="{parameter: '13', additionalParams: '&print=1', title: 'Follow the link'}">Click Me!</v:link.typolink>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top