Jump to content
  • 0

How to create custom plugin views?


bahsite

Question

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

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
8 hours ago, 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;

 

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?

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...