[英]undefined variable in codeigniter php
I am new to codeigniter, From My senior i got one task to solve existing undone internal project. 我是Codeigniter的新手,从我的上级开始,我有一项任务要解决现有的未完成内部项目。 and develop that project again.
并再次开发该项目。 i am having query when i am ruinning this project.
我在破坏这个项目时有疑问。 here i am pasting my 2 view files.
在这里,我粘贴我的2视图文件。 tell me if any one required further files.
告诉我是否有人需要其他文件。
Thank you in advanced. 在此先感谢您。
TODO DropDown View TODO下拉查看
<!-- 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">
<a href="<?php echo base_url(); ?>task">See all tasks <i class="m-icon-swapright"></i></a>
</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" 在您的页面顶部导航视图页面中,您使用了变量“ $ 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 ; 您得到的错误是一个Notice =>,它表示变量( $ pendingtask )没有在您的代码中定义; 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
它不会停止文件的执行,您可以使用error_reporting方法停止“通知和警告”消息,也可以在Codeigniter配置中进行设置,请查看此链接以供参考: http : //phpdog.blogspot.in/2012/ 02 / codeigniter-error-reporting-handling.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.