title: Suitecrm/Sugarcrm ..How to assign an array in template file?
body: <p>Here the controller view file SuiteCRM/modules/Contacts/views/view.detail.php</p>
  
  <pre><code>&lt;?php
  if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');   
  
  require_once('include/MVC/View/views/view.detail.php');
  require_once('api/soap_api.php');
  
  class ContactsViewDetail extends ViewDetail
  {
      /**
       * @see SugarView::display()
       *
       * We are overridding the display method to manipulate the portal information.
       * If portal is not enabled then don't show the portal fields.
       */
      public function display(){
          global $sugar_config;
  
          $aop_portal_enabled = !empty($sugar_config['aop']['enable_portal']) &amp;&amp; !empty($sugar_config['aop']['enable_aop']);
          //echo '&lt;pre&gt;===='; print_r($aop_portal_enabled); exit; 
          $this-&gt;ss-&gt;assign("AOP_PORTAL_ENABLED", $aop_portal_enabled);
  
          require_once('modules/AOS_PDF_Templates/formLetter.php');
          formLetter::DVPopupHtml('Contacts');
  
          $admin = new Administration();
          $obj         = new AirtelUserInfo();
          $res         = $obj-&gt;test();
  
          $sql = 'select * from contacts';
  
          //$result = $this-&gt;db-&gt;query($sql,true," Error filling in additional detail fields: ");
  
          // Get the id and the name.
          //$row = $this-&gt;db-&gt;fetchByAssoc($result);
  
          //echo '&lt;pre&gt;'; print_r($sql); exit;
  
  
          $this-&gt;ss-&gt;assign("res", $res);
  
          $admin-&gt;retrieveSettings();
          if(isset($admin-&gt;settings['portal_on']) &amp;&amp; $admin-&gt;settings['portal_on']) {
              $this-&gt;ss-&gt;assign("PORTAL_ENABLED", true);
          }
          parent::display();
      }
  }
  </code></pre>
  
  <p>here the tpl file path 
  SuiteCRM/cache/modules/Contacts/DetailView.tpl</p>
  
  <pre><code>&lt;script language="javascript"&gt;
  {literal}
  SUGAR.util.doWhen(function(){
      return $("#contentTable").length == 0;
  }, SUGAR.themes.actionMenu);
  {/literal}
  &lt;/script&gt;
  &lt;table cellpadding="0" cellspacing="0" border="0" width="100%" id=""&gt;
  &lt;tr&gt;
  &lt;td class="buttons" align="left" NOWRAP width="80%"&gt;
  &lt;div class="actionsContainer"&gt;
  &lt;form action="index.php" method="post" name="DetailView" id="formDetailView"&gt;
  &lt;input type="hidden" name="module" value="{$module}"&gt;
  &lt;input type="hidden" name="record" value="{$fields.id.value}"&gt;
  &lt;input type="hidden" name="return_action"&gt;
  &lt;input type="hidden" name="return_module"&gt;
  &lt;input type="hidden" name="return_id"&gt;
  &lt;input type="hidden" name="module_tab"&gt;
  &lt;input type="hidden" name="isDuplicate" value="false"&gt;
  &lt;input type="hidden" name="offset" value="{$offset}"&gt;
  &lt;input type="hidden" name="action" value="EditView"&gt;
  &lt;input type="hidden" name="sugar_body_only"&gt;
  &lt;/form&gt;
  &lt;ul id="detail_header_action_menu" class="clickMenu fancymenu" &gt;&lt;li class="sugar_action_button" &gt;{if $bean-&gt;aclAccess("edit")}&lt;input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="var _form = document.getElementById('formDetailView'); _form.return_module.value='Contacts'; _form.return_action.value='DetailView'; _form.return_id.value='{$id}'; _form.action.value='EditView';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}"&gt;{/if} &lt;ul id class="subnav" &gt;&lt;li&gt;{if $bean-&gt;aclAccess("edit")}&lt;input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="var _form = document.getElementById('formDetailView'); _form.return_module.value='Contacts'; _form.return_action.value='DetailView'; _form.isDuplicate.value=true; _form.action.value='EditView'; _form.return_id.value='{$id}';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button"&gt;{/if} &lt;/li&gt;&lt;li&gt;{if $bean-&gt;aclAccess("delete")}&lt;input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="var _form = document.getElementById('formDetailView'); _form.return_module.value='Contacts'; _form.return_action.value='ListView'; _form.action.value='Delete'; if(confirm('{$APP.NTC_DELETE_CONFIRMATION}')) SUGAR.ajaxUI.submitForm(_form);" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}" id="delete_button"&gt;{/if} &lt;/li&gt;&lt;li&gt;{if $bean-&gt;aclAccess("edit") &amp;&amp; $bean-&gt;aclAccess("delete")}&lt;input title="{$APP.LBL_DUP_MERGE}" class="button" onclick="var _form = document.getElementById('formDetailView'); _form.return_module.value='Contacts'; _form.return_action.value='DetailView'; _form.return_id.value='{$id}'; _form.action.value='Step1'; _form.module.value='MergeRecords';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Merge" value="{$APP.LBL_DUP_MERGE}" id="merge_duplicate_button"&gt;{/if} &lt;/li&gt;&lt;li&gt;&lt;input class="button" id="manage_subscriptions_button" title="{$APP.LBL_MANAGE_SUBSCRIPTIONS}" onclick="var _form = document.getElementById('formDetailView');_form.return_module.value='Contacts'; _form.return_action.value='DetailView'; _form.return_id.value='{$fields.id.value}'; _form.action.value='Subscriptions'; _form.module.value='Campaigns'; _form.module_tab.value='Contacts';_form.submit();" name="Manage Subscriptions" type="button" value="{$APP.LBL_MANAGE_SUBSCRIPTIONS}"/&gt;&lt;/li&gt;&lt;li&gt;&lt;input type="button" class="button" onClick="showPopup();" value="{$APP.LBL_GENERATE_LETTER}"/&gt;&lt;/li&gt;&lt;li&gt;{if !$fields.joomla_account_id.value &amp;&amp; $AOP_PORTAL_ENABLED}&lt;input title="{$MOD.LBL_CREATE_PORTAL_USER}" class="button" onclick="var _form = document.getElementById('formDetailView');_form.action.value='createPortalUser';_form.submit();" name="buttonCreatePortalUser" id="createPortalUser_button" type="button" value="{$MOD.LBL_CREATE_PORTAL_USER}"/&gt;{/if}&lt;/li&gt;&lt;li&gt;{if $fields.joomla_account_id.value &amp;&amp; !$fields.portal_account_disabled.value &amp;&amp; $AOP_PORTAL_ENABLED}&lt;input title="{$MOD.LBL_DISABLE_PORTAL_USER}" class="button" onclick="var _form = document.getElementById('formDetailView');_form.action.value='disablePortalUser';_form.submit();" name="buttonDisablePortalUser" id="disablePortalUser_button" type="button" value="{$MOD.LBL_DISABLE_PORTAL_USER}"/&gt;{/if}&lt;/li&gt;&lt;li&gt;{if $fields.joomla_account_id.value &amp;&amp; $fields.portal_account_disabled.value &amp;&amp; $AOP_PORTAL_ENABLED}&lt;input title="{$MOD.LBL_ENABLE_PORTAL_USER}" class="button" onclick="var _form = document.getElementById('formDetailView');_form.action.value='enablePortalUser';_form.submit();" name="buttonENablePortalUser" id="enablePortalUser_button" type="button" value="{$MOD.LBL_ENABLE_PORTAL_USER}"/&gt;{/if}&lt;/li&gt;&lt;li&gt;{if $bean-&gt;aclAccess("detail")}{if !empty($fields.id.value) &amp;&amp; $isAuditEnabled}&lt;input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick='open_popup("Audit", "600", "400", "&amp;record={$fields.id.value}&amp;module_name=Contacts", true, false,  {ldelim} "call_back_function":"set_return","form_name":"EditView","field_to_name_array":[] {rdelim} ); return false;' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}"&gt;{/if}{/if}&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;
  &lt;/div&gt;
  &lt;/td&gt;
  </code></pre>