Add Data attributes in typoscript to a link - typo3

i have a question regarding typoscript. I am new to typo3 and i am just looking into things.
I know i can do something like this in typoscript:
stdWrap.htmlSpecialChars = 1
ATagTitle.field = title
is it possible to put in a data-attribute to the a tag as well? Something like this:
ATagData.field = data-toggle="hover"

If you have a TEXT object, then you should take a look at »typolink« and »ATagParams« (eg: »typolink.ATagParams = class="foo"«)
Since you posted »ATagTitle« I know that you work with a navigation object. In there you may use »ATagParams« as well:
ATagParams = data-toggle="hover"
See reference for TypoScript TMENU items: http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/Tmenuitem/Index.html?highlight=atagparams

Related

Breadcrumb menu not working properly in Typo3 7.6.6

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.

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.

Typo3: How to use title of header_link field as link text?

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
}

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).

Social media links in TYPO3 using typoscript

I'm newbie to TypoScript. I actually don't know how to make link like this:
By googling, I got some idea on typoscript like this:
lib.social = COA
lib.social.special = language
lib.social.special.value = 0,1,2
lib.social.1 = GMENU
lib.social.1{
wrap = <ul> | </ul>
noBlur = 1
expAll = 1
NO = 1
NO {
ATagTitle.field = title // nav_title
stdWrap.htmlSpecialChars = 1
wrapItemAndSub = <li> | </li>
accessKey = 1
}
}
lib.social.1.NO{
XY = [5.w]+4, [5.h]+4
5 = IMAGE
5.file = {$global.imagePath}facebook.png || {$global.imagePath)twitter.png || {$global.imagePath)xing.png
5.offset = 2,2
}
I'm sure I got a problem with lib.social = language and I also try different things lik directory or browse but it still does not work and I may have some mistakes with the above script which I can't figure out.
In overall, I don't know how to make it work by linking to the external urls using typoscript.
Thanks
Most of social networks has their own embedding code so you don't need to create it manually, just can put into the marker the code...
lib.social = COA
lib.social.10 = TEXT
lib.social.10.value = <fb:like send="true" width="450" show_faces="true"></fb:like>
you can also use www.addthis.com to place many different social buttons
If you need to use custom graphics anyway, use common links, each with custom id attribute, then just use CSS to set it's display as block set the width,height, float (to make sure the each button is in the sam line, and finally background-image with your buttons. Use sprite technique for the image for best results (all buttons in one file, then set correct button for link with background-position
I see u just want to have some image menu.
Create a new page of type Menu Separator in your pagetree
Create a new page for every menu item and use type Link to External URL (don't forget to fillin the url in the page properties)
Upload your image inside the page properties under Resources -> media
Use the code below to show the menu on your front-end (replace special.value = 2000 with the page ID of your social page.
Code: http://shrib.com/gRrK9uGL
(sorry didnt get the code visible here)