I'm having problems with TYPO3. I have been using it for quite a few years, since version 3.8 but this is my first site using version 4.5 and I am having problems with the menus and the rootline.
I believe it is related to how the rootline is created. using the code below for the breadcrumb/path type of menu only the current page is displayed. The menu only displays page X using example and code below when in page X and it should be
home > section 1 > sb a > page X
home
--- section 1
------- sub A
---------- page X
--- section 2
Also when displaying menus the ACT state isn't being properly activated. As I understand every page in the path/rootline should activate the ACT state and it is not happening with code below.
Has any thing changed in this version?
I have used both piece of codes in many sites up to now in version 4.5
codes
temp.breadcrumbs = HMENU
temp.breadcrumbs.special = rootline
#temp.breadcrumbs.includeNotInMenu = 1
#temp.breadcrumbs.special.range= -2 | -1
temp.breadcrumbs.special.range = 0
temp.breadcrumbs.1= TMENU
temp.breadcrumbs.1.noBlur = 1
temp.breadcrumbs.1.NO.allWrap= | > |*||*| |
## with and without line ... special.range ...
.....
....
temp.topmenu.1 {
wrap = <ul>|</ul>
# NO.allWrap = <li>|</li>
expAll = 1
NO.wrapItemAndSub = <li>|</li>
# Enable active state and set properties:
ACT = 1
ACT.wrapItemAndSub = <li class="current-menu-item">|</li>
}
temp.topmenu.2 = TMENU
temp.topmenu.2.noBlur = 1
temp.topmenu.2 {
wrap = <ul class="sub-menu">|</ul>
NO.linkWrap = <li>|</li>
# Enable active state and set properties:
ACT = 1
ACT.linkWrap = <li class="active">|</li>
#ACT.allWrap = <li class="selected">|</li>
#ACT.ATagBeforeWrap = 1
}
thanks
Ivan.
as cascaval wrote it's quite common to declare begin and end levels, anyway 0 value is aceptable too, as written in doc for entryLevel
Default is "0" which gives us a menu of the very first pages on the site.
Probably you put some TypoScript on the page X which has Rootlevel field checked, so it avoids traversing the tree up-side. I examined your sample code on first implementation I had available and it works as expected.
The range is supposed to be defined as [begin-level] | [end-level] so try:
temp.breadcrumbs.special.range = 0|-1
...or...
temp.breadcrumbs.special.range = 1|-1
-1 means current page.
-2 means the page one level up from the current page.
NOTE: You should probably set temp.breadcrumbs.includeNotInMenu = 1 because usually you would like to have all the pages in the breadcrumbs (as the structure that breadcrumbs represent wouldn't otherwise make sense), that is including those that you don't want to appear in other menus.
Had the same problem in Typo3 6.2.14 and finally found a solution.
After clearing "Template on Next Level" rootline worked perfectly.
Reason:
the root template was referenced in root templates "Template on Next
Level".
Solution:
edit root template
switch to tabfolder "Options"
clear field "Template on Next Level"
Related
I'm using the field Frontend-Layout at my TYPO3 7.6-Backend. Because my website will have four different departments with different colours in frontend.
So I'm using:
TCEFORM {
pages {
layout {
altLabels {
0 = [ blue]
1 = [ orange ]
2 = [ green]
3 = [ yellow]
}
}
}
} ### TCEFORM
At my FLUIDTEMPLATE I'll wrap an <div>-wrapper, to set my different languages globally at my stylesheet. f.e. div.wrap.blue { background-color:blue;}
<div class="wrap
{f:if(condition:'{data.layout} == 0',then:'blue')}
{f:if(condition:'{data.layout} == 1',then:'orange')}
{f:if(condition:'{data.layout} == 2',then:'green')}
{f:if(condition:'{data.layout} == 3',then:'yellow')}">
...
This works perfect for me.
But how can I slide (or inherit) the frontend-layout-info from my parent-page to the subpages on my pagetree? I don't want to choose the frontend layout in page properties everytime, if I will add a new page into my pagetree. This must be working automatically. Is this possible? With slide?
For example
*ROOT
+ parent blue
~~ sub blue 1 /* these pages also have frontend layout 0 */
~~ sub blue 2
+ parent orange
~~ sub orange 1
+ parent green
...
+ parent yellow
...
Thebks for your opinion or tips ..
I don't think it's dead simple to set the {data.layout} layout recursively without manipulating the database. I have three 'solutions' coming to mind to solve your problem:
1) Create four Backend Layouts that you can select for your current and childpages. (Basically rinse and repeat what you have done for your first backend layout)
2) Using your layout modes you could try setting a body class using typoscript like so (i did not test this):
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.field = data.layout
page.bodyTagCObject.wrap = <body class="color-|">
3) Use a similar typoscript but update the value using typoscript conditions such as [pidInRootline]
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.wrap = <body class="blue">
[PIDinRootline = 1]
page.bodyTagCObject.wrap = <body class="orange">
[global]
[PIDinRootline = 2]
page.bodyTagCObject.wrap = <body class="green">
[global]
# and so on
I had your same problem and this typoscript worked fine for me,
the result is what you wanted to reach.
as you can see the 20.10 object is used when frontend layout is set on the page, while the 20.20 object is used when frontend layout is not set and takes it in slide mode:
page {
bodyTagCObject >
bodyTagCObject = COA
bodyTagCObject {
stdWrap.noTrimWrap = |<body |>|
20 = COA
20 {
wrap = class="|"
10 = TEXT
10 {
if.isTrue.data = page:layout
data = page:layout
noTrimWrap = |page-layout-| |
}
20 = TEXT
20 {
if.isFalse.data = page:layout
data = levelfield:-2, layout, slide
noTrimWrap = |page-layout-|
}
}
}
}
I hope I have been helpfull.
Active Admin's pagination on index pages is great, but we are trying to allow the user to type in the desired page number (in addition to the clickable page buttons).
Their desire is to have a prompt like "Enter Page Number:" and an input box where they can type in the desired page number.
Anyone done this already, or have ideas on how to proceed?
You can create a custom sidebar section like this:
sidebar :jump_to_page do
input :page_number
input type: :submit
end
Then add this to you active_admin.js.coffee file:
$ ->
$("#page_number_submit").on 'click', (e) ->
page_number = $("#page_number").val()
if window.location.search.indexOf("page=") > 0
window.location.search = window.location.search.replace(/page=\d*/, "page=#{page_number}")
else if window.location.search.indexOf("?") == 0
window.location.search = window.location.search + "&page=#{page_number}"
else
window.location.search = "page=#{page_number}"
As the title says, I need to list the content of all child-pages on the parent-page, after its own content. Or the thing I really need is, one page with content and and a menu which links to the different headers of the content. e.g. athe parent-page with content:
**Parent Head**
parent text
*first subhead*
first subtext
*second subhead*
second subtext
and the menu should look like:
Parent
-first subhead
-second subhead
I thought it would be easier if the parent-page "collects" the content of the child-pages.
The other solution was, that the child-pages would be links to extern URLs, to the specific c-IDs of the different contents of the parent-page. But I think this isn't that easy for the website owner, who doesn't know anything about where he can find the right c-ID in the web-page-source-code.
So how would You make that? Or how can I realize the thing with the child-page-content?
EDIT: Have a solution now. Just have to fix, that the submenu will be displayed without childpages.
Here is the code:
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="linkClass"
if.isTrue.field=header
}
wrap = <ul id="submenuClass"> | </ul>
}
page.10.marks.MENU.2.NO.after.cObject < temp.contentnav
Try something like this
temp.pageIds = HMENU
temp.pageIds.entryLevel = 1
temp.pageIds.1 = TMENU
temp.pageIds.1 {
NO.stdWrap.field = uid
NO.allWrap = |,
NO.doNotLinkIt = 1
}
lib.container = CONTENT
lib.container.table = tt_content
lib.container.select {
pidInList.cObject < temp.pageIds
}
There is a content element "Menu/Sitemap" with has an option to render subpages with content.
If you want to do it via TypoScript, render the menu, and then replace the menu items with content of them.
# Pseudocode on menuitem
# assuming you are using css_styled_content
1.allStdWrap.cObject < styles.content.get
# Set pid for CONTENT object from styles.content.get to the uid of the page
# which gets rendered
1.allStdWrap.cObject.select.pidInList.data = uid
Can't provide you with an working snippets atm.
My typo3 websites has a menu with the follwing typoscript definition:
lib.footernav = HMENU
lib.footernav.special = directory
lib.footernav.special.value = 38
lib.footernav.entryLevel = 0
lib.footernav.1 = TMENU
lib.footernav.1.NO {
ATagParams = class = "footer-link"
}
The menue works just fine. What I want to do is, change the link text into an image, like this:
<a class="footer-link" href="index.php?id=43&L=1">Facebook</a>
to
<a class="footer-link" href="index.php?id=43&L=1"><img src="facebook.gif"/></a>
How can I do that?
If it helps I could also create a new menu for this facebook link.
I recommend to use the "Media" field of the menu's target pages to define, which pages in the menu should be displayed using an image. The Media field can be found in the "Resources" tab of the page properties. It is the perfect solution for your problem because it allows you to freely choose any image for any menu item:
For menu items that you want to appear as an image, use the Media field of the corresponding menu page and select an image to use. For all menu items that you want to appear as text, simply leave the Media field empty.
Here is the TS code to create that behavior:
1 = TMENU
1.NO {
ATagParams = class="footer-link"
# Replace menu item text with image if defined in page tab "Resources"-->"Media"
stdWrap.override.cObject = COA
stdWrap.override.cObject{
10 = IMAGE
10.file.import = uploads/media/
10.file.import.field = media
10.altText.field = title
}
}
UPDATE FOR TYPO3 6.2 WITH FAL:
TYPO3 6.2 includes FAL – a new media resource management system. As the resources tab of the page properties is now also based on FAL, you need a different TypoScript approach to access those image(s). Here is an up-to-date solution:
1 = TMENU
1 {
wrap = <ul>|</ul>
NO = 1
NO {
wrapItemAndSub = <li>|</li>
stdWrap.override.cObject = FILES
stdWrap.override.cObject {
references {
table = pages
fieldName = media
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:uid
file.treatIdAsReference = 1
titleText.data = file:current:title // field:nav_title // field:title
altText.data = file:current:alternative // field:nav_title // field:title
}
# start with first image
begin = 0
# show only one image
maxItems = 1
}
}
}
The parameter begin defines which of multiple images should be used (e.g. if you need one image as a headline background for the page and another one as an icon in the menus).
If you increase the maxItems parameter, multiple images will be returned (if multiple images are defined in the resources tab).
If you want to append/prepend the image to the menu text instead of replacing it, you have to change stdWrap.override.cObject to after.cObject or before.cObject in the above code.
Another solution is to define a custom class for each link, then change the background image only for according links. This way you can fully control the menu's appearance by css:
lib.footernav.1.NO {
ATagParams = class="footer-link {field:title}"
ATagParams.insertData = 1
}
Results in following html:
<a class="footer-link Facebook" href="index.php?id=43&L=1">Facebook</a>
css:
.Facebook {
background: transparent url(facebook.gif) no-repeat;
text-indent:9999px;
}
EDIT: I recommend the above solution, because it's a quick and fairly clean setup to address a single menu item. However, if you like a clean example from the typoscript textbook:
lib.footernav = COA
lib.footernav.10 = HMENU
lib.footernav.10 {
special = directory
special.value = 38
excludeUidList = 99
1 = TMENU
1.NO {
ATagParams = class = "footer-link"
}
}
lib.footernav.20 = TEXT
lib.footernav.20 {
field = title
typolink.parameter = 99
typolink.ATagParams = class = "footer-link"
}
Assuming that your facebook menu item is page ID 99
Like so lib.footernav.1.NO.stdWrap.wrap = <img src="|.gif" />?
Make sure to add a wrap.htmlSpecialChars = 1 to avoid breaking the HTML code if an editor enters HTML special chars.
lib.footerSocialMedia = HMENU
lib.footerSocialMedia {
special = directory
special.value = 167
1 = TMENU
1 {
wrap = <ul class="social-list right">|</ul>
expAll = 1
noBlur = 1
NO {
wrapItemAndSub = <li class="skew-25">|</li>
doNotLinkIt = 0
stdWrap.htmlSpecialChars = 1
stdWrap.field =
ATagParams =data-title="{field:title}" data-tooltip="true"
ATagParams.insertData=1
stdWrap.wrap = <span class="{field:tx_menuicon_menuicon}"></span>|
stdWrap.wrap.insertData=1
}
ACT = 1
ACT {
wrapItemAndSub = <li class="skew-25">|</li>
doNotLinkIt = 0
stdWrap.field =
stdWrap.htmlSpecialChars = 1
ATagParams =data-title="{field:title}" data-tooltip="true"
ATagParams.insertData=1
stdWrap.wrap = <span class="{field:tx_menuicon_menuicon}"></span>|
stdWrap.wrap.insertData=1
}
}
}
First you need to add image in media of page under Page->edit and then add the image in media. Further, use the following typoscript:
stdWrap.override.cObject = COA
stdWrap.override.cObject{
10 = IMAGE
10.file.import = uploads/media/
10.file.import.field = media
10.altText.field = title
}
Essential is that my app parses the results of search from Yahoo!. There was easy to define that to get first page I need to from the next URL
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>
but what's straight link to any other page from yahoo! search page ? If to see on link there is
a href="/search;_ylt=A0oG7mulOyVP3FMAnPlXNyoA?p=java&fr=404_web&fr2=sb-bot&xargs=0&pstart=1&b=11&xa=U7cN_L3AOtj18W09Ud7SkA--,1327926565" title="Results 11 - 20" id="yui_3_3_0_1_1327840165621204"
but where is this some param, changing that I can to go to the next page or just to 10 page, for example? Does somebody know about this feature of yahoo?
By the way, YouTube hasn't such problem, his links are very simple, but Yahoo...
UPD Seems to be I defined this params - this is "b=11". Second page has "b=21", the third - "b=31" and so on
Link directly to specific pages by setting the offset (b) correctly.
Yahoo currently shows 10 results on each page, therefore use the following offset:
offset = 10 x pagenumber - 9
Quick example based on the URL you provided:
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>
Page 1 (offset = 10 x 1 - 9 = 1)
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>&b=1
Page 2 (offset = 10 x 2 - 9 = 11)
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>&b=11
Page 3 (offset = 10 x 3 - 9 = 21)
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>&b=21
Note:
I don't know the future, but currently the links above work fine.
Yahoo might change the URL structure any time.
What is the role of this parameter "_ylt" ?
I think there is no problem to ignore it.
Yahoo in different country have different content of "_ylt".
And the HTTP has been changed to https://, not http:// .
Taiwan:
https://tw.search.yahoo.com/search?p=soqi+bed&fr=yfp&ei=utf-8&v=0
https://tw.search.yahoo.com/search;_ylt=A8tUwZBhGxlU93YAZHJr1gt.?p=soqi+bed&ei=utf-8&fr=yfp&b=11&pstart=2
US(eng):
https://search.yahoo.com/search;_ylt=AiVNJTPKVpm9Jag8U.STVL6bvZx4?p=soqi+bed&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-329&fp=1
https://search.yahoo.com/search;_ylt=AwrSbDzyGRlUoG0AUn1XNyoA?p=soqi+bed&ei=UTF-8&fr=yfp-t-329&fp=1&b=11&pstart=7
Japan:
http://search.yahoo.co.jp/search;_ylt=A7dPKW9aHBlUDm4A5b2JBtF7?p=soqi+bed&search.x=1&fr=top_ga1_sa&tid=top_ga1_sa&ei=UTF-8&aq=&oq=&afs=
http://search.yahoo.co.jp/search?p=soqi+bed&tid=top_ga1_sa&ei=UTF-8&pstart=1&fr=top_ga1_sa&b=11