I'm using TemplaVoila and mapping a template to create a new site.
This is my first time in TYPO3, and all the default styling is messing up my html structure.
I want to remove stuff like divs, wrappings, p.bodytext, class="csc" etc
How can i make TYPO3 not render any wrappings/frames for all page contents?
PS. I know how to remove each individually, but is there a global setup to do in TS?
Remove static files from your main template.
Click on template, then click on your site root. Choose Info/Modify from toolbar and then click on Edit the whole template record, Includes.
The template is named CSS Styled Content.
This templates are include before your css files. So in your css you can just overwrite them if you don't want to remove the whole template.
Another solution is to remove css_styled_content and add content (default) instead.
My last idea is to setup the styled content in your main template like this
lib.parseFunc_RTE < lib.parseFunc
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines {
encapsTagList = div,p,pre,h1,h2,h3,h4,h5,h6
remapTag.DIV = P
nonWrappedTag = P
innerStdWrap_all.ifEmpty = <br />
#addAttributes.P.class = bodytext
#addAttributes.P.class.setOnly=blank
}
# remove class statements from h tags
lib.stdheader {
10.1.fontTag = <h1>|</h1>
10.2.fontTag = <h2>|</h2>
10.3.fontTag = <h3>|</h3>
10.4.fontTag = <h4>|</h4>
10.5.fontTag = <h5>|</h5>
stdWrap.dataWrap = |
}
Remove bodytext css:
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class >
Related
In TYPO3 4.7 I have a template that contains:
page.10 < temp.mainTemplate
This Template has two includes. The first contains this:
temp.mainTemplate = TEMPLATE
temp.mainTemplate {
subparts.menu_1 < temp.menu_1
}
And the second contains the actual HMENU typoscript:
temp.menu_1 = HMENU
temp.menu_1 {
#My Menu
}
Without altering either of the includes, how can I make an edit to the HMENU in the main template setup?
I have tried this above the first line without success:
temp.mainTemplate.subparts.menu_1 {
#Modifications to My Menu
}
I have tried this below the first line without success:
page.10.subparts.menu_1 {
#Modifications to My Menu
}
page.10.subparts.menu_1 is the right key to alter. It needs to be places after page.10 < temp.mainTemplate of course.
you can test it by deleting the menu completely with page.10.subparts.menu_1 > and it should disappear from the webpage.
There is no way of telling what exactly does not work without seeing more of your TS. May be you have just a typo somewhere
I am trying to create a custom menu element by using this in the Page TSConfig:
TCEFORM.tt_content {
menu_type.addItems.101 = My Menu
}
And this in Setup:
temp.my_menu = HMENU
temp.my_menu {
special = list
special.value.field = pages
1 = TMENU
1 {
wrap = <ul> | </ul>
NO = 1
NO.wrapItemAndSub = <li>|</li>
}
}
tt_content.menu.20.101 < temp.my_menu
But I get 'Oops, an error occurred!' where the menu should be.
It will render fine if I remove the Fluid includes in the template but then all the other content elements give errors.
Is there any way to have a typoscript menu element at the same time as fluid styled content?
Or if I really have to, how do I add a custom fluid menu template?
You need to move the line with the copy operation down to the bottom, otherwise the configuration is not copied, because it is not there yet.
The exception happens, because there is no rendering definition for the menu (because you never copied the configuration).
To see the real error instead of the exception, switch to the development preset in the install tool oder add the following line to your TS setup:
config.contentObjectExceptionHandler = 0
I noticed this :
TCEFORM.tt_content {
menu_type.addItems.101 = My Menu
}
as far as I know should be this :
TCEFORM.tt_content.menu_type {
types {
menu{
addItems {
101 = My Menu
}
}
}
}
I had to 'tweak' the special menus (typo3 7.6) and this worked:
Add special menu and add class="active" in TYPO3
I set up my own tt_content layout in TSconfig like
TCEFORM.tt_content.layout.removeItems = 1,2,3
TCEFORM.tt_content.layout.addItems.100 = Green Box
and added the class definition to my typoscript setup like
# Layout Green Box (100)
tt_content.stdWrap.innerWrap.cObject{
100=<tt_content.stdWrap.innerWrap.cObject.default
100.15.value = greenbox
}
in TYPO3 CMS 7.6.9. But it nothing happens in the frontend. The Layout "Green Box" appears in the Appearance > Layout dropdown but the class does not.
Did I something wrong or is there a new way since the fluid layouts in 7+ version?
In fact it needs to be defined in your own fluid template.
So what you do is to copy the private folders of fluid_styled_content to your own private folder of your distribution and added some lines to your typoscript constants like
styles.templates {
templateRootPath = {$resDir}/Private/Tt_content/Templates
partialRootPath = {$resDir}/Private/Tt_content/Partials
layoutRootPath = {$resDir}/Private/Tt_content/Layouts
}
In my case I edit the second line of Textmedia.html to
<div id="c{data.uid}" {f:if(condition: '{data.layout} == 100', then: 'class="greenbox"')}>
and et voila it works fine.
A little late, but somebody might still find this useful.
If you're using css_styled_content, then yes, it changes slightly in new versions.
Basically the structure looks now some like this:
stdWrap.innerWrap.cObject.[default|NN] {
# 10 - OPEN TAG
10.cObject.default.value = <div id="c{field:uid}"
# 20 - CLASS
20.10.value = csc-default
# 30 - CLOSE TAG
30.cObject.default.value = >|</div>
}
Differences between versions:
# overwrite basic settings for selected frame:
stdWrap.innerWrap.cObject.[NN (layout number or default)]
# for open tag: instead of NN.10.value (default.10.value) use: NN.10.cObject.default.value (default.10.cObject.default.value)
# for class: instead of NN.15.value (default.15.value) use: NN.20.10.value (default.20.10.value)
# for close tag: instead of NN.30.value (default.30.value) use: NN.30.cObject.default.value (default.30.cObject.default.value)
So in asked case it will be like this:
# Layout Green Box (100)
tt_content.stdWrap.innerWrap.cObject{
100 =< tt_content.stdWrap.innerWrap.cObject.default
100.20.10.value = greenbox
}
using Typo3 6.1, I'd like to be able to add a link with an editable caption to the end of each content element, linking to some related page. My approach was to (mis)use the header_link field for that. I removed the typolink from the headline and added the link after the content.
# something like:
20.text.20.append {
if.isTrue.field = header_link
value = more...
typolink.parameter.field = header_link
wrap = <div class="button">|</div>
}
To be able to use different captions for each link (instead of "more..."), I hoped to use the title property of the typolink since it can easily be set in the backend. Is this possible? Or is there a more reasonable way to achieve this?
The most straightforward way would probably be adding a new link field and a title field for that link by building a custom extension just for that purpose (adding the fields to BE and Database). Then editors can fill in these fields in the same tab and you can access them with typoscript.
You can use COA with new Object
100.value = more
100.wrap = <div class="button">|</div>
100.typolink ...
or use wrapper existing element
stdWrap.typolink {
wrap = <div class="linkwrap">|</div>
parameter.insertData = 1
parameter = {field:header_link}
ATagParams = class="headerLink"
ATagBeforeWrap = 1
}
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).