How to get customized Joomla menu along with sub-menu - joomla

I want add schema in my Joomla menu...! Below is code
<?php
$menu = JFactory::getApplication()->getMenu();
// Get menu items - array with menu items
$items = $menu->getItems('menutype', 'mainmenu');
//print_r($items);
?>
<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<?php foreach($items as $i => $menu_item){
?>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/"><?php if($menu_item->level == '1') { echo $menu_item->title; } ?></a>
<?php if($menu_item->level == '2') {?>
<ul>
<li><?php echo $menu_item->title; ?></li>
</ul><?php } ?>
</li>
<?php } ?>
</ul>
problem I am facing is, above not printing sub-menu I could not find any solution
For Example :
<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Home</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">DIFC</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">ADGM</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">About</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Publications</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">FinTech: Now Everybody Wants A Slice of the Pie</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">The Role of Financial Centres in Emerging Economies</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Bitcoin versus Ethereum </a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">ADGM</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">DIFC</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Finance</a>
</li>
<li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Contact</a>
</li>
</ul>
Publication Menu has submenu (FinTech) and two more. I cannot figure it out how to make them print in Submenu

Could you not try this Extension from Tassos Marinos
Dave

Related

TinyButStrong Block Not Working for li tag

If I define my block on the li tag, TBS only shows the first item in the array.
<ul class="nav navbar-nav">
<li class="dropdown nav-item">
Logs<span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li><a class="file" href="/logs/#[logs.key; block=li]">[logs.key]</a></li>
</ul>
</li>
<li class="nav-item">Settings</li>
<li class="nav-item"><span class="navbar-text" id="grepspan"></span></li>
<li class="nav-item"><span class="navbar-text" id="invertspan"></span></li>
</ul>
If I define the block on the a tag, it shows all the items in the array.
<ul class="nav navbar-nav">
<li class="dropdown nav-item">
Logs<span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<a class="file" href="/logs/#[logs.key; block=a]">[logs.key]</a>
</ul>
</li>
<li class="nav-item">Settings</li>
<li class="nav-item"><span class="navbar-text" id="grepspan"></span></li>
<li class="nav-item"><span class="navbar-text" id="invertspan"></span></li>
</ul>
What am I doing wrong here?

How to display just one menu in a dynamic menu

I hava a dynamic menu using VueJs and Laravel. It works fine.
But when I display one of them, all options are displayed.
The menu starts in foreach loop to check menu and assigned options.
Is there any way to restrict this?
My code is the next:
File sidebar.blade.php
<div class="sidebar">
<nav class="sidebar-nav">
<ul class="nav">
<li #click="menu=0" class="nav-item">
<a class="nav-link active" href="#"><i class="icon-speedometer"></i> Escritorio</a>
</li>
<li class="nav-title">
Menú de opciones
</li>
<li class="nav-item nav-dropdown">
#foreach($menus as $menu)
<a class="nav-link nav-dropdown-toggle" href="#"><i class="{{ $menu->icono_menu }}"></i>{{ $menu->nombre }}</a>
#foreach($permisos as $permiso)
#if($menu->id==$permiso->idmenu)
<ul class="nav-dropdown-items">
<li #click="menu={{ $permiso->codigo }}" class="nav-item">
<a class="nav-link" href="#"><i class="{{ $permiso->icono_opcion }}"></i> {{ $permiso->nombre }}</a>
</li>
</ul>
#endif
#endforeach
#endforeach
</li>
<li #click="menu=27" class="nav-item">
<a class="nav-link" href="#"><i class="icon-book-open"></i> Ayuda <span class="badge badge-danger">PDF</span></a>
</li>
<li #click="menu=28" class="nav-item">
<a class="nav-link" href="#"><i class="icon-info"></i> Acerca de...<span class="badge badge-info">IT</span></a>
</li>
</ul>
</nav>
<button class="sidebar-minimizer brand-minimizer" type="button"></button>
</div>

Parsing HTML - Only showing one item not the list

protected async override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string htmlPage = "";
using (var client = new HttpClient())
{
// htmlPage = await client.GetStringAsync("http://m.buses.co.uk/stop.aspx?stopid=6884");
//htmlPage = await client.GetStringAsync("http://www.imdb.com/movies-in-theaters/");
htmlPage = await client.GetStringAsync("http://m.buses.co.uk/destinations.aspx");
}
HtmlDocument htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(htmlPage);
List<Movie> movies = new List<Movie>();
foreach (var div in htmlDocument.DocumentNode.SelectNodes("//div[starts-with(#class, 'menu')]"))
{
Movie newMovie = new Movie();
// newMovie.Cover = div.SelectSingleNode(".//div[#class='image']//img").Attributes["src"].Value;
// newMovie.Title = div.SelectSingleNode(".//h4[#itemprop='name']").InnerText.Trim();
// newMovie.Summary = div.SelectSingleNode(".//div[#class='outline']").InnerText.Trim();
// newMovie.Summary = div.SelectSingleNode(".//div[#class='services']").InnerText.Trim();
newMovie.Summary = div.SelectSingleNode(".//a[starts-with(#href, 'place.aspx')]").InnerText.Trim();
movies.Add(newMovie);
}
lstMovies.ItemsSource = movies;
}
I am trying to get the list of Popular Destinations, the Names of the places, below is the part which I am interested in. I am able with the code above to get the first place - Amex Stadium. But it's not displaying anymore than that.
<div class="menu">
<ul>
<li>
<a href="place.aspx?placeid=1154">
Amex Stadium
</a>
</li>
<li>
<a href="place.aspx?placeid=1136">
Brighton Marina
</a>
</li>
<li>
<a href="place.aspx?placeid=907">
Brighton Station
</a>
</li>
<li>
<a href="place.aspx?placeid=910">
Brighton University Moulsecoomb
</a>
</li>
<li>
<a href="place.aspx?placeid=916">
Churchill Square
</a>
</li>
<li>
<a href="place.aspx?placeid=918">
Coldean
</a>
</li>
<li>
<a href="place.aspx?placeid=924">
County Hospital
</a>
</li>
<li>
<a href="place.aspx?placeid=943">
Eastbourne
</a>
</li>
<li>
<a href="place.aspx?placeid=957">
George Street Hove
</a>
</li>
<li>
<a href="place.aspx?placeid=965">
Hangleton
</a>
</li>
<li>
<a href="place.aspx?placeid=972">
Hollingbury
</a>
</li>
<li>
<a href="place.aspx?placeid=993">
Lewes
</a>
</li>
<li>
<a href="place.aspx?placeid=997">
Longhill School
</a>
</li>
<li>
<a href="place.aspx?placeid=1006">
Mile Oak
</a>
</li>
<li>
<a href="place.aspx?placeid=1011">
Newhaven
</a>
</li>
<li>
<a href="place.aspx?placeid=1134">
North Street
</a>
</li>
<li>
<a href="place.aspx?placeid=1020">
Old Steine
</a>
</li>
<li>
<a href="place.aspx?placeid=1026">
Patcham
</a>
</li>
<li>
<a href="place.aspx?placeid=1028">
Peacehaven
</a>
</li>
<li>
<a href="place.aspx?placeid=1035">
Portslade Station
</a>
</li>
<li>
<a href="place.aspx?placeid=1042">
Queens Park
</a>
</li>
<li>
<a href="place.aspx?placeid=1047">
Rottingdean
</a>
</li>
<li>
<a href="place.aspx?placeid=1057">
Seaford
</a>
</li>
<li>
<a href="place.aspx?placeid=1062">
Shoreham
</a>
</li>
<li>
<a href="place.aspx?placeid=1135">
St Peter's Church
</a>
</li>
<li>
<a href="place.aspx?placeid=1074">
Steyning
</a>
</li>
<li>
<a href="place.aspx?placeid=1076">
Sussex University
</a>
</li>
<li>
<a href="place.aspx?placeid=1080">
Tunbridge Wells
</a>
</li>
<li>
<a href="place.aspx?placeid=1082">
Uckfield
</a>
</li>
<li>
<a href="place.aspx?placeid=1091">
Westdene
</a>
</li>
<li>
<a href="place.aspx?placeid=1092">
Whitehawk
</a>
</li>
<li>
<a href="place.aspx?placeid=1095">
Woodingdean
</a>
</li>
</ul>
</div>
Your selections is wrong. The statement
SelectNodes("//div[starts-with(#class, 'menu')]")
only selects <DIV class="menu"> and since there is only one such DIV you only get one place. You should change it to:
SelectNodes("//div[starts-with(#class, 'menu')]/ul/li")
and then use:
newMovie.Summary = div.SelectSingleNode("a[starts-with(#href, 'place.aspx')]").InnerText.Trim();
Notice, I removed .// from this latter selection.

Custom output html menu in magento

basicly magento generate menu html:
<ul id="nav">
<li class="level0 nav-1 first level-top">
<span>Home</span>
</li>
<li class="level0 nav-1 first level-top parent">
<span>Category</span>
<ul class="level0">
<li class="level1 nav-2-1 first">
<span>Sub Category</span>
</li>
<li class="level1 nav-2-1">
<span>Sub Category</span>
</li>
<li class="level1 nav-2-1 last">
<span>Sub Category</span>
</li>
</ul>
</li>
</ul>
now, i want custom change output html menu (add more class html, add more element html...) somebody can help me?
There's different tutorials for doing this, but here's what I did:
Save /app/code/frontend/design/default/default/template/page/html/topmenu.phtml to /app/code/frontend/design/yourpackagename/yourthemename/template/page/html/topmenu.phtml and edit as follows:
<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>
<div class="nav-container">
<ul id="nav">
<li class="level0 nav-1 first level-top"><a href="/" class="level-top" ><span>Home</span></a></li>
<?php echo $_menu ?>
</ul>
</div>
<?php endif ?>
To get yourpackagename and yourthemename, use System - Configuration - Design
hth, sconnie

change header values based on variable codeigniter

I have the following in my header:
<div id="wrapper" class="homepage itemlist com_k2 category">
<div id="rt-header">
<div class="rt-container">
<div class="rt-grid-3 rt-alpha">
<div class="rt-block"></div>
</div>
<div class="rt-grid-9 rt-omega">
<div class="rt-fusionmenu">
<div class="nopill">
<div class="rt-menubar">
<ul class="menutop level1 ">
<li class="parent root f-main-parent firstItem f-mainparent-item"> <a class="daddy item bullet" href="www.domain.com"> <span> الرئيسية </span> </a> </li>
<li class="active root"> <a class="orphan item bullet" href="load_kitchen_list"> <span> المطبخ </span> </a> </li>
<li class="root"> <a class="orphan item bullet" href=""> <span style="font-size:medium;"> الملف الشخصي </span> </a> </li>
<li class="root"> <a class="orphan item bullet" href="main/contactus"> <span> للإتصال بنا</span> </a> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
Now if you investigate the elements, you will find that there is an active flag in one of them. This makes sure that the currently seen page is highlighted in navigation bar. I want to know how can I change this based on view loaded? this is how I load views:
$this->load->view('layout/header');
$this->load->view('home');
$this->load->view('layout/footer');
So in this case the main navigation tab should be active.
Regards,
I completed something similar recently. Probably not the best way, but it works for me.
In your controller add this before your views
$data['contact'] = 'active';
Then pass the $data variable from the controller to the view
$this->load->view('header', $data);
And in your view add this to the list item
<li class="contact <?php if(isset($contact)) {echo $contact; }">
from the controller:
set names for your menus and put the loaded menu or page name in a variable as the following:
$data['active'] = 'menu1';
$this->load->view('layout/header',$data);
$this->load->view('home');
$this->load->view('layout/footer');
in the view:
<div id="wrapper" class="homepage itemlist com_k2 category">
<div id="rt-header">
<div class="rt-container">
<div class="rt-grid-3 rt-alpha">
<div class="rt-block"></div>
</div>
<div class="rt-grid-9 rt-omega">
<div class="rt-fusionmenu">
<div class="nopill">
<div class="rt-menubar">
<ul class="menutop level1 ">
<li class="<?php if(isset($active) && $active == 'menu1') echo 'active'; ?> parent root f-main-parent firstItem f-mainparent-item"> <a class="daddy item bullet" href="www.domain.com"> <span> الرئيسية </span> </a> </li>
<li class="<?php if(isset($active) && $active == 'menu2') echo 'active'; ?> root"> <a class="orphan item bullet" href="load_kitchen_list"> <span> المطبخ </span> </a> </li>
<li class="<?php if(isset($active) && $active == 'menu3') echo 'active'; ?> root"> <a class="orphan item bullet" href=""> <span style="font-size:medium;"> الملف الشخصي </span> </a> </li>
<li class="<?php if(isset($active) && $active == 'menu4') echo 'active'; ?> root"> <a class="orphan item bullet" href="main/contactus"> <span> للإتصال بنا</span> </a> </li>
</ul>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
Give each menu item a distinct class or id then do it via jQuery or js
<li class="kitchen root"> <a class="orphan item bullet" href="load_kitchen_list"> <span> المطبخ </span> </a> </li>
<li class="anotherclass root"> <a class="orphan item bullet" href=""> <span style="font-size:medium;"> الملف الشخصي </span> </a> </li>
<li class="contact root"> <a class="orphan item bullet" href="main/contactus"> <span> للإتصال بنا</span> </a> </li>
Then for example in the contact page you'd simply do this via jQuery:
$(document).ready(function(){
$(".contact").addClass("active");
});

Resources