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 )
I have two toolbars, when I click on the second toolbar it redirect to the first one
this is my code
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
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 galleryi开发者_高级运维tems 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:)
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
class GalGallerifficViewGalleryitems
I hope it will help other developers :)
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.
精彩评论