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.
Related
My goal is to apply different navigation logic to different page types. For example shortcut type will be container (drop down list in FE, shortcut itself is dummy link), standard type - page with content that you can navigate to. So, when in FE navigation user selects page:
drop-down list appears
if (type of page in list == standard)
can navigate to page in list;
else if (type of page in list == shortcut)
GO TO drop-down list appears
I know that you can do something like this:
lib {
main-nav = HMENU
main-nav {
1 = TMENU
1 {
expAll = 1
NO = 1
NO.wrapItemAndSub = <li>|</li>
NO.stdWrap.cObject = CASE
NO.stdWrap.cObject {
key.field = doktype
default = TEXT
default {
field = title
}
# standard page type
1 = TEXT
1 {
field = title
wrap = <div>|</div>
}....
As a result you get page title wrapped with div if page type is standard.
But what do i need to do to wrap whole menu item rather then just wrapping title?
If it's just about putting the div around the whole submenu, I guess what you already got should be applied to wrapItemAndSub instead
lib {
main-nav = HMENU
main-nav {
1 = TMENU
1 {
expAll = 1
NO = 1
NO.wrapItemAndSub.cObject = CASE
NO.wrapItemAndSub.cObject {
key.field = doktype
default = TEXT
default {
value = <li>|</li>
}
# standard page type
1 = TEXT
1 {
value = <li><div>|</div></li>
}....
I think you need to combine HTML, CSS and javascript.
In the typoscript you prepare the HTML with different markup depending on page type. Then your javascript has to handle the click event in case of a shortcut page where a click should open a drop down instead of going to that page. (add eventhandler)
So you need to give javascript something to identify the shortcut pages.
With the CASE object you mentioned you can build the apropiate HTML with all neccessary information (you might use data- attributes).
For a more detailed help you need to be more specific what you want to achieve.
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
:
}
}
I already searched the whole internet for a solution but didn't find the right answer, so here is my question:
I have been trying to introduce a breadcrumb menu inside my website. I've done this by writing the following HMENU:
lib.breadcrumb=COA
lib.breadcrumb {
10 = HMENU
10 {
special = rootline
special.range = 1|-1
includeNotInMenu = 1
1 = TMENU
1 {
# no unneccessary scripting.
1.noBlur = 1
# Current item should be unlinked
1.CUR = 1
1.target = _self
1.wrap = <div class="breadcrumb"> | </div>
1.NO {
stdWrap.field = title
ATagTitle.field = nav_title // title
linkWrap = ||*| » |*|
}
# Current menu item is unlinked
1.CUR {
stdWrap.field = title
linkWrap = ||*| » |*|
doNotLinkIt = 1
}
}
}
}
The menu is showing on the website so the wiring is working fine. But the problem is, despite all sites have the common root site Home in backend hierarchie, the root isn't shown at all sites. Here is an concrete example of two different sites with the same site hierarchie tree returning different breadcrumbs:
Backend-Site-Tree:
Home----Referenzen-----Vertriebsplattform
\---Kompetenzen----Schnittstellentechnik
edit:
Breadcrumbs:
I searched for differences in site configuration, but negative report. I also reset caches multiple times.
Does anybode have a similar problem or have an idea what could be wrong?
Thanks in advance,
Thomas
take this:
special = rootline
special.range = 1
After many hours of research I found the reason why the breadcrumb didn't appear properly.
All the sites on the second level of the hierarchie use the same template (another one than the home site). But those of them which didn't show Home as part of their breadcrumb also mistakenly included the template of the home site as basic template. This has to be a remnant of earlier stages of development :(
I don't know exactly why the breadcrumb menu was affected by this but the problem disappeared after fixing this dependency.
Anyways thanks for all your answers and suggestions.
It might be a simple solution to that but I am not able to figure it out.
I implement a typo3 6.2.12 website using the bootstrap_package extension. There I have a page with child pages within the page tree. On each child page a comment function should be attached at the end of the main page content. For the comment functionality I use the pw_comments extension, as it is very flexible.
The pw_comments manual shows a possible the integration as follows:
lib.content = COA
lib.content {
10 < styles.content.get
# List comments
20 < lib.pwCommentsIndex
# Write new comment
30 < lib.pwCommentsNew
}
Actually very simple and straightforward.
The bootstrap package extension handles the content as follows (inside base.ts):
lib.dynamicContent = COA
lib.dynamicContent {
5 = LOAD_REGISTER
5 {
colPos.cObject = TEXT
colPos.cObject {
field = colPos
ifEmpty.cObject = TEXT
ifEmpty.cObject {
value.current = 1
ifEmpty = 0
}
}
pageUid.cObject = TEXT
pageUid.cObject {
field = pageUid
ifEmpty.data = TSFE:id
}
}
20 < styles.content.get
20.select.where = colPos={register:colPos}
20.select.where.insertData = 1
20.select.pidInList.data = register:pageUid
90 = RESTORE_REGISTER
}
lib.dynamicContentSlide =< lib.dynamicContent
lib.dynamicContentSlide.20.slide = -1
And at that point I have no clue how to integrate pw_comments. In the setup of the plugin I tried this:
[PIDupinRootline = 54]
lib.dynamicContent = COA
lib.dynamicContent {
# List comments
30 < lib.pwCommentsIndex
# Write new comment
31 < lib.pwCommentsNew
}
[end]
The goal of the above is: Attach pw_comments to the main column output to each child page of parent page with uid 54.
Actually it is working but due to the inheritance with lib.dynamicContentSlide =< lib.dynamicContent the comments get also attached each of the 3 footer columns which is not desired behavior.
I could use the plugin extension which is available for pw_comments but that would mean that the editor has always to add that plugin to new child pages when creating them.
I could "hack" the fluid content template files and add a <f:cObject /> tag and call the plugin lib, but I think that solution is odd and .. well .. a hack.
So is there any way how I could attach that plugin to these child pages in a typo script way? I guess it is just a lack of syntax knowledge and yes, typo3 is not my every day job.
Hope anybody can give me a hand on this issue. Thanks so much in advance!
You simple need to replace the reference by a real copy before you add your TypoScript.
lib.dynamicContentSlide < lib.dynamicContent
# your TS goes here
Just repeat all lines with an reference to lib.dynamicContent with a copy operator instead, before you add your modifications to the actual content definition.
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).