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.
Related
This is very similar to my question Counter for mask elements in a TYPO3 column
I need to pass a variable (in my case, the value of cObj:parentRecordNumber which is the counter for the current item in it's column) to the template.
In the main page template:
<f:cObject typoscriptObjectPath="lib.content.pageteasers" />
In typoscript:
lib.content {
pageteasers < styles.content.get
pageteasers {
select {
where = colPos=2
max = 8
}
// this passes the variable elementCounter to the fluid template of the rendered mask content element:
renderObj.mask_teaser {
variables {
elementCounter = TEXT
elementCounter.value = {cObj:parentRecordNumber}
elementCounter.insertData = 1
}
}
// this should pass the same value to a rendered tx_news plugin:
variables {
elementCounter = TEXT
elementCounter.value = {cObj:parentRecordNumber}
elementCounter.insertData = 1
}
// it doesn't. what about these trial & error:
renderObj.list < .variables
renderObj.plugin.tx_news < .variables
renderObj.list.20.news_pi1 < .variables
renderObj.news_pi1 < .variables
// none of these seem to work either
}
}
And then in the rendered CE template (News/List.html)
<f:debug title="" inline="1">{_all}</f:debug>
I don't manage to see the above variable in here. What is the correct way to pass the variable from TS to the news fluid template?
PS Another try was using the Good Old Register
pageteasers < styles.content.get
pageteasers {
select {
where = colPos=2
max = 8
}
append = LOAD_REGISTER
append {
elementCounter = TEXT
elementCounter.value = {cObj:parentRecordNumber}
elementCounter.insertData = 1
}
}
And in the template:
{v:variable.register.get(name: 'elementCounter')}
but that is NULL
Your try via register could work. But you have to care, where you are doing what...
Registers
LOAD_REGISTER is of type string/stdWrap and not a cObject per definition. If you wanna use content based on a cObject, you can declare this via the stdWrap-property (as shown in the examples):
1 = LOAD_REGISTER
1.param.cObject = TEXT
1.param.cObject.stdWrap.data = GP:the_id
So, in your case it should like:
elementCounter.cObject = TEXT
elementCounter.cObject.data = cObj:parentRecordNumber
Appending at the right place
You are trying to use append directly as a property of pageteasers (which is a copy of styles.content.get which is of type CONTENT.
CONTENT does not have an append-property. In addition, you would put the register in front of the entire content, not the individual content elements.
=> It's needed as part of the renderObj, so it's rendered per CE.
The renderObj of CONTENT is of type CASE, which also has no stdWrap-properties directly. But it has a property stdWrap with stdWrap-properties...
Conclusion
So, you can end up with this snippet:
lib.content {
pageteasers {
renderObj {
stdWrap {
append = LOAD_REGISTER
append {
elementCounter.cObject = TEXT
elementCounter.cObject.data = cObj:parentRecordNumber
}
}
}
}
}
I’m looking for a way to get all checked checkbox-values from a field in a powermail form. I can access single values from the array in my typoscript template with
data = GP:tx_powermail_pi1|field|marker|index.
Is there a way to interate over the array when I don't know the number of checkboxes (dynamically filled) or to serialize the array? I am not experienced with typoscript or powermail but allready tried to find a solution for quite some time.
What i am trying to achieve ist to have a multiselect field for people to send the mail to that gets populated from fe_users.
The relevant code from the typoscript template that overwrites the receiver is:
plugin.tx_powermail {
settings {
setup {
receiver {
enable = {$plugin.tx_powermail.settings.receiver.enable}
overwrite {
email = COA
email {
10 = CONTENT
10 {
table = fe_users
select {
pidInList = 8689
where {
# UID of the fe_users record is given in field with marker {fragegehtan}
data = GP:tx_powermail_pi1|field|fragegehtan|0
wrap = uid=|
intval = 1
}
}
renderObj = COA
renderObj {
10 = TEXT
10.field = email
stdWrap.wrap = |,
}
}
}
}
}
}
}
}
This is supposed to create a comma separated list of uids of all selected fe_users. Ist there any advice how to do it?
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)
I'm trying to set in my TYPO3 instalation <title> tag based on td_calendat content element title.
Database name with title - tx_tdcalendar_events
Field with title in db - title
My code looks like this but it didn't work - it display only empty <title> tag
lib.eventTitle = COA
lib.eventTitle {
10 = RECORDS
10 {
source = {GP:tx_tdcalendar_events|td_calendar}
source.insertData = 1
tables = tx_tdcalendar_events
conf.tx_tdcalendar_events >
conf.tx_tdcalendar_events = TEXT
conf.tx_tdcalendar_events.field = title
}
wrap = <title>|</title>
}
page.config.noPageTitle = 2
page.headerData.10 >
page.headerData.10 < lib.eventTitle
Any suggestions?
Change this:
source = {GP:tx_tdcalendar_events|td_calendar}
To this:
source = {GP:tx_tdcalendar_pi1|event}
You are transfering data in your link as tx_tdcalendar_pi1 variables, you need to use "event" id to get the correct event title.
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.