Jump to content

Override core render result or module render result view files?


Recommended Posts

Now i am trying to use core comment module and i want to change render result. Need to rewrite same codes like original codes, normally just need to change item's css classes and some visual html items.....

My question is ?

Why php, html, css and js codes inside same php file? When i check a core php file or a module file its look like spaghetti and hard to understand what happening there. 

Separate main php codes from html, css, js will be helpful to understand and override view file easily. We won't need to rewrite same codes again and again.

For example :

- wire/modules/Fieldtype/FieldtypeComments/views/renderComments.php

Here we can have a views folder for render results, view file for each render operation

and we can override this view file by creating a folder inside our templates folder

- site/templates/overrides/modules/Fieldtype/FieldtypeComments/views/renderComments.php

as you can see like this way we can only modify view results, no need repeat ourself always..

also with this method, it will be easy to modify InputField displays...

With this method we can easily adapt our front-end frameworks (like : twitter bootstrap, foundation, uikit and others)

Current status : if you want make changes repeat core codes and change just html elements, css styling or javascript codes..

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...