TYPO3 : editing page title - typo3

I try to get page title and edit it like on the following example.
Page name My tools
Final string my_tools (Thus, I will be able to use it through markers in my css classes)
I know how to get page title using:
HEADERTITLE = TEXT
HEADERTITLE.data = page : title
But how can I transform this string?
Thank you for your help!

to convert the case and replace some characters you may use these TypoScript settings:
HEADERTITLE = TEXT
HEADERTITLE {
data = page:title
### replace whitespace
replacement.10 {
search = #\s#i
replace = _
useRegExp = 1
}
/*
### replace all special characters
replacement.10 {
search = #\W#i
replace =
useRegExp = 1
}
*/
### transform string to lowercase
case = lower
}

Related

TYPO3 typoscript if condition based on site language

My typo3 version is 11.5.10.
I have two footer images, one for German and one for English .
I want to render different image for different language.
I tried this way for German language.
[siteLanguage("locale") == "de_DE"]
50 = COA
50 {
wrap = <div class="footer__item col-sm-6 col-md-3 img-custom">|</div>
stdWrap {
typolink {
parameter = {$myconstant.footer-logo-link-4}
parameter.noTrimWrap = || _blank|
}
}
50 = IMAGE
50 {
file = user_uploads/german-footer.png
layoutKey = srcset
layout.srcset {
element = <img WIDTH###" SOURCECOLLECTION###" ###PARAMS### ###ALTPARAMS### ###SELFCLOSINGTAGSLASH###> }
}
}
[end]
And for English language.
[siteLanguage("locale") == "en_US"]
50 = COA
50 {
wrap = <div class="footer__item col-sm-6 col-md-3 img-custom">|</div>
stdWrap {
typolink {
parameter = {$myconstant.footer-logo-link-5}
parameter.noTrimWrap = || _blank|
}
}
50 = IMAGE
50 {
file = user_uploads/english-footer.png
layoutKey = srcset
layout.srcset {
element = <img WIDTH###" SOURCECOLLECTION###" ###PARAMS### ###ALTPARAMS### ###SELFCLOSINGTAGSLASH###> }
}
}
[end]
In both language FE i get English-footer.
I also tried Different function of siteLanguage like
siteLanguage("navigationTitle")
siteLanguage("locale")
siteLanguage("hreflang") etc..
What i am doing wrong ?
Thanks in advance!
I get the following error in Typoscript Object Browser
Errors and warnings
Warning : Line 5696: Object Name String, "[siteLanguage" contains invalid character "[". Must be alphanumeric or one of: "_:-/." Show details
Warning : Line 5718: Object Name String, "[END]" contains invalid character "[". Must be alphanumeric or one of: "_:-/." Show details
Warning : Line 5719: Object Name String, "[siteLanguage" contains invalid character "[". Must be alphanumeric or one of: "_:-/." Show details
Warning : Line 5741: Object Name String, "[END]" contains invalid character "[". Must be alphanumeric or one of: "_:-/." Show details
In general, you should avoid conditions whenever possible. Conditions are evil!
Conditions are checked for each and every page request - before any cached content is touched. extensive use of conditions will be a performance killer.
For more details, search for "typo3 condition performance"
Using TypoScript if
A better way would be using the if-function, which is cachable, in combination with getText siteLanguage.
page.10 = TEXT
page.10.data = siteLanguage:languageId
page.10.stdWrap.wrap = <p>siteLanguage:languageId=|</p>
page.20 = IMAGE
page.20 {
if.value = 1
if.equals.data = siteLanguage:languageId
file = EXT:example/Resources/Public/typo3_package_de.png
}
page.30 = IMAGE
page.30 {
if.value = 0
if.equals.data = siteLanguage:languageId
file = EXT:example/Resources/Public/typo3_package_en.png
}

powermail should update a `pages`-field

I want to use powermail (7.4.0) to give special page visitors the option to modify a field in the current pages record.
my setting so far:
plugin.tx_powermail.settings.setup {
dbEntry {
1 {
_enable = TEXT
_enable.value = 1
_table = TEXT
_table.value = pages
uid = TEXT
uid.data = TSFE:id
description = TEXT
description.field = abnahmestatus
}
}
prefill {
abnahmestatus = TEXT
abnahmestatus.data = TSFE:description
}
}
How can I get powermail to update the record (instead of inserting)?
How can I prefill the input field with the current value from the pages field?
Answer 1: update instead of insert:
I missed the line
_ifUnique.uid = update
from the manual example.
Answer 2:
I inserted {abnahemstatus} which was not helpfull as it overwrote the typoscript prefill. so:
no value in prefill_value of the field definition
the correct definition is abnahmestatus.data = page:description (TSFE is obsolete)

Solr Indexing - Manipulating the search result

I am working with the TYPO3 Solr extension and I have some doubts regarding the solr result set manipulation.
I have added a special configuration for indexing some particular pages in my page tree. ie Pages that starts with the label "Expertise%" .I have managed to added this successfully . And the indexing is working successfully with our any trouble. But what I would like to achieve is that , I want to added parent page title to the search result.i.e
This is the page tree
|---- 1.00.100 (parent page)
|--Subpage 1
|--Subpage 2
|--Expertise
|--Test page`
And in the solr search result should be
1.00.100 - Expertise
Is this possible in TYPO3 Solr. Is there any hook or signalslot available to implement this?
Tried this ,But doesn't seems to work for me ?
plugin.tx_solr.index.queue.expertise_offered = 1
plugin.tx_solr.index.queue.expertise_offered {
table = pages
additionalWhereClause = doktype = 1 AND no_search = 0 AND title LIKE '%Expertise offered%'
fields {
title = title
content = CONTENT
parentPageTitle_stringS = CONTENT
parentPageTitle_stringS {
table = pages
select {
selectFields = title
where = uid = ###pid###
}
markers {
pid.data = field:pid
}
}
content {
table = tt_content
select {
selectFields = header, bodytext
}
renderObj = COA
renderObj {
10 = TEXT
10.field = header
# This removes HTML tags
11 = SOLR_CONTENT
11.field = bodytext
}
}
url = TEXT
url.typolink.parameter = TEXT
url.typolink.parameter.field = uid
}
}
You probably don't need any hook or signal-slot. You can do it as follows:
Add the title of the parent page to your indexing configuration. There is no field for it, but you can dynamically add fields to SOLR documents. This is done by sending the data in a field which has a certain suffix, which determines the field type.
For example: Setting the field parentPageTitle_stringS to the parent pages title in the indexing configuration creates a new stored, single-valued field of type string in the indexed document.
Filling this field could look like this:
plugin.tx_solr {
index {
queue {
<yourindexconfigname> = 1
<yourindexconfigname> {
table = pages
fields {
parentPageTitle_stringS = CONTENT
parentPageTitle_stringS {
# Build a query here to retrieve
# the parent page title.
}
}
}
}
}
}
In your template for search results, you can use the marker ###RESULT_DOCUMENT.parentPageTitle_stringS### to retrieve the field.
The available field types can be found in EXT:solr/Resources/Solr/typo3cores/conf/general_schema_fields.conf from line 157 onwards (refering to version 3.0.0 here).
You should of course use a type other than string if you want to have the result indexed nicely.

How can I create a link to a specific, known page using TypoScript?

I am working on some Typo3 6.2 templates. I want to insert a link into the template using Typoscript.
I have a constant {$HOME_SHORTCUT}, which has the title "Startseite" & the path /start. I want the link to look like this:
Startseite
I am using this to insert the link before a set of breadcrumbs. The link path is correct but the value/text of the link is the pageID of {$HOME_SHORTCUT}, not the header text, which is what I want:
stdWrap.prepend = TEXT
stdWrap.prepend {
value = {$HOME_SHORTCUT} ###HOW DO I USE THE TITLE OF THE PAGE AS THE VALUE?####
stdWrap.typolink {
field = header
parameter = {$HOME_SHORTCUT}
}
}
This outputs:
146
Which is incorrect. That's the page ID, not the header. How do I get the header of {$HOME_SHORTCUT}?
When you leave out the "value" the page title is set automatically:
stdWrap.prepend = TEXT
stdWrap.prepend.typolink.parameter = {$HOME_SHORTCUT}
Following along with this answer, I constructed this, which gives the desired mark-up:
stdWrap.prepend = TEXT
stdWrap.prepend {
value {
table = pages
select {
where = uid = {$HOME_SHORTCUT}
}
renderObj {
10 = TEXT
10 {
field = title
wrap = |
}
}
}
stdWrap.typolink {
field = header
parameter = {$HOME_SHORTCUT}
}
}
Which seems like a really, really long-winded way of saying "Wrap this page title with a link to this page"- I am definitely interested in hearing of better methods.

Custom pages number (roman numbering) on pdf first pages

I need to set page numbers on a pdf I'm creating, so that the first 3 pages would be i,ii,iii and then the following pages starting from 1,2,3,4,5...and so on..
How can i do it with itextsharp??
Thanks
Sander
Check out the example in Massoud Mazar's blog. Look at his override for the OnEndPage event in the TwoColumnHeaderFooter class and see how he prints out page numbers.
What you can do is examine the event's PdfWriter parameter's PageNumber property and custom set the string you'll use for the displayed page number.
Something like this:
String text = "";
int pageN = writer.PageNumber;
if (pageN == 1) {
text = "i";
} else if (pageN == 2) {
text = "ii";
} else if (pageN == 3) {
text = "iii";
} else {
text = (pageN - 3).ToString();
}
Would replace his original:
String text = "Page " + pageN + " of ";