How to display latest or all posts (pages) of a parent page, in a single page in TYPO3 CMS - typo3

I have a TYPO3 TypoScript html template and want to show in a single page (called: "competitions"), a list of all competitions with their image and title and this should be links for each of them ('competition'). I have thought to make a page ('competitions') and subpages ('single cmpetition'). I'm not using Fluid actually. How can i get and display those in main page? Or is another way to achieve this ?

depending on your data structure (is the relevant info you want to show stored in the pages record or do you want access tt_content records inside that pages) it is more or less easy.
you always can access the informations with typoscript, but those constructs may get complicated. that means: developing the TS may take some time and the following rendering might also get complex and might take some time.
the easiest way: all information in pages records:
temp.competitions = CONTENT
temp.competitions {
table = pages
select {
pidInList = this
orderBy = sorting
}
renderObj = COA
renderObj {
wrap = <div class="teaser">|</div>
10 = TEXT
10.field = title
10.wrap = <h3>|</h3>
20 = TEXT
20.field = abstract
20.wrap = <div class="abstract">|</div>
30 = IMAGE
:
}
}

Related

TYPO3: How to get only parts of a record?

I want to built a content element with fields for text and images (I'm using the Mask extension for this) and use parts of the contents of it on further pages, for example as teasers.
Is it basically possible to put out only parts of a specific record, e.g. only the text and can an anybody give me a hint or an example how to?
Thank you for your help!
Michael
What you are rendering is your selection. In mask you already use only a subselection of all available fields in a tt_content record. It s very complicated for an editor if you use fields in your rendering, that can't be edited.
Assume you have CE (content element) of type A with some fields which all are filled with data, then you change the type to B which has other fields. As you have not emptied the fields from type A you still can access them and render it in the frontend.
if you want to render teaser you use only those fields you think what gives you the teaser information.
In general records are handled complete.
you can define your own viewhelper which provide you with restricted data or you use typoscript where you do the rendering in typoscript and you have no access to individual fields.
e.g. you could use a CONTENT object, selecting data from CEs in another page:
temp.teaser = CONTENT
temp.teaser {
table = tt_content
select {
// assuming context of a page, like in a menu
pidInList.field = uid
orderBy = sorting
max = 1
}
renderObj = COA
renderObj {
10 = TEXT
10.field = header
10.wrap = <div class="head">|</div>
20 = TEXT
20.field = bodytext
20.wrap = <div class="content">|</div>
20.crop = 100 | ... | 1
wrap = <div class="teaser">|</div>
}
}

get page title in styles.content.get

I am getting the content of a certain page and output it on another page in typoscript. what i would like to do is to get the page title and output it above the content.
This is my code for getting the page content:
lib.Section1 = CONTENT
lib.Section1 < styles.content.get
lib.Section1 {
select.languageField=sys_language_uid
select.where = colPos=0
select.pidInList = 19
}
For printing the page title i'm thinking of something like this:
lib.Section1.wrap = <div class="title">{page_title}</div>|
but i haven't been able to find the right method. Googling didn't help as the most methods i found there involved an hmenu or tmenu, which is not very practical in my case because i only need the content of a particular page. Maybe there is someone who can help.
You should indeed use a HMENU, since other methods (using CONTENT or similar) will run into problems with translations and selecting the right page.
Here is a simple HMENU:
lib.pageTitle = HMENU
lib.pageTitle {
special = list
special.value = 19
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
wrapItemAndSub = <h1>|</h1>
}
}
}
Have you tried this?
lib.Section1.dataWrap = <div class="title">{page:title}</div>|
First of all i think you need to use dataWrap to insert global Values (variables). And after that you can access some global data like page title i think.

How to hide a plugin's title via Typoscript when rendering with css_styled_content

This is probably very basic, but I'm stuck.
In TYPO3 6.1.x with tx_news, I have configured the news detail view to appear on the same page as the list view as taught on http://docs.typo3.org/typo3cms/extensions/news/latest/Main/Tutorial/IntegrationWithTs/Index.html
Also, I have pulled in the news'header as h1 as such
temp.h1 = COA
temp.h1 {
10 = TEXT
10 {
value = <h1>{page:title}</h1>
insertData = 1
}
10 = RECORDS
10 {
if.isTrue.data = GP:tx_news_pi1|news
dontCheckPid = 1
tables = tx_news_domain_model_news
source.data = GP:tx_news_pi1|news
source.intval = 1
conf.tx_news_domain_model_news = TEXT
conf.tx_news_domain_model_news {
field = title
htmlSpecialChars = 1
}
wrap = <h1>|</h1>
}
}
What I couldn't solve yet is that the plugin element has a title (in the regular "header" field). I need to display this header only in the list, but hide that plugin's header field in detail view.
How / where can I do that via page TS?
This is probably not even in the plugin, but in css_styled_content?
Something like this...
[globalVar = GP:tx_news_pi1|news > 0]
plugin.tx_news.stdheader >
[else]
But how?
A plugin is always using this prototype object:
tt_content.list
Therefore you could delete the header of this object like that
tt_content.list.10 >
But if you have other plugins on the same page, their headers would also be deleted. So that would be a bad idea.
I would suggest you use the header_layout field. By default it has an entry called "Hidden" that will hide the header of your plugin. If you don't have it, check the Page TypoScript configuration. You can add own items by using:
TCEFORM.tt_content.headerLayout.addItems.99 = My Header Layout
Then you can then define the rendering of your own layouts in
lib.stdheader.10
(it's a CASE object)

typo3 show submenu without subpages

I have a website with some pages, presented in a normal menu. Every page has subpages and shows them in a submenu. Except one page. This page has no subpages and should have a content menu which navigates to different content sections on the page. The thing with the content navigation is done with:
temp.contentnav = CONTENT
temp.contentnav {
table = tt_content
select {
pidInList = 7
orderBy = sorting
where = colPos=0
languageField=sys_language_uid
}
renderObj = TEXT
renderObj {
field = header
wrap= <li>|</li>
typolink.parameter.field=pid
typolink.parameter.dataWrap=|#{field:uid}
typolink.ATagParams = class="linkSubpage"
if.isTrue.field=header
}
wrap = <ul id="subMenu"> | </ul>
}
page.10.marks.MENU.2a.NO.after.cObject < temp.contentnav
but this works only if the page has at least one subpage. The workaround would be to add a subpage and hide the submenulink, but is there a better solution to show the custom submenu without adding subpages?
Use a HMENU item with the levels to generate your submenu.
Your behavior is not the right one in the TYPO3 working style. Use the rights TypoScript objects.
And remove the "a" from the "page.10.marks.MENU.2a.NO". The correct use is 1,2,3,...
http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/CommonProperties/Index.html
http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/CommonItemStates/Index.html
http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/Tmenu/Index.html
http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/Tmenuitem/Index.html

Adding the page content to a fluid template

I'm new to TYPO3 and Fluid and trying to display the page content using a Fluid template similar to the following one:
<div id="content">
<f:format.html>{content}</f:format.html>
</div>
The page data is entered via the backend using a two-column layout (colPos=0, colPos=1).
I am now trying to display the content of the first column (colPos=0) inside the div.
At the moment, my TYPO-Script looks like the following:
page = PAGE
page {
# ...
5 = FLUIDTEMPLATE
5 {
file = fileadmin/templates/default.html
# ...
variables {
pageTitle = TEXT
pageTitle.data = page:title
content = CONTENT
content {
table = tt_content
select {
where=colPos=0
}
renderObj = COA
renderObj {
10 = TEXT
10.field = bodytext
}
}
}
}
It works this way, but I cannot get rid of the feeling that my 5.variables.content is way too complicated.
I saw some solutions using content < styles.content.get as an alternative but using this causes my resulting div to be empty.
Are there any more elegant ways (i.e. shorter in this context) to achieve what I am doing?
On your question which approach is more elegant
(I don't use fluid, but I think it's general Typoscript):
If you want to use css_styled_content, but with more flexibility and transparence than the shortcuts "get", "getLeft" etc., use this:
content < styles.content.get
content.select.where = colPos = 0
No need to specify content = CONTENT in that case.
In the way you wrote it above, you would probably need to add:
10.parseFunc = < lib.parseFunc_RTE
to your renderObj, as else, automatically linked e-Mail addresses etc. won't be rendered in the content.
If you want full control over the markup, your original approach using the CONTENT object is superior to css_styled_content. But you will have to cover each field the editors are supposed to use.
I always use this article: http://www.typo3wizard.com/en/articles/explaining-the-content-object.html
With css_styled_content on the other hand, you get parsing for all fields for free - but also you get all the markup it will write for you.
It might be helpful to look at csc's static template in /typo3/sysext/css_styled_content/static/setup.txt to see what it does.
i dont use fluid, just plain TS for my projects, but i hope ill help.
In backend the cols are like this if u have not "touched" em:
| col1(Left) | col0(Normal) | col2(Right) | col3(Border) |
What i do is this for "normal" layout:
page.10 = TEMPLATE
page.10 {
subparts{
LEFT-CONTENT < styles.content.getLeft
CONTENT < styles.content.get
RIGHT-CONTENT < styles.content.getRight
}
marks {
DESCRIPTION < styles.content.getBorder
}
If u need something more u can use something like this to generate some content that is not on that page and can use it to display it on all pages.
subparts{
LEFT-CONTENT < styles.content.getLeft
LEFT-CONTENT {
select.pidInList = 50
select.where = colPos=0
select.orderBy = sorting
wrap = <div class="col100">|</div>
}
page.5.variables.content < styles.content.get
Of course you must have the CSS styled content extension installed (default) and the static template "CSS Styled content" included in your TypoScript Template (Tab: Includes).
Alternative solution: https://fluidtypo3.org/viewhelpers/vhs/development/Content/RenderViewHelper.html (along with get and random get/render counterparts).