I have an (almost empty) ArticleController extends BaseController on the site part
I use there
protected $default_view = 'article';
When using the URL
http:/myhost/index.php/component/nycomponent/?controller=Article&id=70
I get the error:
View not found [name, type, prefix]: featured, html, site
The view featured comes from the input so my default_view is ignored
Opensuse
PHP 8.1
Joomla 4.3.2
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-06-20 20:05:42 |
Closed_By | ⇒ | chmst |
I think, this is a bug. Let me present my short example.
This is a container where I get the error:
class ArticleController extends BaseController{
protected $default_view = 'article';
public function display($cachable = false, $urlparams = array()) {
return parent::display($cachable, $urlparams);
}
}
When I change it to the following - there is no error.
class ArticleController extends BaseController{
protected $default_view = 'article';
public function display($cachable = false, $urlparams = array()) {
$view = $this->input->get('view');
if($view == 'featured') {
$this->input->set('view', $this->default_view);
}
return parent::display($cachable, $urlparams);
}
}
It means (in my opinion) that there are no missing parts in my code.
What is interesting, the problem appears ONLY on the Front End. When I do is in Admin Part there is no problem.
Status | Closed | ⇒ | New |
Closed_Date | 2023-06-20 20:05:42 | ⇒ | |
Closed_By | chmst | ⇒ |
There is nothing wrong with the code in BaseController
. The real reason here is that your link does not contains Itemid variable value is ID of the menu item associated with your component. So Joomla uses Home menu item as the active and pass variables from query of that menu item to your request (The Home menu item is linked to view featured of com_content by default, that's the reason you has featured when trying to get view from input)
This routing issue is something which Joomla needs to address. However, while waiting for it to work properly, you can use that workaround code or passing right value for Itemid variable in your link.
Labels |
Added:
Information Required
|
Labels |
Removed:
Information Required
|
Labels |
Added:
bug
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-03-30 17:57:55 |
Closed_By | ⇒ | Hackwar |
If I understand correctly, you are working on an own component?
In my experience, these errors are always caused by wrong usage of namespace, typos in filenames or wrong classnames.
You could join the extension development cannel on our mattermost https://joomlacommunity.cloud.mattermost.com.
There are developers who can help you.
I close this as it is not a bug in Joomla. We can re-open if you are sure that it is a bug,