I'm using gridelements as an extension, but I'm sure this doesn't matter regarding my question.
I have an element like:
tt_content.gridelements_pi1.20.10.setup {
1 < lib.gridelements.defaultGridSetup
1 {
columns {
10 < .default
10.wrap = <div class="class1">|</div>
}
wrap = <div class="class3"><div class="class2">|</div></div>
}
}
What I want to achieve is to insert a menu, which will exist as a Typoscript object at this place:
wrap = <div class="class3"><div class="class2">[>>MENU<<]|</div></div>
I tried this:
wrap.cObject = COA
wrap.cObject {
10 = TEXT
10.value = <div class="class3"><div class="class2">
20 < temp.menu
30 = TEXT
30.value = </div></div>
}
Which works as it shows the menu, but it also fails, as it destroys the wrap itself.
How can I solve this?
I finally solved it using prepend, append and a blank wrap:
tt_content.gridelements_pi1.20.10.setup {
1 < lib.gridelements.defaultGridSetup
1 {
columns {
10 < .default
10.wrap = <div class="class1">|</div>
}
wrap = |
prepend = COA
prepend {
10 = TEXT
10.value = <div class="class3"><div class="class2">
20 < temp.menu
}
append = COA
append {
10 = TEXT
10.value = </div></div>
}
}
}
Related
I would like to build a full with dropdown menu based on page content defined into a folder.
The idea is to have:
MENU (folder)
- menu 1 (page)
- menu 2 (page)
My goal is to get the following output:
menu 1 content in menu 1 page
menu 2 content in menu 2 page
There is only one content bloc in the pages.
No problem to get the li with menu 1 / 2 but I cannotfind the way to get and wrap the page content.
My code looks like
menu.nav = HMENU
menu.nav {
special = directory
special.value = 214
entryLevel = 1
1 = TMENU
1.wrap = <ul>|</ul>
1.expAll = 1
1.NO = 1
1.NO.wrapItemAndSub.cObject = TEXT
1.NO.wrapItemAndSub.cObject.value = <li>|</ul></li>
1.NO.after.cObject = COA
1.NO.after.cObject {
10 = TEXT
10.value = <div class="dropdown">
20 = CONTENT
20 {
table = tt_content
select {
....
but I cannot figure out what is required here to get the content of the pages.
Does someone can help me with this issue?
Thanks in advance.
Regards
Joël
I'll try a solution here, hoping that I'm not simplifying too much your code,at least you could take it as a starting point:
menu.nav = HMENU
menu.nav {
special = directory
special.value = 214
1 = TMENU
1.wrap = <ul>|</ul>
1.NO {
wrapItemAndSub = <li>|</li>
after.cObject = CONTENT
after.cObject {
table = tt_content
select {
pidInList.field = uid
where = {#colPos} = 0
}
renderObj = < tt_content
wrap = <div class="dropdown">|</div>
}
}
}
I took this one as starting point.
I had a similar problem sometime ago, came upwith this code to make a menu containing database information.
It is not an answer, but it is a similar piece of code. Hopefully it gives you an idea.
It generates a list of links to pages which have "no_search" = 0 or another condition. There is also a database join made to get the pagepath or url of pages in the site.
Think you can do the same thing with your page content, output it as html.
lib.sitemap = CONTENT
lib.sitemap {
table = pages
select {
orderBy = pages.sorting
selectFields = pages.uid, pages.title, tx_realurl_pathcache.pagepath
join = tx_realurl_pathcache ON tx_realurl_pathcache.page_id=pages.uid
pidInList = 44
recursive = 7
where = (no_search="0") or (nav_hide=1 and no_search=0)
groupBy = tx_realurl_pathcache.page_id
}
renderObj = COA
renderObj.wrap = <li>|</li>
renderObj.10 = TEXT
renderObj.10 {
field = pagepath
wrap = <a href="|">
}
renderObj.20 = TEXT
renderObj.20.field = title
renderObj.30 = TEXT
renderObj.30.value = </a>
}
lib.sitemap.wrap = <ul> | </ul>
You have to do this
lib.navbar2 = COA
lib.navbar2.wrap = <nav>|</nav>
lib.navbar2 {
20 = HMENU
20.wrap = <ul>|</ul>
20 {
#entryLevel = 0
#excludeUidList = 11,12
1 = TMENU
1 {
wrap = |
expAll = 1
NO = 1
NO.allWrap >
NO.wrapItemAndSub = <li>|</li>
NO.after.cObject = COA
NO.after.cObject{
stdWrap.wrap = <div class="megamenu-wrapper">|</div>
20 = CONTENT
20 {
table = tt_content
select {
pidInList.field = uid
orderBy = sorting
where = colPos=4
languageField=sys_language_uid
}
}
20.wrap = |
}
ACT = 1
ACT < .NO
ACT.wrapItemAndSub = <li class="active">|</li>
CUR = 1
CUR < .NO
CUR.wrapItemAndSub = <li class="active">|</li>
}
}
}
I'm running a Typo3 v9.5.4 Onepager style Website. The content is loaded directly from the tt_content. The Website has two FE languages (German/English).
I have a CTA button which has an anchorlink. The button is create with typoscript. I created one button for the German version and one for the English verson bc they have another value and another ancorlink.
I'm not sure if I can access a tt_content field directly from a fluid viewhelper. This is my code i've tried
<f:if condition="{tt_content.sys_language_uid} == 1">
<f:then>
<f:format.raw>{buttonEn}</f:format.raw>
</f:then>
<f:else>
<f:format.raw>{buttonDe}</f:format.raw>
</f:else>
</f:if>
This is my Typoscript for the two button Objects
lib.buttonDe = TEXT
lib.buttonDe {
value = German Text
stdWrap.typolink.parameter = #anchorlinkDE
stdWrap.typolink.ATagParams = class="button"
}
lib.buttonEn = TEXT
lib.buttonEn {
value = English Text
stdWrap.typolink.parameter = #anchorlinkEN
stdWrap.typolink.ATagParams = class="button"
}
And this is the typoscript that loads the Content, the Languages Menu and the Fluidtemplate (the Onepager Content is loaded without a Fluidtemplate, it loads the content directly from tt_content):
//--------------------- One Pager Content
lib.sectionContent = HMENU
lib.sectionContent {
excludeUidList = 12,13,16,17,29
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap >
stdWrap {
cObject = COA
cObject {
if.value = 4
if.equals.field = doktype
if.negate = 1
10 < temp.titleSectionId
10.wrap = <section id="|">
20 = CONTENT
20 {
table = tt_content
select {
pidInList.field = uid
orderBy = colPos,sorting
# Only selects Content where CE Layout is 0
where = (tt_content.layout = "0")
}
wrap = <div class="container">|</div>
renderObj < tt_content
}
30 = TEXT
30 {
wrap = </section>
}
}
}
}
}
}
//---------------------
// Language Selector
lib.langmenu = HMENU
lib.langmenu {
special = language
addQueryString = 1
special.value = {$config.language.uids}
1 = TMENU
1 {
wrap = <ul class="dg-langmenu row">|</ul>
NO = 1
NO {
stdWrap.current = 1
stdWrap.setCurrent = {$config.language.labels}
allWrap = <li class="col s6">|</li>
}
ACT < .NO
ACT.doNotLinkIt = 1
ACT.allWrap = <li class="act col s6">|</li>
}
}
page = PAGE
page{
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName.stdWrap{
cObject = TEXT
cObject{
data = levelfield:-2,backend_layout_next_level,slide
override.field = backend_layout
split {
token = pagets__
1.current = 1
1.wrap = |
}
}
ifEmpty = onePager
}
templateRootPaths {
10 = {$path.privat}Templates/
}
layoutRootPaths {
10 = {$path.privat}Layouts/
}
partialRootPaths {
10 = {$path.privat}Partials/
}
variables{
buttonDe < lib.buttonDe
buttonEnd< lib.buttonEn
}
}
So I'd like to load the buttonEn if the content has the sys_language_uid 1 (English) else I want it to load the buttonDe.
Do I need to create an Typoscript Object and then load this Object into the f:if viewhelper? If so how do I create this Typoscript Object.
Thanks for your help!
The easy way (pure typoscript)
lib.button = TEXT
lib.button {
value = English text
lang.de = Deutscher Text
stdWrap.typolink.parameter = #anchorlinkDE
stdWrap.typolink.ATagParams = class="button"
}
[siteLanguage("locale") == "en_EN.UTF-8"]
lib.buton.stdWrap.typolink.parameter = #anchorlinkEN
[global]
but the professional solution is configuring your labels in a language file (see answer from Thomas Löffler) and use:
lib.button = TEXT
lib.button {
lib.button.data = LLL:EXT:site_extension/Resources/Private/Language/locallang.xlf:button_label
stdWrap.typolink.parameter = #anchorlinkEN
stdWrap.typolink.ATagParams = class="button"
}
[siteLanguage("locale") == "de_DE.UTF-8"]
lib.buton.stdWrap.typolink.parameter = #anchorlinkDE
[global]
For language dependent constant data you might use typoscript conditions to redefine a value for your non default languages. (or define a fallback and conditions for each language.)
You should use a locallang file and refer to it in TypoScript.
Create a locallang file (copy an existing and remove all values) named locallang.xlf
Add your english label in there
Create a locallang file in the same folder with prepending de. in the filename (de.locallang.xlf) and add the german label
Refer to it in the TypoScript by using lib.button.data = LLL:EXT:your_ext/path/to/locallang/locallang.xlf:buttonLabel, see https://docs.typo3.org/typo3cms/TyposcriptReference/DataTypes/Index.html#lll
This TS getText function gets the label depending on the set language ID automatically and you only need one TS for the button.
Example: https://docs.typo3.org/typo3cms/TyposcriptIn45MinutesTutorial/UsingGetText/Index.html
Hi I try to get the following out-put when including a .lib with
<f:cObject typoscriptObjectPath="lib.faqList"/>
in my fluid template. I get the links out put but not in the desired:
`<ul>
<li>
some text here
</li>
</ul>
`
So this is the lib.faqList I tried to wrap in several ways but can not get it working also tried with {} and wrap stdWrap linkWrap etc. So how should thsi be done. I now get the ul and the links without the li?
`## Linklist FAQ!! [Begin]
lib.faqList = COA
lib.faqList{
wrap = <ul>|</ul>
lib.faqList.10 = TEXT
lib.faqList.10.stdWrap = <li>|</li>
{lib.faqList.10.value = TYPO3 Association
lib.faqList.10.typolink.parameter = 29
}
lib.faqList.20 = TEXT
lib.faqList.20.stdWrap = <li>|</li>
{lib.faqList.20.value = TYPO3 Association
lib.faqList.20.typolink.parameter = http://association.typo3.org
}
lib.faqList.30 = TEXT
lib.faqList.30.stdWrap = <li>|</li>
{lib.faqList.30.value = TYPO3 Association
lib.faqList.30.typolink.parameter = 27
}
lib.faqList.40 = TEXT
lib.faqList.40.stdWrap = <li>|</li>
{lib.faqList.40.value = TYPO3 Association
lib.faqList.40.typolink.parameter = 98
}
}
## Link list [End]
`
Watch on you code, I see many bracet where they not belong...
## Linklist FAQ!! [Begin]
lib.faqList = COA
lib.faqList {
wrap = <ul>|</ul>
10 = TEXT
10 {
wrap = <li>|</li>
value = TYPO3 Association
typolink.parameter = 29
}
20 = TEXT
20 {
wrap = <li>|</li>
value = TYPO3 Association
typolink.parameter = http://association.typo3.org
}
30 = TEXT
30 {
wrap = <li>|</li>
value = TYPO3 Association
typolink.parameter = 27
}
40 = TEXT
40 {
wrap = <li>|</li>
value = TYPO3 Association
typolink.parameter = 98
}
}
## Link list [End]
In TYPO3 CMS we have left, normal, right and border columns as default. Is it possible to create your own columns in the BE?
please go to listview and click new element
there should be backend layout available
put in konfiguration something like
backend_layout {
colCount = 3
rowCount = 3
rows {
1 {
columns {
1 {
name = oben
colPos = 10
colspan = 3
}
}
}
2 {
columns {
1 {
name = linke Spalte
colPos = 0
}
2 {
name = mittlere Spalte
colPos = 1
}
3 {
name = rechte Spalte
colPos = 2
}
}
}
3 {
columns {
1 {
name = unten
colPos = 11
colspan = 3
}
}
}
}
}
i think this is a good example how you can make usage of rows and cols
then go to a page where you want to use this layout go to page --> edit and choose the layout
you see in my example that i have colPos = 11 for example
to get the content from colPos = 11 you need to tell your template that
index.html:
<div class="wrapper">
<div class="col9 last contentInner">
<f:cObject typoscriptObjectPath="lib.title" />
<f:format.raw>{normaleseitecolpos0}</f:format.raw>
</div>
</div>
this is your fluidtemplate
first <f:cObject .... links to a lib that you can use in setup.ts
second <f:format.raw.... links to a colpos related variable
if you add this to the setup.ts
page {
10 = FLUIDTEMPLATE
10 {
file = fileadmin/templates/knowhow/layout/index.html
variables {
# Einspalter
normaleseitecolpos0 < styles.content.get
normaleseitecolpos0.select.where = colPos = 11
}
}
}
I would like to display content of subsites and wrap them in specific divs. Here is my code:
lib.content = CONTENT
lib.content {
stdWrap.wrap = <div id="sub-content-scroll">|</div>
renderObj.stdWrap.wrap = <div class="page">|</div>
table = tt_content
select {
pidInList.cObject < lib.allPid
where = colPos = 0
orderBy = pid
}
}
My question is: How can I wrap the only per pid. Now it wraps all content element with the page div. But I want to achieve the wrap by site. PS: lib.allPid is a kommaseparated list with ids.
Can someone help me?
Thank you very much
Coreblade
Thanks for the answer
I solved my Problem. The solution was to implement both (lib.content and lib.allPid) in one:
lib.content = HMENU
lib.content {
stdWrap.wrap = <div id="sub-content-scroll">|</div>
special = directory
special.value = 7
1 = TMENU
1.NO {
doNotLinkIt = 1
field = uid
stdWrap.cObject = CONTENT
stdWrap.cObject {
wrap = <div class="page">|</div>
table = tt_content
select {
pidInList.field = uid
where = colPos = 0
orderBy = pid
}
}
}
}
Ragards Coreblade