3
votes
Joomla 4 Views will not load on some Hosts
HtmlView.php is case-sensitive. Also, all other files within the src folder for namespacing are case-sensitive.
That is what was causing all the problems.
3
votes
Accepted
How can I have a dynamic $default_view?
You can't set a class property to a dynamic value, such as a method call, during declaration like you're attempting. See http://php.net/manual/en/language.oop5.properties.php
You would need to set it ...
2
votes
How to get menu parameters and itemid in component controller
To get Menu Params
This one is perfect I was searching few hrs and this solve my issue of Joomla 3.6.5 & PHP 7.1
0: Using $this when not in object context
Solution:
$app = JFactory::...
2
votes
Accepted
Pass argument to controller methods
No, there isn't a way to pass arguments into methods. Specifically, this has to do with how JControllerLegacy::execute() routes the request. So you're left with using the request or session to fetch ...
2
votes
Sharing a model between two views in a component
OK, comments are not the easiest place to talk in details (too short, too easy to misinterpret) so I'll post this here. It may be a bit wide-ranging and high-concept at first b/c of the lack of detail ...
2
votes
Trigger controller method from another component
In Joomla when you call a controller's save() method (usually it is a FormController if it has a save() method) the controller's save() method calls the corresponding Model right away and the validate(...
2
votes
Error JLIB_APPLICATION_ERROR_INVALID_CONTROLLER from CLI on Joomla 3.7
Start by updating to the latest version of Joomla - 3.9.20 - if you're able to first.
A number of changes regarding JControllerLegacy were made in Joomla 3.8 (see https://github.com/joomla/joomla-cms/...
1
vote
How to load and render a view of a component from another's component template file?
With Joomla 4 you can load the view of another component by using the createView command of the MVCFactory class. You 'boot' the com_contact component and then request the view you want from that ...
1
vote
Accepted
"Failed to start application" with JFactory::getApplication('administrator') after upgrading to J4.2.2
From the J4 potential backward compatibility page, https://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_4
Factory[edit]
Factory::getApplication no longer takes arguments. These ...
1
vote
Folders inside src/Controller/ folder
One way to do this, in your Controller folder:
class BranchController extends FormController
{
public function update_localgroup() {
$file = JPATH_COMPONENT . '/src/Controller/Branch/...
1
vote
Accepted
How to get user session info from external php script with Joomla-4.x?
The below code is mostly from Joomla's /includes/app.php but without the last line.
The last few lines then get information about the user and the user session.
<?php
define('_JEXEC', 1);
define('...
1
vote
Where does JControllerLegacy::redirect() redirect to?
It redirects to whatever is set in controller's $redirect property, normally using setRedirect() method.
As an example, redirects are commonly used in form controllers. When saving an item fails, you ...
1
vote
Deleting rows in two different tables
You can definitely delete rows from multiple tables in a single query, but Joomla doesn't offer a query-building technique to accommodate this.
If you absolutely demand that query builder methods must ...
1
vote
Accepted
Deleting rows in two different tables
Why don't you do it in 2 steps?
I would do something like the following code. As you can see I use name spacing (since Joomla 3.8), used quoteName the table + field names and added a try/catch block.
...
1
vote
Accepted
Ajax Request returning the whole page not a specifc value
What you should do is include &format=json in your URL. This tells Joomla that you want a JSON response rather than HTML, and it won't run (subsequently) your template to produce all your page ...
1
vote
Why does the FormController instantiate models with the ignore_request flag set to true?
I don't know for sure, but I've thought of a reason why it makes sense, so here goes …
Joomla components use FormController to handle whenever the (usually admin) user is editing an item and then ...
1
vote
Accepted
Add custom code to the controller from com_weblinks
Looking at how Weblinks works I can see that the only time weblinks.go gets involved is when you have have an option selected to count Hits for each link causing view.html.php to display this style of ...
1
vote
Accepted
How to remember User State settings when returnng to a Site View?
It doesn't look like you are including the menu Itemid in your redirect which is why your URL is changing. Add another hidden field with the value of your current Itemid. Your redirect code is fine ...
1
vote
Accepted
Why are methods randomly placed in models as well as controllers in Joomla
The comment from @mickmackusa is essentially correct, but there's some context missing, perhaps, from your question that makes me wonder if you're not asking a wider question. There are wide variety ...
1
vote
Accepted
Is it possible to check if a method or function exists in the component controller?
I never figured out how to use $this, but it was pretty straightforward otherwise. This checks to see if the add method exists in the Article controller.
$ToolsClass = 'ContentControllerArticle';
$...
1
vote
Pass results (array) from controller into view and show it
Use your controller only for redirection purpose. For database stuff use your view model.
Make sure your view name, controller file name, model file name are same.
Form:
<form method="post" class=...
1
vote
What controller does front end form data post to using a component
"file" is the frontend controller called here.
/components/com_your_component/controllers/file.php
class Your_ComponentControllerFile extends JControllerLegacy
{
public function submit(){
...
1
vote
Accepted
Override View path in the Controller is only partially working
I think you need to path 'template_path' in the config as well. Probably something like
$config['template_path'] = array(
JPATH_COMPONENT.'/views/tmpl',
$custom_view_path.'/tmpl',
/* ...
1
vote
Call Controller's Publish-Method from CLI or Helper
You can use the ComponentHelper class for this:
class MyCliApp extends JApplicationCli
{
public function doExecute()
{
// Fool Joomla factory into loading CMS application
...
1
vote
Joomla 3.4.3 get fatal error while opening plugins
For anyone that might end up here through a Google search, trying to find a solution to a similar problem:
Usually fatal errors especially after an update may mean that some files didn't copied over ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
controller × 44joomla-3.x × 13
component × 10
view × 10
model × 10
php × 5
custom-component × 5
development × 4
joomla-3.4 × 4
joomla-4.x × 4
jform × 3
mysql × 2
task × 2
plugin × 1
articles × 1
administrator × 1
joomla-api × 1
database × 1
overrides × 1
custom-field × 1
ajax × 1
url × 1
form × 1
redirect × 1
seo × 1