TYPO3 Menu: Repeat parent link in first child - typo3

I want to repeat the parent of a navigation as the first child of its child.
Example:
PARENT 1
-- Parent 1
-- Child 1
-- Child 2
---- Subchild 1
---- Subchild 2
-- Child 3
PARENT 2
-- Parent 2
-- Child 1
-- Child 2
-- Child 3
As this should only be the case in one menu, hence manually adding page links is not an option.
My current TypoScript is as follows.
lib.mainmenu = HMENU
lib.mainmenu {
1 = TMENU
1.expAll = 1
1.NO.stdWrap.htmlSpecialChars = 1
1.NO.wrapItemAndSub = <li class="menuopener">|</li>
1.ACT < .NO
1.ACT = 1
1.ACT.wrapItemAndSub = <li class="menuopener active">|</li>
2 < .1
2.wrap = <ul>|</ul>
2.NO.wrapItemAndSub = <li>|</li>
2.ACT.wrapItemAndSub = <li class="active">|</li>
3 < .1
3.wrap = <ul>|</ul>
3.NO.wrapItemAndSub = <li>|</li>
3.ACT.wrapItemAndSub = <li class="active">|</li>
}
Thanks!

So I found a solution, adapted from here:
lib.mainmenu = HMENU
lib.mainmenu.entryLevel = 0
lib.mainmenu {
1 = TMENU
1 {
expAll = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <li class="menuopener">|</li>
stdWrap.htmlSpecialChars = 1
accessKey = 1
}
IFSUB < .NO
IFSUB = 1
IFSUB {
wrapItemAndSub = <li class="menuopener">|</li>
linkWrap= |
ATagParams =
ATagBeforeWrap = 1
stdWrap.htmlSpecialChars = 1
}
ACTIFSUB < .IFSUB
ACTIFSUB {
wrapItemAndSub = <li class="menuopener active">|</li>
}
ACT < .NO
ACT = 1
ACT {
wrapItemAndSub = <li class="active">|</li>
}
CURIFSUB < .IFSUB
CURIFSUB = 1
CURIFSUB {
wrapItemAndSub = <li class="active">|</li>
}
}
# second level
2 = TMENU
2.stdWrap.wrap.stdWrap.cObject = COA
2.stdWrap.wrap.stdWrap.cObject {
10 = TEXT
10.typolink.parameter = {field:pid}
10.typolink.parameter.insertData = 1
10.wrap = <ul><li>|</li>
20 = TEXT
20.value = |</ul>
}
2{
expAll = 1
NO{
ATagTitle.field = title
wrapItemAndSub = <li>|</li>
}
IFSUB = 1
IFSUB{
ATagTitle.field = title
wrapItemAndSub = <li>|</li>
}
}
3 < .1
3.wrap = <ul>|</ul>
3.NO.wrapItemAndSub = <li>|</li>
3.ACT.wrapItemAndSub = <li class="active">|</li>
}

Related

Sorting records based on multiple columns

I have a dealers tables with following columns
dealer_name is_iso is_gst is_approved
& need to display dealers records in following order
dealers with all columns set should appear first,
then dealers with iso & gst,
then with iso & verified,
then with gst & verified,
then with iso,
then with gst
data in dealers table is like
dealer_name is_iso is_gst Is_approved
A 1 1 1
B 1 0 1
C 1 0 0
D 0 1 0
E 1 1 0
F 0 1 1
G 1 0 0
G 1 1 1
Currently, I am using CASE WHEN ( answer below ) to achieve this & need to know if there is better way?
SELECT
*,
CASE
WHEN (typeA = 1 and typeB = 1 and isISO = 1) THEN 6
WHEN (typeA = 1 and typeB = 1 and isISO = 0) THEN 5
WHEN (typeA = 1 and typeB = 0 and isISO = 1) THEN 4
WHEN (typeA = 0 and typeB = 1 and isISO = 1) THEN 3
WHEN (typeA = 1 and typeB = 0 and isISO = 0) THEN 2
WHEN (typeA = 0 and typeB = 1 and isISO = 0) THEN 1
ELSE 0
END as dealer_order
FROM
dealers
ORDER BY
dealer_order desc

Matlab algorithm for obtain the original numbers of a sum of random numbers

Have 8 people in a room seated in a round table and each of them chose a random number and sum with the number of the people in his right and left side. The results are bring to you in order where people was in the table, how you can obtain the original number what each one chose?
Lower_rand_limit = 1;
Upper_rand_Limit = 100;
Number_of_colums = 8;
Number_of_lines = 1;
Random_matrix = randi([Lower_rand_limit Upper_rand_Limit], Number_of_lines, Number_of_colums)
Sum_matrix = zeros(Number_of_lines, Number_of_colums);
for i = 1:Number_of_colums
if i == 1
Sum_matrix(Number_of_lines, i) = Random_matrix(Number_of_lines, Number_of_colums) + Random_matrix(Number_of_lines, i) + Random_matrix(Number_of_lines, i + 1);
elseif i == Number_of_colums
Sum_matrix(Number_of_lines, i) = Random_matrix(Number_of_lines, Number_of_colums- 1) + Random_matrix(Number_of_lines, Number_of_colums) + Random_matrix(Number_of_lines, 1);
else
Sum_matrix(Number_of_lines, i) = Random_matrix(Number_of_lines, i - 1) + Random_matrix(Number_of_lines, i) + Random_matrix(Number_of_lines, i + 1);
end
end
Sum_matrix
Now only whit the Sum_matrix how can i obtain the original Randon_matrix?
Thanks to the answear of nikaltipar it's working now, for who want see the entire code he it's here:
Lower_rand_limit = 1;
Upper_rand_Limit = 100;
Number_of_colums = 1;
Number_of_lines = 8;
Random_matrix = randi([Lower_rand_limit Upper_rand_Limit], Number_of_lines, Number_of_colums)
Sum_matrix = zeros(Number_of_lines, Number_of_colums);
for i = 1:Number_of_lines
if i == 1
Sum_matrix(i, 1) = Random_matrix(Number_of_lines, 1) + Random_matrix(i, 1) + Random_matrix(i + 1, 1);
elseif i == Number_of_lines
Sum_matrix(i, 1) = Random_matrix(Number_of_lines - 1, 1) + Random_matrix(Number_of_lines, 1) + Random_matrix(1, 1);
else
Sum_matrix(i, 1) = Random_matrix(i - 1, 1) + Random_matrix(i, 1) + Random_matrix(i + 1, 1);
end
end
Sum_matrix
A = [1 1 0 0 0 0 0 1;
1 1 1 0 0 0 0 0;
0 1 1 1 0 0 0 0;
0 0 1 1 1 0 0 0;
0 0 0 1 1 1 0 0;
0 0 0 0 1 1 1 0;
0 0 0 0 0 1 1 1;
1 0 0 0 0 0 1 1];
Result_matrix = A\Sum_matrix;
Result_matrix
Something like this?
function [ x ] = original_numbers( b )
A = [1 1 0 0 0 0 0 1;
1 1 1 0 0 0 0 0;
0 1 1 1 0 0 0 0;
0 0 1 1 1 0 0 0;
0 0 0 1 1 1 0 0;
0 0 0 0 1 1 1 0;
0 0 0 0 0 1 1 1;
1 0 0 0 0 0 1 1];
x = A\b;
end
You provide b which is a column vector with the sums as you have described, and the output x consists of the original number the people in the table came up with.
e.g
b = [1;
2;
3;
4;
5;
6;
7;
8];
original_numbers(b)
ans =
3
-2
1
4
-1
2
5
0

"sectionIndex" only returns headlines in the first content element

if i set "sectionIndex = true", in the menu only the headlines of the first backend element are shown. But i need all headlines of this page.
This is the code of the dropdownmenu:
2 = TMENU
2 {
wrap = <ul class="dropdown-menu" role="menu">|</ul>
noBlur = 1
expAll = 0
sectionIndex = true
NO = 1
NO.allWrap >
NO.wrapItemAndSub = <li>|</li>
CUR = 1
CUR < .NO
CUR.wrapItemAndSub = <li class="active current">|</li>
ACT = 1
ACT < .NO
ACT.wrapItemAndSub = <li class="active">|</li>
IFUSB < .1.IFSUB
CURIFSUB < .1.CURIFSUB
ACTIFSUB < .1.ACTIFSUB
SPC = 1
SPC.doNotLinkIt = 1
SPC.doNotShowLink = 1
SPC.allWrap = <li class="divider"></li>
}
can anybody help me?
Thanks!
If any have the same problem:
i have found the answer. You have to add this column:
sectionIndex.useColPos = -1

Is there a solution for integrating the tt_news AMENU into my existing HMENU?

My menu structure should be in this format
PressRelease (in the page tree)
Archive (in the page tree)
- Press releases 2012 (from the tt_news archive)
- Press releases 2011 (from the tt_news archive)
This is my HMENU
lib.sidebarmenu = COA
lib.sidebarmenu {
10 = HMENU
10 {
entryLevel = 1
1 = TMENU
1 {
expAll = 1
noBlur = 1
stdWrap.cObject = COA
stdWrap.cObject {
10 = HMENU
10 {
special = rootline
special.range = 1|1
wrap = <h2>|</h2>
1 = TMENU
1.NO.doNotLinkIt = 0
}
20 = HMENU
20 {
entryLevel = 1
1 = TMENU
1 {
expAll = 1
noBlur = 1
NO {
ATagTitle.field = subtitle//title
ATagParams = class="sidebarNav"
stdWrap.htmlSpecialChars = 1
wrapItemAndSub = <li>|</li>
}
ACT = 1
ACT {
wrapItemAndSub = <li class="active"> | </li>
}
}
2 < .1
2.wrap = <ul id="submenu">|</ul>
3 < .2
4 < .2
}
}
wrap = <ul class="tabs"> | </ul>
NO {
}
}
}
}
This is my AMENU
[PIDinRootline = 55]
lib.newsArchiveMenu < plugin.tt_news
lib.newsArchiveMenu {
code >
code = AMENU
pid_list >
pid_list = 42,61,63
singlePid = 44
archiveTypoLink.parameter =55
catImageMode = 0
catTextMode = 0
archiveMode = year
archiveTitleCObject {
10 = TEXT
10.field = start
10.strftime =%Y
}
}
Yes, just put your tt_news menu as next element of COA object (probably just before the end of [PIDinRootline = 55] condition:
lib.sidebarmenu.30 < lib.newsArchiveMenu

Typoscript change menu parameter

I want to generate a menu which changes by a parameter "menu". All menu items have the same pid, therefore the parameter overrideId is set.
So the problem is, the active state doesn't change because I don't change the page. You can see the current script in action via innovisions.artec-berlin.de. It's the menu on the left side.
For some reason the typoscript worked fine in 4.5.2 LTS but not in 4.6.3. Any suggestions or ideas?
lib.menu_main {
# Level 1
1 = TMENU
1.noBlur = 1
1.overrideId = 95
1.expAll = 1
1.wrap = <ul id="outer">|</ul>
1.NO = 1
1.NO.additionalParams.stdWrap.override.insertData = 1
1.NO.additionalParams.stdWrap.override = &menu={field:uid}
1.NO.ATagBeforeWrap = 1
1.NO.insertData = 1
1.NO.linkWrap = <img src="fileadmin/templates/images/arrow_menu.gif" alt="Arrow" title="Arrow" />
1.NO.wrapItemAndSub.insertData = 1
1.NO.wrapItemAndSub = <li id="x1 menu_{field:uid}" class="first>|</li> |*| <li id="xx1 menu_{field:uid}">|</li> |*| <li id="xxx1 menu_{field:uid}" class="last">|</li>
1.NO.ATagTitle.field = subtitle // title
1.ACT = 1
1.ACT.additionalParams.stdWrap.override.insertData = 1
1.ACT.additionalParams.stdWrap.override = &menu={field:uid}
1.ACT.ATagBeforeWrap = 1
1.ACT.linkWrap = <img src="fileadmin/templates/images/arrow_menu.gif" alt="Arrow" title="Arrow" />
1.ACT.wrapItemAndSub.insertData = 1
1.ACT.wrapItemAndSub = <li id="x2 menu_{field:uid}" class="first_active">|</li> |*| <li id="xx2 menu_{field:uid}" class="active">|</li> |*| <li id="xxx2 menu_{field:uid}" class="last">|</li>
1.ACT.ATagTitle.field = subtitle // title
1.CUR = 1
1.CUR.additionalParams.stdWrap.override.insertData = 1
1.CUR.additionalParams.stdWrap.override = &menu={field:uid}
1.CUR.ATagBeforeWrap = 1
1.CUR.linkWrap = <img src="fileadmin/templates/images/arrow_menu.gif" alt="Arrow" title="Arrow" />
1.CUR.wrapItemAndSub.insertData = 1
1.CUR.wrapItemAndSub = <li id="x3 menu_{field:uid}" class="first_active">|</li> |*| <li id="xx3 menu_{field:uid}" class="active">|</li> |*| <li id="xxx3 menu_{field:uid}" class="last_active">|</li>
1.CUR.ATagTitle.field = subtitle // title
# Level 2
2 = TMENU
2.noBlur = 1
2.overrideId = 95
2.expAll = 1
2.wrap = <ul id="inner">|</ul>
2.NO = 1
2.NO.additionalParams.stdWrap.override.insertData = 1
2.NO.additionalParams.stdWrap.override = &menu={field:uid}
2.NO.wrapItemAndSub.insertData = 1
2.NO.wrapItemAndSub = <li id="1 menu_{field:uid}" class="first">|</li> |*| <li id="11 menu_{field:uid}">|</li> |*| <li id="111 menu_{field:uid}" class="last">|</li>
2.NO.ATagTitle.field = subtitle // title
2.ACT = 1
2.ACT.additionalParams.stdWrap.override.insertData = 1
2.ACT.additionalParams.stdWrap.override = &menu={field:uid}
2.ACT.wrapItemAndSub.insertData = 1
2.ACT.wrapItemAndSub = <li id="2 menu_{register:count_HMENU_MENUOBJ}" class="first">|</li> |*| <li id="22 menu_{field:uid}" class="active">|</li> |*| <li id="222 menu_{field:uid}" class="last">|</li>
2.ACT.ATagTitle.field = subtitle // title
2.CUR = 1
2.CUR.additionalParams.stdWrap.override.insertData = 1
2.CUR.additionalParams.stdWrap.override = &menu={field:uid}
2.CUR.wrapItemAndSub.insertData = 1
2.CUR.wrapItemAndSub = <li id="3 menu_{field:uid}" class="first">|</li> |*| <li id="33 menu_{field:uid}" class="active">|</li> |*| <li id="333 menu_{field:uid}" class="last">|</li>
2.CUR.ATagTitle.field = subtitle // title
}