I have a page which includes the menu bar (a php page). This works, but strangely the page doesn't load after the include.
Some code:
<div class="center">
<?php
include ('../menu.php')
?>
<div class="text" id="media">
Some text
</div>
When I add the
<div class="text" id="media">
Some text
</div>
to the menu.php it is showed, but not when it is on the parent page. Anybody has an idea? There isn't any warning or error showing.
<!-- begin menu -->
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<link rel="stylesheet" href="../../../../style/menu.css">
<div class="menu_b">
<div class="logo">
<img src="../../../../afbeeldingen/menu/logo.gif" width="375" title="Home" />
</div>
<div class="aangemeld">
</div>
<ul class="menu_tekst">
<li class="<?php echo $account_li;?>"><a class="nt" href="../../../../account.php">Account</a></li>
<li class="tussenstuk"></li>
<li class="<?php echo $contact_li;?>"><a class="nt href="../../../../contact.php">Contact</a></li>
<li class="tussenstuk"></li>
<li class="<?php echo $fotos_li;?>"><a class="nt" href="../../../../fotos.php">Foto's</a>
<ul class="sub_fotos sub">
<li class="space_left"> </li>
<li class="titel_blok_sub"><a class="nt" href="../../../../fotos/2013_2014.php">2013-2014</a></li>
<li class="titel_blok_sub"><a class="nt" href="../../../../fotos/kamp.php">Kampfoto's 2014</a></li>
</ul>
</li>
<li class="tussenstuk"></li>
<li class="nt"><a class="nt" href="../../../../winkelwagen.php">winkelwagen + besteld</a></li>
</ul>
</div>
<div class="onder_menu">
</div>
<div class="sub_menu">
</div>
<!-- einde menu -->
you forgot semicolon ;
include ('../menu.php');
You forgot a quotation mark:
<li class="<?php echo $contact_li;?>">
<a class="nt href="../../../../contact.php">Contact</a>
</li>
should be
<li class="<?php echo $contact_li;?>">
<a class="nt" href="../../../../contact.php">Contact</a>
</li>
Succes ermee
Above the div.center their was an other php include of a page that doesn't exist, after removing it, the page loaded. Didn't looked at it because it was above the menu.php which was loaded.
Try using require:
require('../menu.php');
I'm guessing that you have turned off display errors in your php.ini and that menu.php doesn't exist.
If you are not sure how to turn on error reporting in your development machine, add the following lines to your parent page;
<div class="center">
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include ('../menu.php');
?>
<div class="text" id="media">
Some text
</div>
This should then reveal why the page is not being included.
Take the parenthesis off the include statement. It should look like this:
include 'page.php';
Related
while($recor1=mysql_fetch_assoc($res1))
{
?>
<ul>
<li class="col-md-3 col-sm-3"><div class="dest-list"><?php echo $recor1['sub_destination']; ?></div> </li>
</ul>
<div class="clearfix"></div>
<?php
}
it displays the result horizontally i want it vertically please give me soluation
there are a number of things wrong with your code, why are you adding a new list for every item with only one list item, that makes no sense. Also do not add block elements inside inline elements (div inside a). Also if you what the list items under each other then why add the col-... class?
<ul>
<?php while($recor1=mysql_fetch_assoc($res1)) {?>
<li class="">
<a href="#">
<?php echo $recor1['sub_destination']; ?>
</a>
</li>
<?php } ?>
</ul>
this gives you the right html structure, and you can then style it as you see fit
if you dont want to display a list horizontally remove col-sm-3 class of your li, which changes your code like below
while($recor1=mysql_fetch_assoc($res1)) { ?>
<div class="col-md-3 col-sm-3">
<ul>
<li >
<a href="#">
<div class="dest-list">
<?php echo $recor1['sub_destination']; ?>
</div>
</a>
</li>
</ul>
</div>
<div class="clearfix"></div>
<?php
}
take a look at this example
I am new to codeigniter, From My senior i got one task to solve existing undone internal project. and develop that project again.
i am having query when i am ruinning this project.
here i am pasting my 2 view files.
tell me if any one required further files.
Thank you in advanced.
TODO DropDown View
<!-- BEGIN TODO DROPDOWN -->
<?php
if (isset($pendingtask)) {
?>
<li class="dropdown" id="header_task_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-tasks"></i>
<span class="badge"><?php echo count($pendingtask); ?></span>
</a>
<ul class="dropdown-menu extended tasks">
<li>
<p>You have <?php echo count($pendingtask); ?> pending tasks</p>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height:250px">
<?php
if (!empty($pendingtask)) {
foreach ($pendingtask as $task_row) {
?>
<li>
<a href="<?php echo base_url(); ?>milestone/viewMilestone/<?php echo $task_row->id; ?>">
<span class="task">
<span class="desc"><?php echo $task_row->title; ?></span>
<span class="percent">30%</span>
</span>
<span class="progress progress-success ">
<span style="width: 30%;" class="bar"></span>
</span>
</a>
</li>
<?php
}
}
?>
</ul>
</li>
<li class="external">
See all tasks <i class="m-icon-swapright"></i>
</li>
</ul>
</li>
<!-- END TODO DROPDOWN -->
<?php } ?>
pagetopnavigation view
<!-- BEGIN HEADER -->
<div class="header navbar navbar-inverse navbar-fixed-top">
<!-- BEGIN TOP NAVIGATION BAR -->
<div class="navbar-inner">
<div class="container-fluid">
<?php $this->load->view('include/pagelogo'); ?>
<!-- BEGIN TOP NAVIGATION MENU -->
<ul class="nav pull-right">
<?php //$this->load->view('include/pagetopnotifications'); ?>
<?php //$this->load->view('include/pagetopnewmessage'); ?>
<?php $this->load->view('include/pagetoptodo', $pendingtask); ?>
<?php $this->load->view('include/pagetopuserprofile'); ?>
</ul>
<!-- END TOP NAVIGATION MENU -->
</div>
</div>
<!-- END TOP NAVIGATION BAR -->
</div>
<!-- END HEADER -->
?php $this->load->view('include/pagetoptodo', $pendingtask); ?>
is where your error is: the second parameter needs to be an array. So:
?php $this->load->view('include/pagetoptodo', array('pendingtask'=>$pendingtask)); ?>
in order to pass to a sub-view
In Your pagetopnavigation view page you used the variable "$pendingtask"
(<?php $this->load->view('include/pagetoptodo', $pendingtask); ?>)
The error what you are getting is a Notice => it is saying the variable($pendingtask) is not defined in your code ; it will not stop the execution of file, you can stop "Notice and Warning" messages by using error_reporting method or you can set up this in Codeigniter configurations, check this link for reference : http://phpdog.blogspot.in/2012/02/codeigniter-error-reporting-handling.html
I am trying to change the class of an active element in my menu with php, but I am having trouble when using "?side=testpage" as URL
I'm typing the href in php to get the pages opened in the correct div according to my index where this code is included.
The whole code is:
<?php
function echo_Active_Tab ($requestUri){
$current_file_name = basename($_SERVER['REQUEST_URI'], ".php");
if ($current_file_name == $requestUri)
echo 'class="active"';
}
?>
<div class="navbar">
<div class="navbar-inner">
<a class="brand"<?php echo "href='?side=mainpage'>Økonomiprogrammet</a>"; ?>
<ul class="nav">
<li <?=echo_Active_Tab("mainpage")?>><?php echo "<a href='?side=mainpage.php'>Startside</a>"; ?></li>
<li <?=echo_Active_Tab("overview")?>><?php echo "<a href='?side=overview'>Oversikten</a>"; ?> </li>
<li <?=echo_Active_Tab("invoice")?>><?php echo "<a href='?side=invoice'>Fakturaer</a>"; ?></li>
<li <?=echo_Active_Tab("expences")?>><?php echo "<a href='?side=expences'>Utgifter</a>"; ?></li>
</ul>
<form class="navbar-form navbar-right" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
<button type="submit" class="btn btn-default">Søk</button>
</div>
</form>
</div>
</div>
Does anyone spot the error in my code?
EDIT: Don't mind the wrong function name, fixed and edited. The code doesn't do as I'd hoped.
I am creating a sorting page, which will show content of database, and the user can sort it with listjs. Problem is that when i press any button, the content loaded from the database disappears. When I fill the content manually it works great. Can anybody please help me with this problem?
My load function:
$(document).ready(function(){
$(".list").load("../wp-content/php/sorting.php");
});
sorting.php
<?php
mysql_connect("***", "***", "**") or die(mysql_error());
mysql_select_db("***");
$result = mysql_query("SELECT * FROM business");
while($row = mysql_fetch_array($result))
{
?><li class="onebusiness"><a href="<?php
echo $row['link'];?>"><img src="<?php
echo $row['img'];?>" height="125" width="125"/><p class="name"><?php
echo $row['name'];?></p><p class="category" style="display:none;"><?php
echo $row['category'];?></p></a></li><?php
}
mysql_close();
?>
HTML:
<script src="../wp-content/js/filter/call-php.js" type="text/javascript"></script>
<script src="../wp-content/js/list/list-min.js" type="text/javascript"></script>
<div id="busineseslist">
<input class="search" placeholder="Search Business" />
<ul class="sort-by">
<li class="sort btn" data-sort="name">Sort by name</li>
<li class="sort btn" data-sort="category">Sort by category</li>
</ul>
<ul class="filter">
<li class="btn" id="filter-none">Show all</li>
<li class="btn" id="filter-something">Only show something</li>
<li class="btn" id="filter-else">Only show something else</li>
</ul>
<div class="list"></div>
</div>
Why you dont just do this:
<script src="../wp-content/js/filter/call-php.js" type="text/javascript"></script>
<script src="../wp-content/js/list/list-min.js" type="text/javascript"></script>
<div id="busineseslist">
<input class="search" placeholder="Search Business" />
<ul class="sort-by">
<li class="sort btn" data-sort="name">Sort by name</li>
<li class="sort btn" data-sort="category">Sort by category</li>
</ul>
<ul class="filter">
<li class="btn" id="filter-none">Show all</li>
<li class="btn" id="filter-something">Only show something</li>
<li class="btn" id="filter-else">Only show something else</li>
</ul>
<div class="list"><?php include '../wp-content/php/sorting.php'; ?></div>
</div>
With this you can delete this line:
<script src="../wp-content/js/filter/call-php.js" type="text/javascript"></script>//delete this
Which i think its the js with the following code:
$(document).ready(function(){
$(".list").load("../wp-content/php/sorting.php");
});
Because with the php include you dont need the load function ;)
------------------------EDITED----------------------------------------
In wordpress, you can include files in this way:
Put the include files in your theme folder and use this in your theme's footer.php:
<?php include (TEMPLATEPATH . '/sorting.php'); ?>
See this reference link: http://www.deluxeblogtips.com/2010/06/wordpress-include-template-files.html
Your div should looks like:
Go to the 'Theme Editor', look for the file that generates the html. Edit it and place this code between the divs tags:
<div class="list"><?php include (TEMPLATEPATH . '/sorting.php'); ?></div>
Saludos.
I want to generate the following code automatically within a Wordpress loop:
<ul class="content">
<li class="box it" data-id="id-1" data-type="it">
<h1>No# 01</h1>
</li>
<li class="box medical" data-id="id-2" data-type="medical">
<h1>No# 02</h1>
</li>
<li class="box education" data-id="id-3" data-type="education">
<h1>No# 03</h1>
</li>
</ul>
What I want it to have my php code from within the Wordpress loop to echo "data-id="+(auto incremented number as in the above instance).
How will I construct the loop?
try
<ul class="content">
<?php for($i=1;$i<some_num;$i++) {?>
<li class="box it" data-id="id-<?php echo $i; ?>" data-type="it">
<h1>No# <?php echo $i; ?></h1>
</li>
<?php } ?>
</ul>