TYPO3 Language Switch with FLUID - menu

I've made a language menu (switch) for TYPO3 7.6 with Fluid only, no TypoScript. Just a Dropdown, see screenshot below. I also used the Ext:vhs, here's my code example:
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<ul id="languageMenu" class="dropdown menu" data-dropdown-menu>
<!-- german L:0 -->
<f:if condition="{v:page.language()}==0">
<li class="de">
<f:link.page pageUid="{page.uid}" additionalParams="{L:0}">
<f:image src="EXT:myext/Resources/Public/Icons/Flags/de.svg" width="18" height="14" alt="" />
<f:translate key="LLL:EXT:myext/Resources/Private/Language/locallang.xlf:language.de" />
</f:link.page>
<ul class="menu languageSubMenu">
<li class="en">
<f:link.page pageUid="{page.uid}" additionalParams="{L:1}">
<f:image src="EXT:myext/Resources/Public/Icons/Flags/gb.svg" width="18" height="14" alt="" />
<f:translate key="LLL:EXT:myext/Resources/Private/Language/locallang.xlf:language.en" />
</f:link.page>
</li>
</ul>
</li>
</f:if>
<!-- english L:1 -->
<f:if condition="{v:page.language()}==1">
<li class="en">
<f:link.page pageUid="{page.uid}" additionalParams="{L:1}">
<f:image src="EXT:hellocode/Resources/Public/Icons/Flags/gb.svg" width="18" height="14"
alt="{f:translate(key: 'LLL:EXT:hellocode/Resources/Private/Language/locallang.xlf:language.en')}" />
<f:translate key="LLL:EXT:myext/Resources/Private/Language/locallang.xlf:language.en" />
</f:link.page>
<ul class="menu languageSubMenu">
<li class="de">
<f:link.page pageUid="{page.uid}" additionalParams="{L:0}">
<f:image src="EXT:myext/Resources/Public/Icons/Flags/de.svg" width="18" height="14" alt="" />
<f:translate key="LLL:EXT:myext/Resources/Private/Language/locallang.xlf:language.de" />
</f:link.page>
</li>
</ul>
</li>
</f:if>
</ul>
At the moment the language switch is always shown. If there's no page translation, I'll get an 404 Error. Of course, the missing page aren't exist. How can I hide my language switch, if there's no translation?
In past I used USERDEF1 with TypoScript, but I need a solution with Fluid. I also see there's a viewhelper v:condition.page.isLanguage but this isn't working for me or I don't know how?! Is it possible to do this with Fluid or vhs?
I would be grateful for any advice. Otherwise I have to write typoscript again ...

You don't need extension for that. The viewhelpers languageMenu is enough.
Here the code I use, ok for accessibility, working with bootstrap 4 :
<div class="navbar-nav mr-auto dropdown show">
<v:page.languageMenu
hideNotTranslated="1"
order="0,1,2,3"
layout="name"
defaultLanguageLabel="Français"
defaultIsoFlag="fr"
labelOverwrite="FR,EN,NL,ES"
as="menu">
<ul class="navbar-nav mr-auto">
<f:for each="{menu}" as="langMenu">
<li class="nav-item>
<f:if condition="{langMenu.current}=1">
<f:link.page pageUid="{page.uid}"
id="dropdownMenuLink"
class="dropdown-toggle nav-link lang px-3 flag-nav--{langMenu.flag}"
additionalAttributes="{data-toggle:'dropdown', aria-haspopup:'true', aria-expanded:'false'}"
lang="{f:if(condition: '{langMenu.current}=1', then: '{langMenu.flag}')}"
title="<f:switch expression='{langMenu.flag}'>
<f:case value='fr'>français actif, changer de langue</f:case>
<f:case value='gb'>english activate, modify language</f:case>
<f:case value='nl'>Engels activeren, taal wijzigen</f:case>
<f:case value='es'>Español activo, cambio de idioma</f:case>
</f:switch>"
>
{langMenu.label}
</f:link.page>
</f:if>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink" aria-expended="false">
<f:for each="{menu}" as="langMenu">
<f:switch expression='{langMenu.flag}'>
<f:case value='fr'>{v:variable.set(value: '0', name: 'langparam')}</f:case>
<f:case value='gb'>{v:variable.set(value: '1', name: 'langparam')}</f:case>
<f:case value='nl'>{v:variable.set(value: '2', name: 'langparam')}</f:case>
<f:case value='nl'>{v:variable.set(value: '3', name: 'langparam')}</f:case>
</f:switch>
<li>
<f:link.page pageUid="{page.uid}"
class="dropdown-item"
lang="{langMenu.flag}"
title="<f:switch expression='{langMenu.flag}'>
<f:case value='fr'>Passer le site en français</f:case>
<f:case value='gb'>Go to english version</f:case>
<f:case value='nl'>Ga naar de nederlandse versie</f:case>
<f:case value='es'>Salta el sitio en español</f:case>
</f:switch>"
additionalParams="{L:'{langparam}'}"
>
{langMenu.label}
</f:link.page>
</li>
</f:for>
</ul>
</li>
</f:for>
</ul>
</v:page.languageMenu>
</div>

I can only propose to use https://typo3.org/extensions/repository/view/sr_language_menu
You can simply use it like that: https://bitbucket.org/reelworx/rx-typo3-sitesetup/src/e34b675a223f02580838fe7d5d118d7f07fd8a68/Resources/Private/Layouts/Default.html?at=master&fileviewer=file-view-default#Default.html-48
Of course it is fully Fluid based, so you can override all templates to your needs.

You can use vhs and the ViewHelpers LanguageMenu
[https://fluidtypo3.org/viewhelpers/vhs/master/Page/LanguageMenuViewHelper.html][1]

Related

Why does <nuxt-link> overwrites my css in Nuxt.js?

I am getting this issue with Nuxt.
Whenever I use , it automatically rewrites my CSS design and shows it differently. You can see exact issue in the video below.
Video of the issue
If I replace <nuxt-link> with <a>, everything starts to work correctly.
Navbar code example:
<nav class="navbar navbar-expand-lg navbar-dark mb-5 text-white" style="z-index: 10; background-color: rgba(0,0,0,0.3)">
<nuxt-link to="/" class="navbar-brand" active-class="active">
Frontend
</nuxt-link>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon" />
</button>
<div id="navbarNav" class="collapse navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item active">
<nuxt-link to="/" class="nav-link" active-class="active">
Home
</nuxt-link>
</li>
<li class="nav-item">
<nuxt-link to="/games" class="nav-link" active-class="active">
Games
</nuxt-link>
</li>
</ul>
Correct css (at the start of the page loading)
Incorrect css (after a few seconds)
Issue was with <style> in index.vue (main page).
Changed it to <style scoped> and the issue is fixed.

How to transform a <ul> element into a DataTable?

I want to transform this <ul> into a DataTable:
<ul>
<li><a href="#"> <p:graphicImage
name="images/child_M.png" library="ultima-layout" width="72" />
<span class="name">Joshua Williams</span> <span class="email">joshua#pf-ultima.com</span>
</a></li>
<li><a href="#"> <p:graphicImage
name="images/child_M.png" library="ultima-layout" width="72" />
<span class="name">Emily Clark</span> <span class="email">emily#pf-ultima.com</span>
</a></li>
<li><a href="#"> <p:graphicImage
name="images/child_F.png" library="ultima-layout" width="72" />
<span class="name">Susan Johnson</span> <span class="email">susan#pf-ultima.com</span>
</a></li>
<li><a href="#"> <p:graphicImage
name="images/child_F.png" library="ultima-layout" width="72" />
<span class="name">Kelly Stark</span> <span class="email">kelly#pf-ultima.com</span>
</a></li>
</ul>
Where I want to replace the name and email values with the correct ones, that come from a list (from the value element of the Datatable).This <ul> element layout is very good, since the text is on the right, good font and the image on the left and I want to replicate it within a DataTable.

Dynamic Tab + bootstrap + angular5

I am new to Front-End and angular part. I need to load tabs dynamically from what it returned from Backend...
Consider i am getting an array as like below :
*["tab1","tab2","tab3"].*
I have show tabs in a page with tab1, tab2, tab3.
What i have tried is hardcoded , its working,
<div class="nav-tabs-custom">
<ul class="nav nav-tabs" >
<li class="active"><b>tab1</b></li>
<li><b>tab2</b></li>
<li><b>tab3</b></li>
<li><b>tab4</b></li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane active" id="tab_1"> </div>
<div class="tab-pane active" id="tab_2"> </div>
<div class="tab-pane active" id="tab_3"> </div>
<div class="tab-pane active" id="tab_4"> </div>
</div>
Also i have to make sure that on click of the tab it should call a method with clicked name. All should be dynamic. Please suggest your ideas.Thanks.
you have to change href="#id" to data-target="#id"
<div class="nav-tabs-custom">
<ul class="nav nav-tabs" >
<li class="active"><a data-target="#tab_1" data-toggle="tab" (click)="loadData('abc')"><b>tab1</b></a></li>
<li><a data-target="#tab_2" data-toggle="tab" (click)="loadData('xxx')"><b>tab2</b></a></li>
<li><a data-target="#tab_3" data-toggle="tab" (click)="loadData('xyz')"><b>tab3</b></a></li>
<li><a data-target="#tab_4" data-toggle="tab" (click)="loadData('fgfgfg')"><b>tab4</b></a></li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane active" id="tab_1"> </div>
<div class="tab-pane active" id="tab_2"> </div>
<div class="tab-pane active" id="tab_3"> </div>
<div class="tab-pane active" id="tab_4"> </div>
</div>
I achieved such functionality using ngx-Bootstrap
Array of tabs:
tabs: any[] = [{
title: 'Dynamic Title 1',
content: 'Dynamic content 1'
},
{
title: 'Dynamic Title 2',
content: 'Dynamic content 2'
},
{
title: 'Dynamic Title 3',
content: 'Dynamic content 3',
removable: true
}
];
Display tabs:
<tabset>
<tab heading="Static title">Static content</tab>
<tab *ngFor="let tabz of tabs"
[heading]="tabz.title"
[active]="tabz.active"
(select)="tabz.active = true"
[disabled]="tabz.disabled"
[removable]="tabz.removable"
(removed)="removeTabHandler(tabz)"
[customClass]="tabz.customClass">
{{tabz?.content}}
</tab>
</tabset>
Check full usage here.
So, there are different ways of implementing it. One way as suggested by #Comann will definitely work. The other way of doing the same thing would be installing bootstrap dependency - try doing
npm install --save bootstrap
Import this in your styles.css file
#import '~bootstrap/dist/css/bootstrap.css';
You can also import it in your angular.json file assuming you might have generated the project using angular-cli. I prefer it to be in styles.css.
Create a separate navbar component and in the template
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" routerLink="/route1">Route1<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/route2">Route 2</a>
</li>
</ul>
</div>
</nav>
<router-outlet></router-outlet>
Instead of having the two router links hard coded you will loop around with *ngFor on the array of tabs and populate it. Hope this helps.

bootstrap social media icons above menu

I am using Bootstrap and trying to get the social media icons above the menu - so far I have:
What I am aiming for is something like this:
So the image is at the end - and the menu items are still responsive.
The code I have so far is :
<header class="navbar navbar-inverse header-outer" role="banner">
<div class="container">
<img src="logo1.png " alt="Image" id="logo" class="img-responsive pull-left" />
<div class="social_media">
<ul class="nav navbar-nav pull-left padding-top nextline">
<li><img src="facebook.png" /></li>
<li><img src="twitter.png" /></li>
<li><img src="linkdin.png" /></li>
<li><img src="instagram.png" /></li>
</ul>
</div>
<div class="pull-left padding-top">
<ul class="nav navbar-nav navbar-right">
<li>Sign Up</li>
<li>Sign In</li>
<li>About</li>
</ul>
</div>
<button style="position:relative; left:0;">CONTACT WITH US</button>
</div>
</header>
and the CSS is:
<style>
.social_media {
width: 100%;
}
.navbar{ background:#ffffff; border:none;}
.nextline {
width:80%;
border-bottom : 1px solid #000000;
}
</style>
Has anyone done anything like this???
You have to put another div around the lower part to group it. Only then you can assure that the contact button can be inline with your underline of the social media section, as you set the width to the same as your nextline class. This way you get a container for the part below the line, that has the same width, and you can align the button as you want.
So your code should look like
<div class="pull-left padding-top" style="width:80%">
<div class="pull-left padding-top">
<ul class="nav navbar-nav navbar-right">
<li>Sign Up</li>
<li>Sign In</li>
<li>About</li>
</ul>
</div>
<button class="pull-right padding-top">CONTACT WITH US</button>
</div>
A simple jsfiddle for whole code
https://jsfiddle.net/87xz8q9x/5/
Hope this helps

foundation 6 menu not working on Ipad

I am trying to create a foundation 6 site with a fairly large menu, I have created a codepen of the exact menu here:
https://codepen.io/ianims/pen/WOWazM
The Code is as shown:
<body>
<div class="top-bar ">
<div>
<div class="header_logo">
<a href="index.php">
<div class="header_logo_first">Yacht Charters</div>
</a>
<div class="header_logo_text">Yacht Management and Charter</div>
</div>
</div>
<div class="top-bar-right">
<div class="contact_details">
<div class="contact_left"><img src="././images/my_account.png" >MY ACCOUNT</div>
<div class="contact_left"><img src="././images/phone.png">+44 207 112233</div>
<div class="contact_right"><img src="././images/mail.png">me#somewhere.com</div>
</div>
</div>
</div>
<div class="top-bar ">
<div class="title-bar" data-responsive-toggle="example-menu" data-hide-for="large">
<button class="menu-icon" type="button" data-toggle="example-menu"></button>
<div class="title-bar-title">Menu</div>
</div>
<!-- <ul class="vertical medium-horizontal menu" data-responsive-menu="accordion medium-dropdown" style="background:#000000;" id="example-menu"> -->
<ul class="vertical medium-horizontal menu" data-responsive-menu="accordion dropdown" style="background:#000000;" id="example-menu">
<li>
<!-- INTRO -->
Introduction
<ul class="vertical menu" style="background:#000000;">
<li>Introduction</li>
<li>The DiYachting Team</li>
<li>Contact Us</li>
<li>Corporate Partners</li>
</ul>
</li>
<li>
<!-- CHARTER -->
Charter
<ul class="vertical menu" style="background:#000000;">
<li>Introduction</li>
<li>Our Yachts</li>
<li>Destinations</li>
<li>FAQs</li>
</ul>
</li>
<li>
<!-- MANAGEMENT -->
Management
<ul class="vertical menu" style="background:#000000;">
<li>Introduction</li>
<li>Yacht Management</li>
<li>Consultancy</li>
<li>Logistics</li>
<li>Financial</li>
<li>Compliance</li>
<li>Technical</li>
<li>Crew</li>
<li>Charter Management</li>
<li>Resources</li>
</ul>
</li>
<li>
<!-- PURCHASE -->
Purchase
<ul class="vertical menu" style="background:#000000;">
<li>PURCHASE</li>
</ul>
</li>
<li>
<!-- REGISTRATION -->
Registration
<ul class="vertical menu" style="background:#000000;">
<li>Introduction</li>
<li>British and Jersey Registration</li>
<li>Tonnage Surveys</li>
<li>Uk Reprasentative</li>
</ul>
</li>
<li>
<!-- COMPLIANCE -->
Compliance
<ul class="vertical menu" style="background:#000000;">
<li>Introduction</li>
<li>MCA Coding</li>
<li>MLC Compliance</li>
<li>Equipment, Supply and Install</li>
<li>Renewal Inspections & Equipment Service</li>
<li>MCA Surveys Worldwide</li>
</ul>
</li>
<li>
<!-- TECHNICAL -->
Technical
<ul class="vertical menu" style="background:#000000;">
<li>Introduction</li>
<li>Maintenance</li>
<li>Spare Parts</li>
<li>Wintervention</li>
<li>Summer Service</li>
<li>Haul Out Management</li>
<li>Refits</li>
<li>Equipment</li>
</ul>
</li>
<li>
<!-- CREW -->
Crew
<ul class="vertical menu" style="background:#000000;">
<li>Introduction</li>
<li>Recruitment</li>
<li>Employment</li>
<li>Temporary / Short Term Crew</li>
<li>Vacancies and Apply</li>
</ul>
</li>
<!-- NEWS -->
<li>
News
<ul class="vertical menu" style="background:#000000;">
<li>News</li>
<li>DiYachting Press</li>
<li>Upcoming Events</li>
</ul>
</li>
<!-- PRESS -->
<li>
Press
<ul class="vertical menu" style="background:#000000;">
<li>Press Pack</li>
<li>In The Press</li>
<li>Meet Us</li>
<li>Contact</li>
</ul>
</li>
</ul>
</div>
The menu works fine on larger screens laptop, desktop and also small screens , but on a IPad the menu is off the screen to the right -- any ideas??
I was using the following link:
https://dhbhdrzi4tiry.cloudfront.net/cdn/sites/foundation.js
I downloaded the latest foundation files and used those instead - this solved the problem!!

Resources