HMENU with graphics - typo3

In a TYPO3 site, I have a list of sibling pages. Each page has some images in the "media" field. Im trying to make a navigation to go to the previos/next sibling. So far I have this:
# Append Sitenavi for projects
[PIDupinRootline = 43]
page.10.marks.MAIN.20 = HMENU
page.10.marks.MAIN.20{
special = browse
special{
items = next|prev
}
1 = TMENU
1{
NO = 1
}
}
[global]
But instead of using the page title, id like to use the first image from the "files" field. How could I do it?

This is the way to get other fields:
page.10.marks.MAIN.20 = HMENU
page.10.marks.MAIN.20 {
special = browse
special {
items = prev | next
}
1 = TMENU
1 {
NO = 1
NO.stdWrap.field = subtitle // title
}
}
Now if your change subtitle // title to image and add NO.stdWrap.wrap = <img src"|" />, then it should work.

Related

TYPO3 Hide & Replace Pagetitle in Breadcrumb

I have a little problem with my navigation and couldn't get it work...I got on every page a breadcrumb navigation which shows the page tree until the current page.
So far so good but when I go to the details page of my news I got the following tree Home > Newest > Article. I don't want to have the page title Article here because every other news would have this tree. Instead of the pagetitle I want to have the news title so I modified my navigation like this:
30 = HMENU
30 {
special = rootline
special.range = 0 | -1
1 = TMENU
1 {
stdWrap.dataWrap = <p>{ date : d.m.Y } ::: |
NO = 1
NO {
wrapItemAndSub = | >
stdWrap.htmlSpecialChars = 1
}
CUR = 1
CUR.allWrap = | </p>
stdWrap.append = RECORDS
stdWrap.append {
if.isTrue.data = GP:tx_news_pi1|news
tables = tx_news_domain_model_news
source.data = GP:tx_news_pi1|news
source.intval = 1
conf.tx_news_domain_model_news = TEXT
conf.tx_news_domain_model_news {
field = title
htmlSpecialChars = 1
}
}
}
}
And now the problem: when I click go on a page which is hidden in menus the breadcrumb looks like this Home >. Obviously the last page isn't displayed and this should be solved but I don't know how to do it.
At least I tried something with this in some combinations but cant't get it work
if {
value = 46
equals.field = uid
excludeUidList = 46 //includeNotInMenu = 1
}
When adding includeNotInMenu = 1 under the special.range hidden pages are shown in the breadcrumb title but then the breadcrum in news looks like this Home > Newest > Article NewsTitle and I don't want to have this 'Article' in it. Hope someone of you can help me!
first:
not displaying the current page is ok only for the news-detail page. so use a condition to realize it:
[page|uid = 123]
30.30.special.range = 1|-2
[global]
second:
add the current news title after the menu. the handling is a littel bit easier.
30.40 = RECORDS
30.40 {
tables = tx_news_domain_model_news
source.data = GP:tx_news_pi1|news
source.intval = 1
conf.tx_news_domain_model_news = TEXT
conf.tx_news_domain_model_news {
field = title
htmlSpecialChars = 1
}
}
therefore you might need to change the wrap. either split it or (better) give it an additional COA level.
and so the news title only is neccessary on your detail page you put that code into the condition.
Alternatives:
you can use .stdWrap.if to modify the range of the breadcrumb and the display of the news title, but with the TS-condition you have a smaller typoscript for normal pages (faster rendering).
You even need no condition for the tx_news_pi1|news parameter, as the detail page normaly would not show anything (except an error)
For example (since Ext news 7.2) to hide News Detail page in the breadcrumb..
Home > News > News Detail > Article name
page.10.dataProcessing {
100 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
100 {
special = rootline
special.range = 0|-1
includeNotInMenu = 1
as = breadcrumb
}
110 = GeorgRinger\News\DataProcessing\AddNewsToMenuProcessor
110.menus = breadcrumb
}
[page["uid"] == {$pages.newsDetail}]
page.10.dataProcessing.100.special.range = 0|-2
[END]
Results in
Home > News > Article name

TYPO3 8.7 - Link Target ist missing in navigation for page typ external URL

After update from TYPO3 7.6.16 to 8.7 in my navigation (TMENU) the target _blank is no longer output for pages of typ external URL. In page properties the target flag _blank is entered. Any hints?
Try this, working for me:
lib.mainmenuu = HMENU
lib.mainmenuu {
special = directory
special.value = 1
1=TMENU
1.wrap=<ul>|</ul>
1.NO {
# do not create a link here else there are double <a> tags
doNotLinkIt = 1
wrapItemAndSub=<li>|</li>
stdWrap.cObject = CASE
stdWrap.cObject {
key.field = doktype
default = TEXT
default {
field = title
typolink.parameter.field = uid
stdWrap.htmlSpecialChars = 1
}
# 3 = external url
3 = TEXT
3 {
field = title
typolink.parameter.field = url
typolink.extTarget = _blank
}
}
}
}
Here, use your news detail page id instead of 27. this will override default page title with current detail news title.

TYPO3 tt_news genericmarkers url for every news item on list view

I create the genericmarker (###GENERIC_URL###) of "current" url and display it on single view page.
plugin.tt_news {
genericmarkers.URL = TEXT
genericmarkers.URL {
data = getIndpEnv:TYPO3_REQUEST_URL
wrap = link: |
}
}
Is it possible to get the tt_news url for every news item and display it on list view as a additional url link?
If I understood you correctly, you need single view url ?
This should work :
plugin.tt_news.genericmarkers.URL = COA
plugin.tt_news.genericmarkers.URL {
1 = TEXT
1.data = TSFE:baseUrl
2 = TEXT
2 {
value =
typolink = 1
typolink {
# Change 1 to page UID where your single view plugin is placed
parameter = 1
additionalParams = &tx_ttnews[tt_news]={field:uid}
additionalParams.insertData = 1
returnLast = url
}
}
}

TypoScript menu, with special treatment for specific pageIDs contained in list

Tearing my hair out over a TypoScript menu. I need the following behaviour:
A list of "special" menu items pageIDs is maintained in constant {$SPECIAL}
A HMENU is rendered showing the navigation of the site root. If the pageID is "special", then it gets a special div wrap, and a list of its child pages is nested inside of the div wrap. If the item is NOT "special", then it gets no special wrap, and no child pages are shown. All "special" items are shown at the top of the page list.
I've tried a couple of approaches:
Approach 1. Render two HMENUs, one after the other. First menu shows only {$SPECIAL}, second menu shows the siteroot, excluding the {$SPECIAL} items.
Problem: if I use special.directory to show {$SPECIAL}, the parent pages are not rendered. If I use special.list, the child pages are not rendered. Argh!
Approach 2. Render a big chunk of custom menu TS, using if conditions to check if the page is {$SPECIAL}
Problem: I can get the special wraps to show on {$SPECIAL} items, but I can't work out how to then render a list of the child pages specific to each item.
My code for Approach 2 is, so far:
MAIN_NAV.20 = HMENU
MAIN_NAV.20 {
special = directory
special.value = {$SITE_ROOT}
excludeUidList = {$RESTRICTED_ROOT}, {$HOME_SHORTCUT}
1 = TMENU
1{
NO{
# suppress standard menu output
doNotShowLink = 1
# build each menu item conditionally
stdWrap2.cObject = COA
stdWrap2.cObject{
#Standard
10 = TEXT
10{
# not in list of special pages?
if.value = {$NAV_CONTAINERS}
if.isInList.field = uid
if.negate = 1
field = nav_title//title
typolink.parameter.field = uid
wrap = <ul><li>|</li></ul>
}
#Special
20 = TEXT
20.wrap = <div class="SPECIAL"><ul><li><span>|</span>
20 {
if.value.field = uid
if.equals = {$SPECIAL}
field = nav_title//title
}
30 = TEXT
30.wrap = |</li></ul></div>
30 {
if.value.field = uid
if.equals = {$SPECIAL}
}
}
}
}
}
I can't hardcode this (like "Special item 1 as a text element, then Special item 1 children as a menu, then Special item 1 as a text element, then Special item 2 children...") because {$SPECIAL} could theoretically wind up being any number of pages.
Can anyone offer any suggestions to assist with one or other approach?
I think user Ila is right, if you use special = list, you should be able to add multiple levels (child pages) by adding TMENUs.
On the other hand, I've got a similar menu I'd like to share. It contains two kinds of special rendering cases - one with override.if and the other one with CASE.
temp.mainnav = HMENU
temp.mainnav {
wrap = <nav>|</nav>
entryLevel = 0
1 = TMENU
1 {
noBlur = 1
expAll = 1
wrap = <ul>|</ul>
NO {
wrapItemAndSub=<li class="p{page:uid}">|</li>
wrapItemAndSub.insertData = 1
}
}
2 = TMENU
2 {
noBlur = 1
expAll = 1
NO {
wrapItemAndSub=<li>|</li>
// http://labor.99grad.de/2013/07/10/typo3-hmenu-einen-menupunkt-anders-darstellen/
doNotLinkIt.override = 1
doNotLinkIt.override.if {
value = {$pidsDoNotLinkInMenu}
isInList.field = uid
}
stdWrap.wrap.override = <p class="unlinkedMenuItem">|</p>
stdWrap.wrap.override.if {
value = {$pidsDoNotLinkInMenu}
isInList.field = uid
}
}
}
3 = TMENU
3 {
noBlur = 1
expAll = 1
wrap = <ul class="level3">|</ul>
NO.wrapItemAndSub.cObject = CASE
NO.wrapItemAndSub.cObject {
//http://stackoverflow.com/questions/18899573/how-to-apply-a-different-wrap-in-a-tmenu-for-certain-items-only/18910302?noredirect=1#18910302
key.field = uid
// normal item
default = TEXT
default.value = <li class="level3">|</li>
// special item
{$somePid} = TEXT
{$somePid}.value = <li class="level3 foo">|</li>
{$somePid}.append < temp.sometemp
// some other special item
{$someOtherpid} = TEXT
{$someOtherpid}.value = <li class="level3 bar">|</li>
{$someOtherpid}.append < temp.someothertemp
}
}
}
I think both approaches could be used to achieve your goal.

Subpage Links with image and text

I try to implement a page which contains images to certain subpages. For each subpage, I have a seperate image. I want to display for each subpage the appropriate image "galerie_XX.png" an show the name of the subpage above the image. So far I got:
galerielabel = HMENU
galerielabel.special = directory
galerielabel{
1 = TMENU
1.NO.stdWrap{
wrap = <img src="fileadmin/templates/images/galerie/galerie_|.png" />
}
}
The Subpages are year names, like 2012, 2013... This script shows me the required images as a link.
My question is, how can I add the name of the subpages above the image?
Thank you in advance.
I suggest a different approach.
You can add images in the page properties.
Then, your menu could be like this:
lib.menu = COA
lib.menu.10 = HMENU
lib.menu.10 {
10 = HMENU
10.1 = TMENU
10.1.NO.doNotShowLink = 1 #will remove the link altogether
10.1.NO.before.cObject = COA
10.1.NO.before.cObject {
10 = TEXT
10.field = title #title of the page, change to any field you like
20 = IMAGE
20.file.import = uploads/media/ #4.x style
20.file.import.field = media
20.file.import.listNum = 0 #use first image referenced
20.width = 200 #set to imagesize of your liking
30 = TEXT
30.value = Do what you like here
}
}
Untested: the title of the page should be prepended
galerielabel = HMENU
galerielabel.special = directory
galerielabel{
1 = TMENU
1.NO.stdWrap{
# Prepend with page.title
prepend = TEXT
prepend {
field = title
htmlSpecialChars = 1
}
wrap = <img src="fileadmin/templates/images/galerie/galerie_|.png" />
}
}