Custom DetailView.tpl for one module

I am trying to change the layout of the detailview for the accounts module. As of now, I think the best way to do this would be to create a custom detailview.tpl only for the accounts module… Anyone have any idea how to do this?

Thanks

From what your describing, the internal Studio should be just fine. Add any new fields that you need, then add them to the detailview for accounts. It is very intuitive. No need to change any code, the studio allows a gui interface to do what you need.

Try it in a development environment and let us know of any problems.

What I’m trying to accomplish is to have the panels in the detailview tiled, side by side, rather than stacked. I haven’t found a way to do this in studio so I started to “nosedive” into the code and see where to start

Sorry to resurrect this topic, but I am looking for answer to this same question.

I echo’d out $this->dv and saw there is an array value called ‘[tpl]’, that references include/DetailView/DetailView.tpl.

I tried to add this line into my module’s detailviewdefs.php file but got no luck redirecting it to a custom directory. I see guides for how to do this with the header.tpl and footer.tpl files but not the DetailView.tpl file.

SOLVED (mostly):

There is a way to override the DetailView.tpl file for only a specific module, but be aware that the styling of the panels and actions menu do not appear if you do this and need to be added back in.

If you create yourself a file in custom/module/YOUR_MODULE/views/view.detail.php,

Then you need to basically copy the preDisplay() function from include/MVC/View/views/view.detail.php into your file.

You’ll notice on that last line:

$this->dv = new DetailView2();
$this->dv->ss =&  $this->ss;
$this->dv->setup($this->module, $this->bean, $metadataFile, get_custom_file_if_exists('include/DetailView/DetailView.tpl'));

That it is passing the location of the main tpl file for the DetailView to the setup function.

I changed the file location to say:

$this->dv->setup($this->module, $this->bean, $metadataFile, get_custom_file_if_exists('modules/Opportunities/tpls/DetailView.tpl'));

And since thats wrapped with the get_custom_file_if_exists() function, it will go out and the file in the custom directory.

1 Like

Sorry for replying to this old topic. But i’m looking for possible solution to this.

be aware that the styling of the panels and actions menu do not appear if you do this and need to be added back in

I have tried out the code and as you said the styling of the panel does not appear for your custom tpl file. Seems like whichever css files that was suppose to be added is not added.

I’m not familiar with how suitecrm applies its styling to a file. So anyone can help with this?

Hi, I know it’s a late post, but I’m facing the same problem. I’ve tried multiple options, but I can’t find a way to restore the styling of my panels in my custom file. Is there a solution or another approach I could try?

Thanks.