Php Joomla分页在后端不起作用(管理员)
我在前端和后端使用了相同的代码(如下),但在管理端分页不起作用 =========================型号=零件===========================Php Joomla分页在后端不起作用(管理员),php,joomla,joomla2.5,joomla1.5,Php,Joomla,Joomla2.5,Joomla1.5,我在前端和后端使用了相同的代码(如下),但在管理端分页不起作用 =========================型号=零件=========================== defined('_JEXEC') or die; jimport('joomla.application.component.modellist'); class CiieModelOrders extends JModelList { public function getItems() {
defined('_JEXEC') or die;
jimport('joomla.application.component.modellist');
class CiieModelOrders extends JModelList
{
public function getItems()
{
// Invoke the parent getItems method to get the main list
$items = parent::getItems();
return $items;
}
protected function getListQuery()
{
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select('title');
$query->from('q2b7v_menu');
return $query;
}
}
defined('_JEXEC') or die;
jimport('joomla.application.component.view');
class CiieViewOrders extends JView {
protected $state;
protected $item;
protected $form;
protected $params;
public function display($tpl = null) {
$items = $this->get('Items');
$pagination = $this->get('Pagination');
$this->items = $items;
$this->pagination = $pagination;
parent::display($tpl);
}
}
<?php
JHtml::_('behavior.keepalive');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
//Load admin language file
$lang = JFactory::getLanguage();
$lang->load('com_ciie', JPATH_ADMINISTRATOR);
?>
<div>
<table>
<?php
foreach($this->items as $item){
echo "<tr><td>".$item->title."</td></tr>";
}
?>
</table>
<?php echo $this->pagination->getListFooter(); ?>
</div>
...
<div>
<form action="<?php echo JRoute::_('index.php?option=com_ciie&view=orders'); ?>" method="post" name="adminForm">
<table>
<?php
foreach($this->items as $item){
echo "<tr><td>".$item->title."</td></tr>";
}
?>
</table>
<?php echo $this->pagination->getListFooter(); ?>
</form>
</div>
=========================视图=零件===========================
defined('_JEXEC') or die;
jimport('joomla.application.component.modellist');
class CiieModelOrders extends JModelList
{
public function getItems()
{
// Invoke the parent getItems method to get the main list
$items = parent::getItems();
return $items;
}
protected function getListQuery()
{
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select('title');
$query->from('q2b7v_menu');
return $query;
}
}
defined('_JEXEC') or die;
jimport('joomla.application.component.view');
class CiieViewOrders extends JView {
protected $state;
protected $item;
protected $form;
protected $params;
public function display($tpl = null) {
$items = $this->get('Items');
$pagination = $this->get('Pagination');
$this->items = $items;
$this->pagination = $pagination;
parent::display($tpl);
}
}
<?php
JHtml::_('behavior.keepalive');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
//Load admin language file
$lang = JFactory::getLanguage();
$lang->load('com_ciie', JPATH_ADMINISTRATOR);
?>
<div>
<table>
<?php
foreach($this->items as $item){
echo "<tr><td>".$item->title."</td></tr>";
}
?>
</table>
<?php echo $this->pagination->getListFooter(); ?>
</div>
...
<div>
<form action="<?php echo JRoute::_('index.php?option=com_ciie&view=orders'); ?>" method="post" name="adminForm">
<table>
<?php
foreach($this->items as $item){
echo "<tr><td>".$item->title."</td></tr>";
}
?>
</table>
<?php echo $this->pagination->getListFooter(); ?>
</form>
</div>
===================模板=零件=========================
defined('_JEXEC') or die;
jimport('joomla.application.component.modellist');
class CiieModelOrders extends JModelList
{
public function getItems()
{
// Invoke the parent getItems method to get the main list
$items = parent::getItems();
return $items;
}
protected function getListQuery()
{
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select('title');
$query->from('q2b7v_menu');
return $query;
}
}
defined('_JEXEC') or die;
jimport('joomla.application.component.view');
class CiieViewOrders extends JView {
protected $state;
protected $item;
protected $form;
protected $params;
public function display($tpl = null) {
$items = $this->get('Items');
$pagination = $this->get('Pagination');
$this->items = $items;
$this->pagination = $pagination;
parent::display($tpl);
}
}
<?php
JHtml::_('behavior.keepalive');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
//Load admin language file
$lang = JFactory::getLanguage();
$lang->load('com_ciie', JPATH_ADMINISTRATOR);
?>
<div>
<table>
<?php
foreach($this->items as $item){
echo "<tr><td>".$item->title."</td></tr>";
}
?>
</table>
<?php echo $this->pagination->getListFooter(); ?>
</div>
...
<div>
<form action="<?php echo JRoute::_('index.php?option=com_ciie&view=orders'); ?>" method="post" name="adminForm">
<table>
<?php
foreach($this->items as $item){
echo "<tr><td>".$item->title."</td></tr>";
}
?>
</table>
<?php echo $this->pagination->getListFooter(); ?>
</form>
</div>
(如您所见,href属性值为空(#))
会话输出->[orders]=>stdClass对象([ordercol]=>)
(此处也不存在“limitstart”值
我也在不同的全新Joomla安装中尝试过,但同样的问题再次出现
有什么我错过的吗?我终于把它整理好了!这是一个愚蠢的错误! 在模板中,我没有将列表内容放在
标记中。getListFooter()函数显示分页按钮,但单击时,操作不会在任何地方提交。我更正了如下所示的代码,它正常工作
==========模板=零件====================
defined('_JEXEC') or die;
jimport('joomla.application.component.modellist');
class CiieModelOrders extends JModelList
{
public function getItems()
{
// Invoke the parent getItems method to get the main list
$items = parent::getItems();
return $items;
}
protected function getListQuery()
{
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select('title');
$query->from('q2b7v_menu');
return $query;
}
}
defined('_JEXEC') or die;
jimport('joomla.application.component.view');
class CiieViewOrders extends JView {
protected $state;
protected $item;
protected $form;
protected $params;
public function display($tpl = null) {
$items = $this->get('Items');
$pagination = $this->get('Pagination');
$this->items = $items;
$this->pagination = $pagination;
parent::display($tpl);
}
}
<?php
JHtml::_('behavior.keepalive');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
//Load admin language file
$lang = JFactory::getLanguage();
$lang->load('com_ciie', JPATH_ADMINISTRATOR);
?>
<div>
<table>
<?php
foreach($this->items as $item){
echo "<tr><td>".$item->title."</td></tr>";
}
?>
</table>
<?php echo $this->pagination->getListFooter(); ?>
</div>
...
<div>
<form action="<?php echo JRoute::_('index.php?option=com_ciie&view=orders'); ?>" method="post" name="adminForm">
<table>
<?php
foreach($this->items as $item){
echo "<tr><td>".$item->title."</td></tr>";
}
?>
</table>
<?php echo $this->pagination->getListFooter(); ?>
</form>
</div>
。。。
这是整个模板还是包含在tmpl/default.php
中的子模板文件?非常感谢。我浪费了这么多时间来修复此问题。我之前不知道提交此表单。再次感谢。