[英]joomla component does not work on my hosting account
I develop a custom joomla 1.5 component and it's working fine locally(wamp server ,php 5.3.5) and toolbar functions add/edit and delete does not work on my hosting account (apache ,php 5.2.16 ) 我开发了一个自定义的joomla 1.5组件,它在本地运行正常(wamp服务器,php 5.3.5),工具栏功能添加/编辑和删除在我的托管帐户上不起作用(apache,php 5.2.16)
I have two toolbars, when I click on the second toolbar it redirect to the first one 我有两个工具栏,当我单击第二个工具栏时,它会重定向到第一个
this is my code 这是我的代码
controller.php controller.php
class GalGallerifficController extends JController
{
/**
* Method to display the view
*
* @access public
*/
/**
* constructor (registers additional tasks to methods)
* @return void
*/
function __construct()
{
parent::__construct();
// Register Extra tasks
$this->registerTask( 'add' , 'edit' );
}
/**
* display the edit form
* @return void
*/
function edit()
{
JRequest::setVar( 'view', 'gallery' );
JRequest::setVar( 'layout', 'form' );
JRequest::setVar('hidemainmenu', 1);
parent::display();
}
/**
* remove record(s)
* @return void
*/
function remove()
{
$model = $this->getModel('gallery');
if(!$model->delete()) {
$msg = JText::_( 'Error: One or More Gallery(s) Could not be Deleted' );
} else {
$msg = JText::_( 'Gallery(s) Deleted' );
}
$this->setRedirect( 'index.php?option=com_galleriffic', $msg );
}
}
and the second controllers/galleryitems.php 和第二个controllers / galleryitems.php
class GalGallerifficControllerGalleryItems extends JController
{
function __construct()
{
parent::__construct();
// Register Extra tasks
$this->registerTask( 'add' , 'edit' );
}
/**
* display the edit form
* @return void
*/
function edit()
{
JRequest::setVar( 'view', 'galleryitem' );
JRequest::setVar( 'layout', 'form' );
JRequest::setVar('hidemainmenu', 1);
parent::display();
}
/**
* remove record(s)
* @return void
*/
function remove()
{
$model = $this->getModel('gallery');
if(!$model->delete()) {
$msg = JText::_( 'Error: One or More Gallery(s) Could not be Deleted' );
} else {
$msg = JText::_( 'Gallery(s) Deleted' );
}
$this->setRedirect( 'index.php?option=com_galleriffic', $msg );
}
function display()
{
parent::display();
}
}
and galleryitems view 和图库视图
class GalGallerifficViewGalleryItems extends JView
{
function display($tpl = null)
{
JToolBarHelper::title( JText::_( 'Galleriffic Gallery Items' ), 'generic.png' );
JToolBarHelper::deleteList();
JToolBarHelper::editListX();
JToolBarHelper::addNewX();
// Get data from the model
$items =& $this->get( 'Data');
$this->assignRef( 'items', $items );
parent::display($tpl);
}
}
any idea, why this happen ? 任何想法,为什么会这样?
thanks in advance:) 提前致谢:)
I have solved this issue by 我已经解决了这个问题
using 使用
class GalGallerifficViewGalleryitems
instead of 代替
class GalGallerifficViewGalleryItems
For that you will also need to change 为此,您还需要更改
public function getModel($name = 'galleryitems', $prefix = 'GalGallerifficModel')
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
in controller file. 在控制器文件中。
the problem was controllers,models,views names ... 问题是控制器,模型,视图名称...
class GalGallerifficViewGalleryItems
this naming working fine on wamp server but when uploading to the hosting account (apache ) it does not it should follow camel naming 这种命名在wamp服务器上工作正常,但是当上传到托管帐户(apache)时,它不应该遵循骆驼命名
class GalGallerifficViewGalleryitems
I hope it will help other developers :) 我希望它将对其他开发人员有所帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.