Skip to main content
added 6 characters in body
Source Link

I have been fighting the same problem for two full days now, going over lesson 10 of Robbie Jacksons excellent video explanations in this series https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Developing_a_Basic_Component again and again.

In lesson 10 he tries out his own alternative approach and he comes up with this redirect in his subcontroller to make the View Class based on JControllerForm use the edit.php layout:

$this->setRedirect(JROUTE::_("index.php?option=com_helloworld&view=helloworld&layout=edit&id=$id",false),$msg);

It works! It really picks up the edit.php template. However, using the same technicque I failed to make it use another template (mine was called add.php). Even though, the View class picks up the name of the layout file, it somehow ends up using edit.php anyway. Hours of debugging in VS_code with XDebug, searching API-docs etc. did not give me the solution.

In the end I ended up writing alternative subcontroller -, view- and model classes to handle add-functionality. When the view class has only one template in the tmpl-folder I managed to make it pick the right one, even if it not called default.php.

Not a fully satisfactory solution I know, but at least you know that you are not the only one out there fighting the steep learning curve of Joomla programming:-)

I have been fighting the same problem for two full days now, going over lesson 10 of Robbie Jacksons excellent video explanations in this series https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Developing_a_Basic_Component again and again.

In lesson 10 he tries out his own alternative approach and he comes up with this redirect in his subcontroller to make the View Class based on JControllerForm use the edit.php layout:

$this->setRedirect(JROUTE::_("index.php?option=com_helloworld&view=helloworld&layout=edit&id=$id",false),$msg);

It works! It really picks up the edit.php template. However, using the same technicque I failed to make it use another template (mine was called add.php). Even though, the View class picks up the name of the layout file, it somehow ends up using edit.php anyway. Hours of debugging in VS_code with XDebug, searching API-docs etc. did not give me the solution.

In the end I ended up writing alternative subcontroller -, view- and model classes to handle add-functionality. When the view class has only one template in the tmpl-folder I managed to make it pick the right one, even if it not called default.php.

Not a fully satisfactory solution I know, but at least you know that you are not the only one out fighting the steep learning curve of Joomla programming:-)

I have been fighting the same problem for two full days now, going over lesson 10 of Robbie Jacksons excellent video explanations in this series https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Developing_a_Basic_Component again and again.

In lesson 10 he tries out his own alternative approach and he comes up with this redirect in his subcontroller to make the View Class based on JControllerForm use the edit.php layout:

$this->setRedirect(JROUTE::_("index.php?option=com_helloworld&view=helloworld&layout=edit&id=$id",false),$msg);

It works! It really picks up the edit.php template. However, using the same technicque I failed to make it use another template (mine was called add.php). Even though, the View class picks up the name of the layout file, it somehow ends up using edit.php anyway. Hours of debugging in VS_code with XDebug, searching API-docs etc. did not give me the solution.

In the end I ended up writing alternative subcontroller -, view- and model classes to handle add-functionality. When the view class has only one template in the tmpl-folder I managed to make it pick the right one, even if it not called default.php.

Not a fully satisfactory solution I know, but at least you know that you are not the only one out there fighting the steep learning curve of Joomla programming:-)

Worked a lot more on the problem and now I can present a workaround albeit not a satisfactory solution.
Source Link

Have you tried setting "I have been fighting the same problem for two full days now, going over lesson 10 of Robbie Jacksons excellent video explanations in this series https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Developing_a_Basic_Component again and again.

In lesson 10 he tries out his own alternative approach and he comes up with this redirect in his subcontroller to make the View Class based on JControllerForm use the edit.php layout:

$this->setRedirect(JROUTE::_("index.php?option=com_helloworld&view=helloworld&layout=edit&id=$id",false),$msg);

It works! It really picks up the edit.php template.&layout=alternate& However, using the same technicque I failed to make it use another template (mine was called add.php). Even though, the View class picks up the name of the layout file, it somehow ends up using edit.php anyway." Hours of debugging in your URL? Sorry forVS_code with XDebug, searching API-docs etc. did not being able to bring up more concise code but I have been working all day ongive me the same problem in conjunction with some code thatsolution.

In the end I decidedended up writing alternative subcontroller -, view- and model classes to roll back for other reasons but I am quite surehandle add-functionality. When the view class has only one template in the tmpl-folder I managed to getmake it pick the view to use an alternate layout file that wayright one, even if it not called default.php.

Not a fully satisfactory solution I know, but at least you know that you are not the only one out fighting the steep learning curve of Joomla programming:-)

Have you tried setting "....&layout=alternate&...." in your URL? Sorry for not being able to bring up more concise code but I have been working all day on the same problem in conjunction with some code that I decided to roll back for other reasons but I am quite sure I managed to get the view to use an alternate layout file that way.

I have been fighting the same problem for two full days now, going over lesson 10 of Robbie Jacksons excellent video explanations in this series https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Developing_a_Basic_Component again and again.

In lesson 10 he tries out his own alternative approach and he comes up with this redirect in his subcontroller to make the View Class based on JControllerForm use the edit.php layout:

$this->setRedirect(JROUTE::_("index.php?option=com_helloworld&view=helloworld&layout=edit&id=$id",false),$msg);

It works! It really picks up the edit.php template. However, using the same technicque I failed to make it use another template (mine was called add.php). Even though, the View class picks up the name of the layout file, it somehow ends up using edit.php anyway. Hours of debugging in VS_code with XDebug, searching API-docs etc. did not give me the solution.

In the end I ended up writing alternative subcontroller -, view- and model classes to handle add-functionality. When the view class has only one template in the tmpl-folder I managed to make it pick the right one, even if it not called default.php.

Not a fully satisfactory solution I know, but at least you know that you are not the only one out fighting the steep learning curve of Joomla programming:-)

Source Link

Have you tried setting "....&layout=alternate&...." in your URL? Sorry for not being able to bring up more concise code but I have been working all day on the same problem in conjunction with some code that I decided to roll back for other reasons but I am quite sure I managed to get the view to use an alternate layout file that way.