Create a subpart menu for a one page template in typo3 - typo3

I integrate a one page parallax template in typo 3 in this i want to get a menu like below so i can access specific content on click , in a subpart of page object.
<ul class="nav navbar-nav navbar-right">
<li>HOME</li>
<li>ABOUT</li>
<li>PRICING</li>
<li>CONTACT</li>
<li>Call: +23-689-90 </li>
</ul>

Try
temp.contentnav = CONTENT
temp.contentnav {
table = tt_content
select {
pidInList = this
orderBy = sorting
where = colPos=0
languageField=sys_language_uid
}
renderObj = TEXT
renderObj {
field = header
wrap=|
typolink.parameter.field=pid
typolink.parameter.dataWrap=|#{field:uid}
if.isTrue.field=header
}
}
So you will get an menu of all items. Then again, you won't like that the menu item's title is taken from the header field. If your site is very small and you keep control over it, why don't you just hardcode this (look at the source, by default, each article has an id).
PS I copied that from http://www.typo3wizard.com/en/snippets/menus/content-element-navigation.html
EDIT on your getting started with TS question:
In your HTML Template:
<html>...
<!-- ###CONTENTNAV### START --><!-- ###CONTENTRIGHT### END -->
...</html>
In your TypoScript setup:
page.10.subparts {
# we fill the "subpart" (that's how this type of marker is called) with the temp object
CONTENTNAV < temp.contentnav
}
So the caret pointing left tells TYPO3 that in that region ("subpart"), it should add the content menu you've created with the TS snippet.
Note that you can also use "Marks" (###CONTENTNAV###, don't need start and end commentary, assign with page.10.marks) and the more modern fluid templates (<f:format.html>{contentnav}</f:format.html>), which are the future. You could start here: http://typo3buddy.com/typo3-template-tutorial/fluid/

Related

Adding sections (anchors) to a fluid menu in typo3 with bootstrap_package

I would like to have a menu mixing pages and sections from current page.
For example on page1:
section1_from_page1
section2_from_page1
page2
page3
And on page2:
section1_from_page2
page1
page3
Until now, all I'm able to do is to build a new section menu with TypoScript :
lib.sectionnavigation = HMENU
lib.sectionnavigation {
1 = TMENU
1 {
sectionIndex = 1
sectionIndex.type = header
sectionIndex.useColPos = -1
NO {
ATagBeforeWrap = 1
linkWrap = <span> | </span> <span class="bar"></span>
allWrap = <li> | </li>
allWrap.insertData = 1
}
}
special = list
special.value.data = page:uid
}
And then add this menu in the Main.html partials from bootstrap_package, with f:cObject :
<f:cObject typoscriptObjectPath="lib.sectionnavigation" />
However, that means that I have to maintain "format" (<li><span>...</span><span class="bar"></span></li>) in both the TypoScript and the Main.html partial which is not convenient.
For example, if I change the menu so that I don't need the bar class span, I'll have to update the partial and the TypoScript!
From what I've understood, bootstrap_package defines the main menu in setup.txt:
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
levels = 2
includeSpacer = 1
as = mainnavigation
}
And then used this in the Main.html partial:
<f:for each="{mainnavigation}" as="mainnavigationItem">
My first plan was to try to built an new array (similar to the one in {mainnavigation}) using TypoScript but I couldn't find a way!
I also tried to use a MenuProcessor but didn't succeed either.
Any help would be really appreciated!
Thank you.
You should use the possibility to identify the current page in typoscript menus with the option to replace the complete rendering for a menu item.
The rendering for current page in a menu can be defined with ACT or CUR (ACT identifies all pages in the root line: current page, parent, grand parent, ...). In your case it may not differ, but you might play it safe:
lib.MainMenu = HMENU
lib.MainMenu {
wrap = <ul class="nav">|</ul>
1 = TMENU
1 {
NO {
wrapItemAndSub = <li><span> | </span> <span class="bar"></span></li>
}
CUR = 1
CUR.doNotShowLink = 1
// insert your section menu here:
CUR.before.cObject < lib.sectionnavigation
}
}

TYPO3 7.4 display categories

I'm trying to display the categories of the current page.
Because I'm not that good in TYPO3, I first tried displaying all the categories before trying to display the current one.
The following snippet somehow doesn't work.
lib.categorized_content = RECORDS
lib.categorized_content {
categories.field = selected_categories
categories.relation.field = category_field
tables = tt_content
conf.tt_content = TEXT
conf.tt_content {
stdWrap.field = header
stdWrap.typolink.parameter = {field:pid}
stdWrap.typolink.parameter.insertData = 1
stdWrap.wrap = <li>|</li>
}
wrap = <ul>|</ul>
}
This is where I got this snippet from: https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Records/Index.html#categories
I'm using <f:cObject typoscriptObjectPath="lib.categorized_content" /> to implement it into my template.
Can someone help?
selected_categories and category_field are flexform field (as you can see from the suffix .field of the configuration property) from the Special Menu content element.
You have to replace those with the actual value.

TYPO3 tt_content: Add class to nav-wrap for specific menu element

I'm building a custom menu type and need to change the "outerOuterWrap" of this menu.
This is what i got:
tt_content.menu.20.102 < tt_content.menu.20.default
tt_content.menu.20.102 {
special = list
stdWrap {
outerWrap = <ul class="csc-menu csc-menu-102">|</ul>
}
1 = TMENU
1.NO {
(...)
}
}
And it will be rendered to:
<nav class="csc-default" id="c1416">
<ul class="csc-menu csc-menu-102">
(...)
</ul>
</nav>
How do I add a class to the nav tag without section_frame or layout? So that I get:
<nav class="csc-default custom-class" id="c1416">
Thank you!
I think this is in Line 454 of css_styled_content/static/setup.txt:
tt_content.stdWrap.innerWrap.cObject.default.20.20.10.value = csc-default
so you would need to set this value from inside your menu definition, just for your menu. Of which I'm not sure if it's possible.

"Menu of subpages" doesn't work in a Typo3 Fluid template while fetching a record from a page

I'm trying to add a "user controlled" footer in the main layout of a Typo3 Fluid based template.
This means that I've added a backend layout with four columns in a special back-end page called "footer page". A user is able to add content elements in those columns using the WEB > PAGE module.
Whenever a user adds a content element (text, text w/images, bullet lists, etc...) in one of the columns, everything works and the content is correctly displayed.
But when the user tries to add a special menu content element, the menu isn't displayed and the column container stays empty.
the main layout
<body>
...
<div id="footer">
<f:cObject typoscriptObjectPath="lib.footer" />
</div>
</body>
main PAGE typoscript
page = PAGE
page {
# Regular pages always have typeNum = 0
typeNum = 0
10 = FLUIDTEMPLATE
10 {
#file = {$filepaths.templates}index_f.html
partialRootPath = {$filepaths.templates}partials/
layoutRootPath = {$filepaths.templates}layouts/
variables {
...
footer < lib.footer
...
}
}
}
lib.footer typoscript
lib.footer = COA
lib.footer {
10 = CONTENT
10 {
table = tt_content
select.pidInList = {$contentpage.footerPID}
select.where = colPos = 901
select.orderBy = sorting
stdWrap.wrap = <div id="footer-widget-1" class="col205">|</div>
}
20 = CONTENT
20 {
table = tt_content
select.pidInList = {$contentpage.footerPID}
select.where = colPos = 902
select.orderBy = sorting
stdWrap.wrap = <div id="footer-widget-2" class="col205">|</div>
}
...
}
Am I doing something wrong or is it a bug?
Typo3 version is 6.0.4
You may want to have a look at the VHS extension for TYPO3 - it contains one ViewHelper in particular which would let you render content elements from any column on any page (by UID). It can even render content elements from a list of content element UIDs (which you could specify in TypoScript, select in a FlexForm, make editable in the constants editor etc.):
http://fedext.net/viewhelpers/vhs/Content/RenderViewHelper.html
Many times the ViewHelpers from VHS will let you do exactly the same as TS lets you do, but do so directly in Fluid and with the option to manually control the HTML that is output.
Cheers,
Claus aka. NamelessCoder

Typo3 FCE refer filetype of field uri inside class attribute

xI would like to insert the filetype of the inserted file into a a href class:
a href class"icon-filetype-"
i have something like this now:
10 = TEXT
10.field = field_uri
10.wrap = icon-filetype-|
but than i get the hole url inside the class :D
thans for time
(btw, i used these sites as reference, so maybe i give you a start with it:
Typo3 FCE refer a field inside a container field
and http://typo3.org/extension-manuals/rs_linklayout/1.3.1/view/1/3/ )
this is the mapping i use:
<ul class="section-container">
<li>
<a class="" href="#" target="_blank"><span>Item 1</span><span class="size"></span></a>
</li>
</ul>
did not test this code:
10 = TEXT
10.field = field_uri
10.split {
token = .
# if you get an different part or some parts added, this optionsplit is wrong
cObjNum = |*||*| 1 || 2
# render nothing means remove this part
1 = TEXT
1.value =
# render only the filetype
2 = TEXT
2.current = 1
}
10.wrap = icon-filetype-|