Fluid - Get Pagetitle in Link - typo3

i need the Pagetitle from the actual Page in an Link. Like this:
index.php?var=Pagetitle.
But how can do this?
This is my Code
<f:link.page pageUid="{field.link}" additionalParams="{title}">Further Informations</f:link.page>

Using the VHS Viewhelper you can do something like this:
<f:link.page pageUid="123" additionalParams="{title : {vhs:page.info(pageUid : 123, field: 'title')}}">
Additional Information
</f:link.page>
Mind you the title will not be urlencoded..

Related

Override page title when logged in - TYPO3

I have TYPO3 8.7.7. with fluid_styled_content.
I want to change the the title of the login page from 'login' to 'logout' (subtitle) when the user is logged in. With TYPO3 7.6.x I used the following snippet successfully
[loginUser = *]
temp.mainnav.2.NO.stdWrap.override.cObject = TEXT
temp.mainnav.2.NO.stdWrap.override.cObject {
value = subtitle
if.value.field = uid
## ID of the login page
if.equals = 22
}
temp.mainnav.2.CUR.stdWrap.override.cObject <lib.mainnav.2.NO.stdWrap.override.cObject
[global]
Now I have always the same title.
Sorry that I don't have the solution for TS, but here is how I did for this situation. I create 2 pages, one for Login (show at any login) and the other for Logout (hide at login).
You could use fluid in this instance:
<f:security.ifAuthenticated>
<f:then>
Logout
</f:then>
<f:else>
Login
</f:else>
</f:security.ifAuthenticated>

TYPO3 index_search no markup result in FLUID/ExtBase

In default indexsearch extension i have highlighted keywords in search result, but when i use FLUID version it not work, I find that are different function it Controller, witch prepared description for default template and for FLUID.
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
452 line --- prepared for FLUID
$resultData['description'] = $this->makeDescription(
$row,
(bool)!($this->searchData['extResume'] && !$headerOnly),
$this->settings['results.']['summaryCropAfter']
);
(bool)!($this->searchData['extResume'] && !$headerOnly) shoud give 'false' but didn't. I check ts extResume = 1 and headerOnly = false. So it seems to be wrong construction?
When replace the (bool)!($this->searchData['extResume'] && !$headerOnly) to false. I get murkups but also i needed change output format in fluid template
from ---
...
<f:if condition="{row.headerOnly} == 0">
<p class="tx-indexedsearch-description">{row.description}</p>
...
to -----
...
<f:if condition="{row.headerOnly} == 0">
<p class="tx-indexedsearch-description"><f:format.html>{row.description}</f:format.html></p>
...
Now it work, but i still don't understand why it not work by default?
There is an alternative Method:
In the Searchform define a hidden Field: (Resource/Private/Partials/Form.html)
<f:form.hidden name="search[extResume]" value="1" />
In Searchsresult.html i would use format.raw instead of format.html.
<p class="tx-indexedsearch-description"><f:format.raw>{row.description}</f:format.raw>
I think its a bug - I already created a bugreport for this.
https://forge.typo3.org/issues/77682
Maybe you can provide a patch and push it to the review-system - that would be very helpful!

Add Data attributes in typoscript to a link

i have a question regarding typoscript. I am new to typo3 and i am just looking into things.
I know i can do something like this in typoscript:
stdWrap.htmlSpecialChars = 1
ATagTitle.field = title
is it possible to put in a data-attribute to the a tag as well? Something like this:
ATagData.field = data-toggle="hover"
If you have a TEXT object, then you should take a look at »typolink« and »ATagParams« (eg: »typolink.ATagParams = class="foo"«)
Since you posted »ATagTitle« I know that you work with a navigation object. In there you may use »ATagParams« as well:
ATagParams = data-toggle="hover"
See reference for TypoScript TMENU items: http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/Tmenuitem/Index.html?highlight=atagparams

Typo3: How to use title of header_link field as link text?

using Typo3 6.1, I'd like to be able to add a link with an editable caption to the end of each content element, linking to some related page. My approach was to (mis)use the header_link field for that. I removed the typolink from the headline and added the link after the content.
# something like:
20.text.20.append {
if.isTrue.field = header_link
value = more...
typolink.parameter.field = header_link
wrap = <div class="button">|</div>
}
To be able to use different captions for each link (instead of "more..."), I hoped to use the title property of the typolink since it can easily be set in the backend. Is this possible? Or is there a more reasonable way to achieve this?
The most straightforward way would probably be adding a new link field and a title field for that link by building a custom extension just for that purpose (adding the fields to BE and Database). Then editors can fill in these fields in the same tab and you can access them with typoscript.
You can use COA with new Object
100.value = more
100.wrap = <div class="button">|</div>
100.typolink ...
or use wrapper existing element
stdWrap.typolink {
wrap = <div class="linkwrap">|</div>
parameter.insertData = 1
parameter = {field:header_link}
ATagParams = class="headerLink"
ATagBeforeWrap = 1
}

Evo Pdf - Page numbering from within HTML

I know it is possible to render "Page X of Y" in a header/footer using the C# API like this:
//write the page number
TextElement footerText = new TextElement(0, pdfConverter.PdfFooterOptions.FooterHeight - 15, "This is page &p; of &P; ",
new System.Drawing.Font(new System.Drawing.FontFamily("Times New Roman"), 10, System.Drawing.GraphicsUnit.Point));
footerText.EmbedSysFont = true;
footerText.TextAlign = HorizontalTextAlign.Right;
pdfConverter.PdfFooterOptions.AddElement(footerText);
..but i'd rather position and style it directly in html using:
HtmlToPdfElement footerHtml = new HtmlToPdfElement(pdfOptions.DocumentFooterHtmlString, pdfOptions.BaseUrl);
footerHtml.FitHeight = true;
pdfConverter.PdfFooterOptions.AddElement(footerHtml);
where pdfOptions.DocumentFooterHtmlString looks something like this:
<div class="clearfix">
<span class="pull-right">This is page &p; of &P;</span>
</div>
Is this something that is possible? If I try this I just get the: This is page &p; of &P; rendered in the footer.
I struggled with this briefly. For the sake of others who find this through search, the trick is that when you add the HTML element, it has to be a HtmlToPdfVariableElement instead of a HtmlToPdfElement.
HtmlToPdfVariableElement footerHtml = new HtmlToPdfVariableElement(pdfOptions.DocumentFooterHtmlString, pdfOptions.BaseUrl);
footerHtml.FitHeight = true;
pdfConverter.PdfFooterOptions.AddElement(footerHtml);
It looks like you can do this. See http://www.evopdf.com/demo/PDF_Creator/Headers_and_Footers/Page_Numbers_in_HTML.aspx
In the sample code Evo Provides they use HtmlToPdfVariableElement.