2013-06-17 17:38 阅读 26

的Joomla! 2.5不读取默认布局

Problem I am having is that making a new component I cannot seem to get joomla to read the default layout file. This is happening in both the admin and site side of the component. Comparing it to another component I have created that works I can see no logical reason for it as both components work in the same environment.

I know that since the site and admin use the same methods, fixing it in one should fix it in the other. So here is the site side of things.

first the view.html.php

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library

class ComponentViewComponent extends JView{
    function display($tpl = null){


Then the tmpl/default.php

// No direct access to this file
defined('_JEXEC') or die('Restricted Access');

// load tooltip behavior


As you can see it is barebones still, but when ever I try to access it on the site or admin it will say "500: Layout default not found".

I have spent over n hour now trying to find out where I went wrong that might of caused this.

Although I doubt it will matter here is the model/controller/constructor

component.php (named differently then actual component)

//No direct access to this file
defined('_JEXEC') or die ('Restricted access');

// import joomla controller library

// Get an instance of the controller prefixed by GoTireReviews
$controller = JController::getInstance('Component');

// Perform the Request task
$input = JFactory::getApplication()->input;

// Redirect if set by the controller



// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla modelitem library

class ComponentModelComponent extends JModelItem{




// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla controller library

class ComponentController extends JController{



I may be blind and missing something, but with the amount of time I spent so far attempting minor tweaks it seems that restarting from scratch might be a less time consuming approach.

Also another note the component is not named "component" but I used it to make this example more readable.


Found out the reason, it is because I used the word review in the name of the component. Doing that tricks joomla's view methods and causes the error. (I changed the name of the component for the purpose of this without thinking that it may cause that)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douluolan9101 douluolan9101 2013-06-17 22:53

    In Joomla 2.5 it names its MVC instances using a prefix, then the method then the name.

    Like so:

    ComponentViewComponent or ComponentViewDefault

    To do this it looks for the word view in the string of the class name. So if you name it like so you will cause an error:


    In this case you might feel naming it review would cause no harm, however it does contain view inside. The error Joomla gives does not point you in the right direction normally either.

    点赞 评论 复制链接分享