How to prevent Yii2 from compiling commented code.
I am new to yii2 and I need to comment some code for later use. Of course the commented code is not working (And that is why it is commented for now) but yii2 prompts errors from amongst them.
<ul class="nav nav-tabs">
<li class="active">
آمار
</li>
<li>
مشخصات
</li>
<!--
<li>
سفارش ها: <?=$model['dataProviderCourierOrders_totalConut']?>
</li>
-->
<li class="disabled">
پیام ها
</li>
</ul>
I get:
Undefined Index: dataProviderCourierOrders_totalConut
Is there a way to stop the commeted code from getting processed in yii2?
You should use the proper comment for php too eg:
<ul class="nav nav-tabs">
<li class="active">
آمار
</li>
<li>
مشخصات
</li>
<!--
<li>
<a href="javascript:void();" id="link_customer_orders">سفارش ها:
<?php // echo $model['dataProviderCourierOrders_totalConut'] ?> </a>
</li>
-->
<li class="disabled">
پیام ها
</li>
</ul>
First solution to comment html with php code show below example
use <?php /* Comment Html or PHP Code Here */ ?> show below
<ul class="nav nav-tabs">
<li class="active">
آمار
</li>
<li>
مشخصات
</li>
<?php /*
<li>
سفارش ها: <?=$model['dataProviderCourierOrders_totalConut']?>
</li>
*/ ?>
<li class="disabled">
پیام ها
</li>
Second solution to comment only php code show below example
use <?= PHP Code ?> to <?php // PHP Code ?> show below
<ul class="nav nav-tabs">
<li class="active">
آمار
</li>
<li>
مشخصات
</li>
<!--
<li>
سفارش ها: <?php // $model['dataProviderCourierOrders_totalConut'] ?>
</li>
-->
<li class="disabled">
پیام ها
</li>
Refer Yii 2 Core Framework Code Style maybe help full to you
Related
Hello so basically I want to make an hidden page/tab that will only show for a specific IP
<ul class="right" id="menu">
<li>
<a class="selected" href="#msg">TEST</a>
</li>
</ul>
You'll need some PHP for this.
<?php
// The <ul> is only showed for this IP adress
if($_SERVER["REMOTE_ADDR"]=='0.0.0.0'){ ?>
<ul class="right" id="menu">
<li>
<a class="selected" href="#msg">TEST</a>
</li>
</ul>
<?php } ?>
I want to output this HTML menu in WordPress. I am confused how to give classes to ul and the first a tag under ul. Thanks.
<div class="side-menu">
<ul>
<li class="dropdown">
Holi Tourism <span class="fa fa-plus"></span>
<ul class="dropdown-menu menu-more">
<li>Mount Kailash Yatra</li>
<li>Char Dham Yatra</li>
<li>Muktinath Yatra</li>
<li>Lumbini Yatra</li>
</ul>
</li>
<li class="dropdown">
Destination <span class="fa fa-plus"></span>
<ul class="dropdown-menu menu-more">
<li>Nepal</li>
<li>Thailand</li>
<li>Singapore</li>
<li>Europe</li>
<li>America</li>
<li>India</li>
</ul>
</li>
<li class="clearfix">Visa Assistance<em class="fa fa-plus"></em></li>
</ul>
Steps:
1. Create a menu from admin of your wordpress and
then, call it in your header.php file in the theme like,
<?php wp_nav_menu( array('menu' => 'Left Navigation Menu', 'menu_class' => 'nav navbar-nav')); ?>
"Left Navigation Menu" is the name of your menu.
I have the following bootstrap menu, the last item in this menu is "More" which is a dropdown contains the left items from that menu, the problem is when user minimize the window the last items start hiding include "More" item.
So my question is: how to avoid the last item ("More") from being hide?
I searched the internet I could not find any solution, I found many are talking about pull left but it did not work for me.
Here is my code:
<div class="collapse navbar-collapse " id="category-navbar-collapse-1">
<ul class="nav navbar-nav ">
<li >
a
</li>
<li >
b
</li>
<li >
c
</li>
<li >
d
</li>
<li class="dropdown ">
<a class="dropdown-toggle" data-toggle="dropdown">
More
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
#Html.Action("GetMoreCategories", "Items")
</ul>
</li>
</ul>
</div>
Any suggestion please?
Feel free to ask for more information.
I'd check the styles over - could be some class name with a breakpoint for display:none on that class. Have a look in Devtools and see what it's throwing out?
As far as your code goes, it looks fine so just check over the CSS, positioning and display, etc.
<div class="collapse navbar-collapse" id="category-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
a
</li>
<li>
b
</li>
<li>
c
</li>
<li>
d
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown">More
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
#Html.Action("GetMoreCategories", "Items")
</ul>
</li>
</ul>
</div>
I have started designing a website using HTML CSS Bootstrap and while making navigation menu dropdown menu is not coming on bringing mouse over instead its showing under it
I am hereby attaching the required code
<ul class="main-menu sf-menu">
<li class="active">Home</li>
<li>Know Your AO/Region/Branch
</li>
<li>HR Section
</li>
<li>General Banking
<ul>
<li> RajBhasha </li>
<li> Security </li>
<li> Miscellaneous </li>
</ul>
</li>
</li>
<li> Advances </li>
<li>IT Section
</li>
<li>Regions
<ul>
<li>Region 1:Nainital </li>
<li>Region 2: Almora </li>
<li>Region 3: Pithoragarh and Champawat </li>
<li>Region 4: Bageshwar and Chamoli </li>
<li>Region 5: Udham Singh Nagar </li>
</ul>
</li>
<li>News
</li>
</li>
<li>Staff Corner</li>
</ul> <!-- /.main-menu -->
</nav>
The result is like thisenter image description here
Please Help....
First add class "dropdwon" in li which you want to make dropdown. Second add class "dropdown-menu" on ul
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<nav>
<ul class="nav navbar-nav mainNavigation">
<li class="active">Home </li>
<li> About Us </li>
<li> Marketing Services </li>
<li> IT Management Services </li>
<li class="dropdown"> Molex Portfolio
<ul class="dropdown-menu">
<li> Fibre Products </li>
<li> Copper Products </li>
</ul>
</li>
<li>Contact Us </li>
<li> Employment Opp </li>
</ul>
</nav>
</div>
and add this css
.dropdown:hover .dropdown-menu{ display:block; }
How can i switch tabs with the links?
This is my current state
<div class="tabbable-panel">
<div class="tabbable-line">
<ul class="nav nav-tabs">
<li class="active">
Home
</li>
<li class="">
Sources
</li>
<li>
Contact Us
</li>
</ul>
</div>
</div>
I can switch between tabs just fine but when i try to make it so that the href lead to another link, it doesn't work. when i change
Home
to
Home
it doesn't work. but then i tried removing the data-toggle and it opens the link but it doesn't show that the tab is active.
Remove the data-toggle and replace it with class="active"
<div class="tabbable-panel">
<div class="tabbable-line">
<ul class="nav nav-tabs">
<li class="active">Home</li>
<li>Sources</li>
<li>Contact Us</li>
</ul>
</div>
</div>
There could be two issues
1. bootstrap.min.js file is not added to the page
2.Specify the data-toggle="tab" on each tab, as well as create a .tab-pane with unique ID for every tab and wrap them in .tab-content.
Codepen- http://codepen.io/nagasai/pen/JKEYod
I figured it out with using some php. here's my code
<div class="tabbable-panel">
<div class="tabbable-line">
<?php
$hom = #_URL.'/home.php';
$sorc = #_URL.'/sources.php';
$cont = #_URL.'/contact.php';
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"
?>
<ul class="nav nav-tabs">
<li class="<?php if($link==$hom){echo "active";}else{echo "";} ?>">
Home
</li>
<li class="<?php if($link==$sorc){echo "active";}else{echo "";} ?>">
Sources
</li>
<li class="<?php if($link==$cont){echo "active";}else{echo "";} ?>">
Contact Us
</li>
</ul>
</div>
</div>
and now it works perfectly