Jump to content
  • 0

How to create custom plugin views?


Question

Posted

Hi,

I was trying to figure out how to create custom plugin views without success.

The only way I found to edit plugin templates is hardcoding core plugin views files at /plugins/plugin_name/views/default/

Is there any way to create my own custom views at /plugins/plugin_name/views/custom_theme/ ?

Thanks for your support

3 answers to this question

Recommended Posts

  • 0
Posted

In your controller, probably the parent controller, set the custom view directory in preAction:

$dir = 'custom_theme';
$this->view->view = $dir;
$this->structure->view = $dir;

 

  • 0
Posted
  On 3/6/2020 at 5:27 PM, Tyson said:

In your controller, probably the parent controller, set the custom view directory in preAction:

$dir = 'custom_theme';
$this->view->view = $dir;
$this->structure->view = $dir;

 

Expand  

Thanks for your answer, Tyson.

I forgot to say I'm not a coder. I can read PHP but I'm lost dealing with object oriented programming.

Please, could you tell me where to paste that simple code?

  • 0
Posted

So plugins will usually have a parent controller that their other controllers inherit from that has a name in the format my_plugin_controller.php  In that file/class there should be a method called preAction and you should add that code at the end of that method.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...