Custom DetailView.tpl.php

Hi, i’m new in SuiteCRM and i hope someone can help me.
I modified the DetailView.tpl.php file in cache/smarty/templates_c and all ok, but with quick and repair all changes have been lost.
I must add a panel and in this panel to insert my code.
Please, how can i create a custom DetailView.tpl.php file that keeps the changes?
Thanks

Hi and welcome to the community!

You are working on the wrong folder. For customization we use the custom folder. Cache is build based on the standard and custom folder.

Here are some samples on how to customize views:

Thanks,

AlxGr

Hi AlxGR, thanks for the reply, but unfortunately your examples are not useful for my work.
I’ll explain what I have to do:
I created a panel in Studio and now I have to insert php and html code into this panel, for example <a href …> <? php echo $ name; ?> , where $ name is $ this -> _ tpl_vars [‘fields’] [‘name’] [‘value’]. This I do in DetailView.tpl.php of the Accounts module, but I understand that the file is wrong. Where can I enter these changes? Some idea?

Hi @fab,

I don’t know what exactly you want to achieve. Check this post for some ideas:

Thanks,

AlxGr

Hi AlxGr, i would like to insert an RSS feed in my panel but I don’t know how. Where to insert it? Which files to edit?

Then just use an iFrame field.

Go to your module.
Add new field
Select iFrame …

Then add the field to the detail view

1 Like

Sorry for my questions… ok, i added the iFrame field with Studio, now what do you mean “Then add the field to the detail view”? How? And how i add my code to the field iFrame?

Take a look here:

Perfect, but i have no problem adding fields and panels with Studio. I’m having trouble adding my code to a panel because I don’t know where to insert it

I’m not sure what you want to achieve. …

Any way… a little Google search yielded these results:

https://support.sugarcrm.com/Knowledge_Base/Studio_and_Module_Builder/Adding_a_Google_Map_to_a_Module/

https://community.sugarcrm.com/thread/19812

Hope it helps!

AlxGr

this is the code that I have to insert in the created panel:
$rss = simplexml_load_file(‘https://news.google.com/news/rss/headlines/section/q/’.$this->bean->name.’?ned=us&hl=it&gl=US’);
foreach ($rss->channel->item as $item) {
echo $item->link."
";
}

now, how and where should it be inserted?

Create a custom entry-point (if you need to access SuiteCRM beans etc) or simply a new web page somewhere on your server. Then you just configure the link to it in the iframe field.

Maybe I solved it. I added these lines of code:
$i=0;

foreach ($rss->channel->item as $item) {
$link[$i] = $item->link;
$i++;
}

$this->ss->assign(“link1”, $link[0]);
$this->ss->assign(“link2”, $link[1]);
$this->ss->assign(“link3”, $link[2]);

I was unable to assign an array directly, which is why I assigned the individual values

Sorry, you added that code where, exactly?

Thanks for sharing your solution.

In public function display() of view.detail.php