PHP Menu item breaks all following menu items - php

The menus are all separated into PHP includes and called in the main index.php file. The issue is all of the menu items work fine until a specific menu item. At which point that linked page and all of the following links after it in the menu stop functioning without any sort of inspector error. The problem page is titled eva.php. From what I can tell the original creator of the site has all of the pages are being called correctly, but I'm fairly new to PHP so forgive any ignorance on my part.
Index File:
<!doctype html>
<html lang="en">
<head>
<?php require_once('inc/meta.php'); ?>
<?php require_once('inc/script.php'); ?>
<?php require_once('inc/styles.php'); ?>
</head>
<body>
<div id="slidemenu" class="scrollable closed">
<ul id="menuAll">
<h2>Applications</h2>
<li>Furniture, Cabinet & Countertop Substrates</li>
<li>Engineered Flooring Substrates</li>
<li>Flooring, Furniture, Cabinet & Countertop Laminates</li>
<li>Molding & Millwork</li>
<li>Doors & Windows</li>
<li>Framing</li>
<li>Sheathing</li>
<li>Roofing</li>
<li>Insulation</li>
<li>Decks, Porches, Cladding & Fences</li>
<h2>More</h2>
<li>Sustainability</li>
<li>Formaldehyde in Construction Video</li>
</ul>
<?php require_once('inc/menu-framing.php'); ?>
<?php require_once('inc/menu-cabinets-counters.php'); ?>
<?php require_once('inc/menu-flooring-furniture-cabinets-counters.php'); ?>
<?php require_once('inc/menu-doors-windows.php'); ?>
<?php require_once('inc/menu-furniture.php'); ?>
<?php require_once('inc/menu-sheathing.php'); ?>
<?php require_once('inc/menu-roofing.php'); ?>
<?php require_once('inc/menu-insulation.php'); ?>
<?php require_once('inc/menu-moulding-millwork.php'); ?>
<?php require_once('inc/menu-engineered-flooring.php'); ?>
<?php require_once('inc/menu-locations.php'); ?>
<?php require_once('inc/menu-decks.php'); ?>
</div>
<div data-role="page" id="main_page" data-theme="a">
<div data-role="header"> ☰
</div>
</div>
<?php require_once('inc/page-other.php'); ?>
<?php require_once('inc/page-urea-formaldehyde.php'); ?>
<?php require_once('inc/page-melamine-formaldehyde-powder.php'); ?>
<?php require_once('inc/page-melamine-urea-formaldehyde.php'); ?>
<?php require_once('inc/page-resorcinol-formaldehyde.php'); ?>
<?php require_once('inc/page-phenol-resorcinol-formaldehyde.php'); ?>
<?php require_once('inc/page-emulsion-polymerized-isocyanate.php'); ?>
<?php require_once('inc/page-polyvinyl-acetate.php'); ?>
<?php require_once('inc/page-polyurethane-dispersions.php'); ?>
<?php require_once('inc/page-hot-melts.php'); ?>
<?php require_once('inc/page-casein-glues.php'); ?>
<?php require_once('inc/page-phenol-formaldehyde.php'); ?>
<?php require_once('inc/page-phenol-formaldehyde-adhesive.php'); ?>
<?php require_once('inc/page-phenol-formaldehyde-powder.php'); ?>
<?php require_once('inc/page-phenol-resorcinol-based-resins.php'); ?>
<?php require_once('inc/page-wax-emulsions.php'); ?>
<?php require_once('inc/page-melamine-urea-phenol-formaldehyde.php'); ?>
<?php require_once('inc/page-pva-adhesives.php'); ?>
<?php require_once('inc/page-melamine-based-resins.php'); ?>
<?php require_once('inc/page-melamine-resorcinol-based-resins.php'); ?>
<?php require_once('inc/page-resorcinol-based-resins.php'); ?>
<?php require_once('inc/page-fentak.php'); ?>
<?php require_once('inc/page-osb-specialized.php'); ?>
<?php require_once('inc/page-phenolic-resins.php'); ?>
<?php require_once('inc/page-amino-resins.php'); ?>
<?php require_once('inc/page-wood.php'); ?>
<?php require_once('inc/page-eva.php'); ?> <-- PROBLEM PAGE
<?php require_once('inc/page-lvl-ready.php'); ?>
<?php require_once('inc/page-lvl-reactor.php'); ?>
<?php require_once('inc/page-lvl-in-plant.php'); ?>
<?php require_once('inc/page-sustainability.php'); ?>
<?php require_once('inc/page-video1.php'); ?>
<?php require_once('inc/page-video2.php'); ?>
<?php require_once('inc/page-na.php'); ?>
<?php require_once('inc/page-sa.php'); ?>
<?php require_once('inc/page-apac.php'); ?>
<?php require_once('inc/page-europe.php'); ?>
</body>
</html>
Menu Include:
<ul id="menuFlooringFurnitureCabinetsCounters">
<h2>Flooring, Furniture, Cabinet & Countertop Laminates</h2>
<li><a href="#">
<img src="img/thumb/particleboard.jpg" width="70" height="70" />
<h3>Countertop Laminates</h3></a>
<ul>
<h4>Countertop Laminates</h4>
<li><a data-prefetch href="#page-urea-formaldehyde">Urea Formaldehyde Resins</a></li>
<li><a data-prefetch href="#page-melamine-formaldehyde-powder">Melamine Formaldehyde Resins</a></li>
<li><a data-prefetch href="#page-melamine-urea-formaldehyde">Melamine-Urea Formaldehyde Resins</a></li>
<li><a data-prefetch href="#page-polyvinyl-acetate">Polyvinyl Acetate Adhesives</a></li>
<li><a data-prefetch href="#page-eva">Ethylene Vinyl Acetate Adhesives</a></li>
<li><a data-prefetch href="#page-fentak">Fentak Additives</a></li>
</ul>
</li>
<li><a href="#">
<img src="img/thumb/mdf.jpg" width="70" height="70" />
<h3>Cabinet Laminates</h3></a>
<ul>
<h4>Cabinet Laminates</h4>
<li><a data-prefetch href="#page-fentak">Fentak Additives</a></li>
<li><a data-prefetch href="#page-urea-formaldehyde">Urea Formaldehyde Resins</a></li>
<li><a data-prefetch href="#page-melamine-urea-formaldehyde">Melamine-urea Formaldehyde Resins</a></li>
<li><a data-prefetch href="#page-melamine-formaldehyde-powder">Melamine Formaldehyde Resins</a></li>
<li><a data-prefetch href="#page-polyvinyl-acetate">Polyvinyl Acetate Adhesives</a></li>
<li><a data-prefetch href="#page-eva">Ethylene Vinyl Acetate Adhesives</a></li>
</ul>
</li>
<li><a href="#">
<img src="img/thumb/plywood.jpg" width="70" height="70" />
<h3>Flooring Laminates</h3></a>
<ul>
<h4>Flooring Laminates</h4>
<li><a data-prefetch href="#page-fentak">Fentak Additives</a></li>
<li><a data-prefetch href="#page-urea-formaldehyde">Urea Formaldehyde Resins</a></li>
<li><a data-prefetch href="#page-melamine-urea-formaldehyde">Melamine-urea Formaldehyde Resins</a></li>
<li><a data-prefetch href="#page-melamine-formaldehyde-powder">Melamine Formaldehyde Resins</a></li>
<li><a data-prefetch href="#page-pva-adhesives">Polyvinyl Acetate Adhesives</a></li>
</ul>
</li>
</ul>
Eva Page:
<div data-role="page" id="page-eva" data-theme="a" data-cache="never">
<div data-role="header"> ☰
</div>
<div data-role="content" id="eva-ethylene-vinyl-acetate">
<div class="form"></div><div class="pad">
</div>
</div>

Related

Div class inside echo PHP

I try to put div class in the echo but it does not work really well. The coding is for to change the login button to the username button after user login. The username button will have the drop-down which is the div class. Other things are work well in this coding except for the div class drop-down. Is there another way to put the div class in the echo? Any thought??
This is before login
What I expected after Login
What I get after Login
Below is my coding:
<div class="header-right">
<?php
if (isset($_SESSION['login_user'])) {
echo '<a class="active" ><img src="image/user.png" width="22" height="22"> '.$login_session.' <img src="image/drop.png" width="20" height="20" > </a>';
echo '<div class="box dropdown">
<ul>
<a "">edit</a>
<a "">delete</a>
<a id="logout" href="logout.php">Log Out</a>
</ul>
</div>';
} else {
echo '<a class="active" href="login.php"><img src="image/lock.png" width="20" height="20"> Login</a>' ;
}
?>
</div>
I use another way to write down this. Let me know if you have any question. I fixed some attribute missing into your anchors <a> and list some <li> elements into your <ul> element as well.
<div class="header-right">
<?php if (isset($_SESSION['login_user'])) { ?>
<a class="active" >
<img src="image/user.png" width="22" height="22">
<?= $login_session ?>
<img src="image/drop.png" width="20" height="20" >
</a>
<div class="box dropdown">
<ul>
<li>edit</li>
<li>delete</li>
<li><a id="logout" href="logout.php">Log Out</a></li>
</ul>
</div>
<?php } else { ?>
<a class="active" href="login.php"><img src="image/lock.png" width="20" height="20"> Login</a>
<?php } ?>
</div>
You may put your code in the way like below and I found out your <ul> is missing <li>.
<div class="header-right">
<?php if(isset($_SESSION['login_user'])): ?>
<!-- Login User (HTML) -->
<?php else: ?>
<!-- Not Login User (HTML) -->
<?php endif; ?>
</div>
<?php if (isset($_SESSION['login_user'])) { ?>
<a class="active" >
<img src="image/user.png" width="22" height="22">
<?php $login_session ?>
<img src="image/drop.png" width="20" height="20" >
</a>
<div class="box dropdown">
<ul>
<li>edit</li>
<li>delete</li>
<li><a id="logout" href="logout.php">Log Out</a></li>
</ul>
</div>
<?php } else { ?>
<a class="active" href="login.php"><img src="image/lock.png" width="20" height="20"> Login</a>
<?php } ?>
</div>

include div in foreach just in some condition

I have some navbar with menu and submenu, I want to appear some <div> in that menu to appear the submenu just if this menu has submenu items
The div that I want to appear are div1, div2, div3, see comments and in this condition : <?php if ($men["titre"] == $sub["parentmenu"]) : ?>
I can't put them in this foreach : <?php foreach($submenu as $sub) :?> because I need that three div just ones for all the submenu <li>
Exemple of one menu who have submenus:
<li class="Menu1">
<a class="header-menu " href="#">Menu1 title</a> //Menu1
<div class="mobile-header-nav-submenu-container"> //div 1
<ul class="mobile-header-nav-submenu"> //div 2
<div class="mobile-header-nav-submenu-li-container"> //div3
<li class="submenu1">
<a class="" href="#">Submenu1</a>
</li>
<li class="submenu2">
<a class="" href="#">Submenu2</a>
</li>
<li class="submenu3">
<a class="" href="#">Submenu3</a>
</li>
</div>
</ul>
</div>
</li>
My code:
<div class="menu>
<?php foreach ($menu as $men): ?>
<li class="<?php echo $men["titre"]?>">
<a class="header-menu <?php echo $men["lien"]?>" href="<?php if($men["lien"]){echo $baseUrl.$men["lien"];}else{echo '#';}?>"><?php echo $men["titre"]?></a>
<div class="mobile-header-nav-submenu-container"> //div1
<ul class="mobile-header-nav-submenu"> //div2
<div class="mobile-header-nav-submenu-li-container"> //div3
<?php foreach($submenu as $sub) :?>
<?php if ($men["titre"] == $sub["parentmenu"]) : ?>
<li id="<?php echo $sub["titre"]?>" class="mobile-header-nav-submenu-li">
<a class="" href="<?php if($sub["lien"]){echo $baseUrl.$sub["lien"];}else{echo '#';}?>">
<?php echo $sub["titre"]?>
</a>
</li>
<?php endif; ?>
<?php endforeach; ?>
</div>
</ul>
</div>
</li>
<?php endforeach; ?>
</div>

If there is no post in a category, how to hide it

If there is no post in category 19, how can I hide Products in html?
<div id='cssmenu'>
<ul>
<li class='active'><a href='#'><span>Home</span></a></li>
<li class='has-sub'><a href='#'><span>Products</span></a>
<ul >
<?php query_posts('showposts=5&orderby=date&cat=19'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>" ><li><?php the_meta(meta_key); ?><?php the_title(); ?> </li></a>
<?php endwhile; ?>
</ul>
</li>
</ul>
</div>
example menu is here : http://cssmenumaker.com/menu/modern-jquery-accordion-menu
You can do something like this from server side
<div id='cssmenu'>
<ul>
<li class='active'><a href='#'><span>Home</span></a>
</li>
<?php query_posts( 'showposts=5&orderby=date&cat=19'); if(have_posts()):?>
<li class='has-sub'><a href='#'><span>Products</span></a>
<ul>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>">
<li>
<?php the_meta(meta_key); ?>
<?php the_title(); ?>
</li>
</a>
<?php endwhile; ?>
</ul>
</li>
<?php endif;?>
</ul>
</div>
Using jQuery check and filter the empty product item by count of li elements and hide them
$('.has-sub').filter(function(){
return $('ul li',this).length == 0;
}).hide()
try this,
<?php query_posts('showposts=5&orderby=date&cat=19'); ?>
<?php if(have_posts()) { // <------ check before entering while.
while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>" ><li><?php the_meta(meta_key); ?><?php the_title(); ?> </li></a>
<?php } endwhile; ?>

My $_SESSION don't work on my page why?

i am using $session[login] but $_SESSION seem like don't not work on my home page of html/php webpage . It don have show up anything . why? could anyone help me
and tell me why? is it the session name wrong? or need to input php inside?
<html>
<title>Home</title>
<head>
<link href="SSCdesign.css" rel="stylesheet" type="text/css">
<script src="script.js"> </script>
</head>
<body>
<header id="SSClogo"><img src="SSC_logo_v2.png"></header>
<div id='userbar'>
<?php
$_SESSION['login'] = true;
while($row = mysql_fetch_assoc($result))
{
$_SESSION['student_id'] = $row['studnet_id'];
$_SESSION['student_name'] = $row['student_name'];
}
?>
</div>
<div id='wrapper' align="center">
<nav id='cssmenu'>
<ul>
<li class='active'><a href='SSC.html'><span>Home</span></a></li>
<li><a href='advisors.html'><span>Advisors</span></a></li>
<li class='has-sub'><a href='pals.html'><span>PALS</span></a>
<ul>
<li><a href='registersession.html'><span>Register Session</span></a></li>
<li><a href='timetable.html'><span>Timetable</span></a></li>
<li><a href='feedback.html'><span>Feedback</span></a></li>
<li class='last'><a href='buzz.html'><span>Buzz</span></a></li>
</ul>
</li>
<li class='has-sub'><a href='econsultation.html'><span>e-Consultation</span></a>
<ul>
<li><a href='appointment.html'><span>e-Appointment</span></a></li>
<li><a href='upcoming.html'><span>Upcoming List Appointment</span></a></li>
<li class='last'><a href='history.html'><span>History</span></a></li>
</ul>
</li>
<li class='has-sub'><a href='workshop.html'><span>Workshop</span></a>
<ul>
<li><a href='calendar.html'><span>Calendar</span></a></li>
<li class='last'><a href='eportfolio.html'><span>e-Portfolio</span></a></li>
</ul>
</li>
<li><a href='facilities.html'><span>Facilities</span></a></li>
<li class='last'><a href='contactus.html'><span>Contact Us</span></a></li>
<li class='la'><a href='login.html'><span>Login</span></a></li>
</ul>
<div id="announcement">
<h2> <center> Announcement will be posted here </center> </h2>
<p> <center> This site is currently under development, do check it out soon! </center> </p>
</div>
<div id="slideshow">
<h2> <center> Slideshow will be here </center> </h2>
</div>
</nav>
<div class="push"></div>
</div>
</body>
</html>
You have to start your session before you use it with:
session_start();
So your code should looks something like this:
<?php
session_start();
$_SESSION['login'] = true;
(Also if you say you use: $session[login], it's wrong you would have to use it with: $session['login'] otherwise login is a constant which it isn't)
For more information see: http://php.net/manual/en/function.session-start.php

Why do i get undefined index when i have no FORMS in the code

So i want to make a dinamyic menu but i got stuck at undefined index problem can you help me figure out why ?
<?php
include_once('includes/connection.php');
include_once('includes/articol.php');
$articol = new articol;
$articole = $articol->fetch_all();
?>
And the code from the body
<li id="current"><a class="links" href="index.html">Acasa</a></li>
<?php foreach ($articole as $articol) { ?>
<li><a class="links" href="articol.php?id=<?php echo $articol['articol_id']; ?>">
<?php echo $articol['articol_titlu']; ?>
</a></li>
<li><a class="links" href="galben.html">Galben</a></li>
<li><a class="links" href="albastru.html">Albastru</a></li>
<li><a class="links" href="drapel.html">Drapel</a></li>
<li><a class="links" href="despre.html">Despre</a></li>
<li><a class="links" href="contact.html">Contact</a></li>
<?php } ?>
I got undefined index at
<li><a class="links" href="articol.php?id=<?php echo $articol['articol_id']; ?>">
<?php echo $articol['articol_titlu']; ?>

Categories