[TYPO3] TS for specific [news, or other] content elements / grabbing data from tt_news content elements?
Kathryn Blair
artscoop at mail.arts.ubc.ca
Mon Jun 30 20:01:49 CEST 2008
Hi Tyler,
No, that's not what I need.
There's a chance I don't fully understand your solution, but it seems like
that's essentially what I'm doing here (placing a new instance of tt_news
and adding some new typoscript configuration to it). I did include this ts
snippet in my last email.
> dates.40 < plugin.tt_news
> dates.40 {
> code >
> code = LIST
> pid_list >
> pid_list = 865, 289
> useSubCategories=1
> displaySubCategories = 1
> catTextMode = 3
> categorySelection=488
> categoryMode = 2
>
>
templateFile=fileadmin/Arts_Co-op/templates/news_templates/arts-co-op-headli
> nes.tmpl
> }
This works, I get what I need to see, but *that's not the problem*. The
problem is that this content element does not exist in tt_content and
therefore can't be edited in the back end like a normal news content element
that was simply inserted into a page. You see? You can set a lot of these
typoscript settings from the tt_news content element wizard itself. This is
obviously way easier for people who don't know typoscript, like the people
I'm going to be handing this site to when I finish it. I want to let them
choose the categories that this news element will display, change the title
of the element, stuff like that. So I want to get these settings from a
specific content element in the tt_content db with ctype=news and a specific
uid. I don't think the snippet you just gave me will let me do that
(dates.60.renderObj =< plugin.tt_news) because plugin.tt_news Is just the
normal blank plugin settings, not the specific ones in a given content
element.
Another potential solution would be something like this (assuming I can use
data for these options):
dates.40 < plugin.tt_news
dates.40 {
code >
code.data = DB:tt_content:1316:CType
}
But there are two reasons problems I'm having:
- some of the settings I'd want to grab from the content element don't have
a data type of stdwarp - but several do, so that might work out OK.
- more importantly, I can't figure out where I could get this data (code,
categories, etc) from. Does anyone have experience with this?
Here's the short version of what I want to do, to hopefully clarify a bit
more for you, Tyler: Combine typoscript configuration set in a tt_news
content element record with custom ts configuration that will only affect a
specific instance of plugin.tt_news.
Thanks a lot, if anyone knows where that data is stored, please let me know.
Also, sorry for leaving the wrong subject in my last message.
Kath
__________________________________________________________________
Well I don't know exactly what is happening as I can't see exactly what
your wanting to do. But from looking at the TSOB I can see that both
tt_content.list.20.9.0 and tt_news import plugin.tt_news
So I suspect that if you add this line
dates.60.renderObj =< plugin.tt_news
you can then have it selected and rendered as is by default. But it
should afaik then also allow you to alter the
display/setting/parameters/(what ever term you want to use) for that one
item only. So what you define by plugin.tt_news.XXX would become
dates.60.renderObj.XXX
So I'm guessing (but I suspect) that
dates.60.renderObj =< plugin.tt_news
dates.60.renderObj.templateFile =
fileadmin/Arts_Co-op/templates/news_templates/arts-co-op-headlines.tmpl
Might start to help you.
hth
Kathryn Blair wrote:
> Hi Tyler,
>
> I'm not totally sure what you mean. If you mean that I can just pull the
> content object and render it, yes, I can. But I can't edit any of the
> tt_news typoscript options for it separately from the rest of tt_news
> because (the way I understand it) tt_news doesn't 'know' it's part of the
> other content object I used and won't recognize the ts I try to attach to
> it. For example, this TS that I sent earlier does grab the content element
> in question:
>
> dates.60=CONTENT
> dates.60.table = tt_content
> dates.60.select.pidInList=879
> dates.60.select.uidInList=1316
> dates.60.select.wrap = <div class="important-dates-employers"> | </div>
>
> but adding this:
>
>
dates.60.templateFile=fileadmin/Arts_Co-op/templates/news_templates/arts-co-
> op-headlines.tmpl
>
> doesn't change the template because "dates.60" doesn't "understand"
> "templateFile" as a thing to change.
>
dates.60.plugin.tt_news.templateFile=fileadmin/Arts_Co-op/templates/news_tem
> plates/arts-co-op-headlines.tmpl also doesn't work because the syntax
> doesn't make sense.
>
> I can also grab the news items individually from the tt_news database and
> render them in sequence, but this also prevents me from using any of the
> tt_news typoscript settings, and although I can control the display really
> really well, I couldn't display news items from specific categories
because
> of how that info is stored in the db. This method is also not at all
> configurable by anybody else.
>
> As I said in my last email, I did end up finding a solution that may also
> have been what you were referring to, but it can't be configured at all by
> any means other than typoscript.
>
> dates=COA
> dates.10 = HTML
> dates.10.value=<div class="important-dates"><h3>
> dates.20=HTML
> dates.20.value.data=DB:tt_content:1316:header
> dates.30=HTML
> dates.30.value=</h3><div class="dates-inner">
> dates.40 < plugin.tt_news
> dates.40 {
> code >
> code = LIST
> pid_list >
> pid_list = 865, 289
> useSubCategories=1
> displaySubCategories = 1
> catTextMode = 3
> categorySelection=488
> categoryMode = 2
>
>
templateFile=fileadmin/Arts_Co-op/templates/news_templates/arts-co-op-headli
> nes.tmpl
> }
> dates.50=HTML
> dates.50.value=</div></div>
>
>
> I may end up using this method (creating a new instance of tt_news and
> copying it to another object, then configuring it via typoscript), but as
it
> doesn't have a 'content element' in the DB, it can only be changed by
> editing typoscript. The point of using the content element in the first
> place was so that it could be edited by the people I'm making the site for
> -- so they could pick categories, change the title of the element, etc.
> THAT'S why I need either a condition to target plugin.tt_news if it's
> content element uid is a specific value, or a way to set plugin.tt_news
> typoscript if it's displayed as part of the cObj dates.60 (as in the
example
> above). THEN I could set some of the options in the content element
> (anything I want the people working on the site to edit), and SOME via
> typoscript (anything that can't be set in the content element options, or
> things I don't want to be changed accidentally).
>
> Do you understand my problem now? At this point it's not really looking
like
> there's a solution that would actually work, which is kind of ridiculous
> because a condition to target content elements with a specific uid would
be
> really useful in other situations as well.
>
> Thanks,
>
> Kath
>
> Message: 1
> Date: Sun, 29 Jun 2008 00:11:58 +0100
> From: Tyler Kraft <tyler.kraft at netefficiency.co.uk
<http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english> >
> Subject: Re: [TYPO3] TS for specific [news, or other] content elements
> To: typo3-english at lists.netfielders.de
<http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english>
> Message-ID:
> <mailman.1.1214694859.25058.typo3-english at lists.netfielders.de
<http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english> >
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Ok well (to me at leaat) what you actually want to be doing is pulling
> out the content record using the CONTENT object and then starting to
> redefine the output/rendering of it. That way you don't actually need to
> use any condition. By default CONTENT will jsut renedr things the same
> way tt_content does, but you can define a custom rendering for it as
well...
>
> And what I'd do is for each one you build I'd move all the typoscript to
> an external file that gets referenced in (1file per 1 content/tt_news
> item) - that way once you have one working and move it to a file its
> less liekly to get accidentally 'hurt' or overwritten or altered.
>
> hth
>
>
>
> Kathryn Blair wrote:
>> Hi Tyler,
>>
>> Thanks. Sorry that I didn't explain the entire story of what I'm doing --
> I
>> only explained the specific thing I wanted (a condition to target content
>> elements by uid in tt_content). Here's the rest of the story.
>>
>> I'm working on a site that's going to have a lot of news elements
embedded
>> in the layout. Yes, I'm calling out specific tt_content records. In this
>> case they're tt_news content elements. I'm placing them in the layout via
>> typoscript. I've got that done and working beautifully. Often, multiple
> news
>> elements will be displayed on one page. These news elements will all look
>> different, so I want to set typoscript for one specific element, and not
>> have it affect any of the others. I can't use GPVars because these news
>> elements are being displayed independently of them.
>>
>> I want to do is write some typoscript that will only apply to one
specific
>> content element (so this content element with uid 1316 will have the
>> typoscript I've written for it applied, and any other content element
that
>> happens to be a tt_news element will not have the changes applied. I
don't
>> necessarily need to do this with conditions, it just seems like it might
> be
>> the most flexible thing to do, which would be easy to use to target
almost
>> anything.
>>
>> From what I gleaned reading the Conditions page of the TSREF*, globalVar
>> will match numeric values, and globalString will match characters. So if
> you
>> wanted to match pages with title "hi", you would use globalString like
> this:
>> [globalString = TSFE:page|title = hi]
>>
>> And you use global var to match numbers, like
>>
>> [globalVar = TSFE:page|uid = 332]
>>
>> So because TSFE:cObj|currentRecord prints "table:uid", I used
globalString
>> because it includes the title of the table:
>>
>> [globalString=TSFE:cObj|currentRecord=tt_content:1316]
>>
>
plugin.tt_news.templateFile=fileadmin/Arts_Co-op/templates/news_templates/ar
>> ts-co-op-headlines.tmpl
>> [global]
>>
>> But I must be either doing something wrong because I can't get that to
> work
>> in a condition, or it just doesn't work in conditions. Works for just
>> grabbing the data though.
>>
>> I also tried using .if**, but it doesn't seem like that works past just
>> rendering the object or not. So I could do:
>>
>> dates.10.if
>> .....
>>
>> and decide whether to render the object "dates.10", but I can't do
>>
>> dates.10.wrap.if
>> ....
>>
>> and determine whether or not to wrap it, so it doesn't look like that
will
>> work for the template file / other plugin.tt_news setting, because it
> would
>> have to be
>>
>> plugin.tt_news.templateFile.if
>> ....
>>
>>
>> I'm now using an alternate approach I saw here:
>>
>
http://www.typo3-jack.net/typo3-english-lists-netfielders-de/11808-typo3-how
>> -set-typoscript-specific-content-element.html
>>
>> It works, but it means that all of the options (categories, number of
> items
>> to display, etc) for the object are set via typoscript, which is not
ideal
>> because I won't be maintaining the site.
>>
>>
>> *
>>
>
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.
>> 1.0/view/4/1/
>> **
>>
>
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.
>> 1.0/view/5/7/
>>
>>
>>
>> Message: 8
>> Date: Fri, 27 Jun 2008 13:14:14 +0100
>> From: Tyler Kraft <tyler.kraft at netefficiency.co.uk
<http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english> >
>> Subject: Re: [TYPO3] TS for specific [news, or other] content elements
>> To: typo3-english at lists.netfielders.de
<http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english>
>> Message-ID:
>> <mailman.1.1214568993.5985.typo3-english at lists.netfielders.de
<http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english> >
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Hi,
>>
>> Prehaps I'm missing the idea here, but are globalVar and globalString
>> not two different things? And if you want to test for a specific news
>> record displaying wouldn't you use tx_ttnews[tt_news]=401 and do
>> something like
>>
>> [globalVar = GP:tt_news=401]
>> or
>> [globalVar = GP:tx_ttnews|tt_news=401]
>>
>> What exactly are you trying to do? (you don't really explain that here)
>> Are you wanting to draw out one specific record and place it on one
>> specific page (with out it being in the BE page content)? Can you please
>> give a better description of what you want to achieve
>>
>> Tyler
>>
>> Kathryn Blair wrote:
>>> Hi everyone,
>>>
>>> I want to be able to set separate TS for specific news content elements.
>>> I've seen some potential info inline for this, but not ones which made
it
>>> clear to me how I could adapt them to what I wanted to do.
>>>
>>> What I REALLY want to do is use a condition to target a specific news
>>> elemenet based on its uid (in tt_content). I saw an example here:
>>>
>>>
>>> [globalVar = TSFE:tt_content|uid = 37]
>>> plugin.tt_news._LOCAL_LANG.de.preAuthor = Autor:
>>> [global]
>>>
>>> The reason this doesn't work (and should be taken off that site -- if I
>> can
>>> figure out an alternate method I'll replace it) is because [globalString
> =
>>> TSFE:fe_user|user|username = test] is not basing it's true/falseness on
>> the
>>> table fe_user, but the variables in the TSFE. I don't know a lot of PHP,
>> but
>>> I went on an odyssey trying to figure this out and this is what I've
got:
>>>
>>> There is no tt_content variable for TSFE, but there is a cObj variable.
>>> (which I saw here:
>>>
>
http://www.typo3-unleashed.net/typo3apidocs/typo3api_4.0.0/html/d8/d11/class
>>> _8tslib__fe_8php-source.html). cObj also has variables [sorry if my
>>> terminology is off], including $currentRecord, which "is set to the
>>> [table]:[uid] of the record delivered in the $data-array, if the
cObjects
>>> CONTENT or RECORD is in operation. Note that
>> $GLOBALS['TSFE']->currentRecord
>>> is set to an equal value but always indicating the latest record
>> rendered."
>>
>
(http://www.typo3-unleashed.net/typo3apidocs/typo3api_4.0.0/html/da/d2c/clas
>>> stslib__cObj-members.html). Yay, you would think this would solve all of
>> my
>>> problems!
>>>
>>> Well, this ts does render the table:uid (in this case, because I just
put
>>> the typoscript in a template, that was pages:uid-of-current-page):
>>>
>>> 20 = TEXT
>>> 20.data = TSFE:cObj|currentRecord
>>> 20.wrap = TSFE=|<br />
>>>
>>> but I can't seem to write a condition based on this that is successful
in
>>> targeting the specific content object. Here's what I'm trying:
>>>
>>> [globalString=TSFE:cObj|currentRecord=tt_content:1316]
>>>
>
plugin.tt_news.templateFile=fileadmin/Arts_Co-op/templates/news_templates/ar
>>> ts-co-op-headlines.tmpl
>>> [global]
>>>
>>> I know that
>>>
>
plugin.tt_news.templateFile=fileadmin/Arts_Co-op/templates/news_templates/ar
>>> ts-co-op-headlines.tmpl is correct because I tried it with other
>> conditions
>>> (TSFE:id=321). I know I can set template files on the tt_news content
>>> element page itself, but the tt_news manual says that it's better to do
> so
>>> via ts, and I was hoping that doing it via TS I wouldn't have to erase
> and
>>> reset the template every time I update the file. Also, I might need to
> set
>>> some other ts this way, and it seems like a logical thing to want to do,
>>> from my perspective.
>>>
>>> I'm sure either I just don't fully grasp how currentRecord is supposed
to
>>> work (which would make me sad, unless someone knows a different way to
do
>>> this), or I'm just doing something incorrectly. If there's some
massively
>>> easier way to do this, please let me know -- although like I said I
> didn't
>>> think (or understand how) the other solutions I'd seen would work for
me.
>
>>> Here's the ts I'm using to grab the tt_news element and stick it in my
>>> template:
>>>
>>> dates.10=CONTENT
>>> dates.10.table = tt_content
>>> dates.10.select.pidInList=879
>>> dates.10.select.uidInList=1316
>>> dates.10.select.wrap = <div class="important-dates-employers"> | </div>
>>>
>>> Thanks for any help in advance,
>>>
>>> Kath
>>>
More information about the TYPO3-english
mailing list