vtiger Forum Index vtiger
The Honest Open Source CRM
 

RE: Custom contact layouts
Click here to go to the original topic

 
       vtiger Forum Index -> Code Contributions - 4.x
Previous topic :: Next topic  
Author Message
yousufp



Joined: 03 Jan 2006
Posts: 6

Posted: Sat Jun 24, 2006 3:54 am    Post subject: RE: Custom contact layouts  

hi,

Ok im very new to this PHP/MySQL, and you probably might laugh at the way i did this, but i managed to customise the layout of the contact views for both detailview.html and editview.html as follows:

First for Detailview.php (This file is located in vtiger/modules/contacts/DetailView.php):

open/Edit detailviews.php in your editor, goto line 43-44.



$focus->firstname=$focus->column_fields['firstname'];
$focus->lastname=$focus->column_fields['lastname']



I added these lines after it:



$focus->mobile=$focus->column_fields['mobile'];
$focus->homephone=$focus->column_fields['homephone'];
$focus->mobile=$focus->column_fields['mobile'];
$focus->email=$focus->column_fields['email'];
$focus->salutationtype=$focus->column_fields['salutationtype'];
$focus->birthday=$focus->column_fields['birthday'];
$focus->mailingstreet=$focus->column_fields['mailingstreet'];
$focus->mailingcity=$focus->column_fields['mailingcity'];
$focus->mailingzip=$focus->column_fields['mailingzip'];
$focus->homephone=$focus->column_fields['homephone'];



Now for the custom fields depending on alot of things, you'll have to figure out what they are in the database, see mine are like this:

$focus->cf_354=$focus->column_fields['cf_354'];
$focus->cf_356=$focus->column_fields['cf_356'];
$focus->cf_358=$focus->column_fields['cf_358'];
$focus->cf_360=$focus->column_fields['cf_360'];
$focus->cf_362=$focus->column_fields['cf_362'];
$focus->cf_364=$focus->column_fields['cf_364'];
$focus->cf_366=$focus->column_fields['cf_366'];

Ok in the same file Detailviews.php (This file is located in vtiger/modules/contacts/DetailView.php): you'll need to find the line that begins with:



if (isset($focus->firstname)) $xtpl->assign("FIRST_NAME", $focus->firstname);
else $xtpl->assign("FIRST_NAME", "");
$xtpl->assign("LAST_NAME", $focus->lastname);




Then add the following just underneath it:

$xtpl->assign("MOBILE", $focus->mobile);
$xtpl->assign("EMAIL", $focus->email);
$xtpl->assign("SALUTATIONTYPE", $focus->salutationtype);
$xtpl->assign("HOMEPHONE", $focus->homephone);
$xtpl->assign("BIRTHDAY", $focus->birthday);
$xtpl->assign("MAILINGSTREET", $focus->mailingstreet);
$xtpl->assign("MAILINGCITY", $focus->mailingcity);
$xtpl->assign("MAILINGZIP", $focus->mailingzip);

$xtpl->assign("CF_354", $focus->cf_354);
$xtpl->assign("CF_356", $focus->cf_356);
$xtpl->assign("CF_358", $focus->cf_358);
$xtpl->assign("CF_360", $focus->cf_360);
$xtpl->assign("CF_362", $focus->cf_362);



I've got about 250 custom fields altogether. I know what you're thinking, but i haven't finished yet - there's more.

Now open the DetailView.html file (This file is located in vtiger/modules/contacts/DetailView.html): .

At the end of this table:

{WORDTEMPLATEOPTIONS}
{MERGEBUTTON}
</td>
</form>
</tr>
</table>



I added the following:



<table border="0" width="100%">
<tr>
<td width="100%" align="left" colspan="4" bgcolor="#C0C0C0"><b>Contact Information</b></td>
</tr>
<tr>
<td width="11%" align="left"><b>First Name:</b></td>
<td width="39%" align="left">{SALUTATIONTYPE} {FIRST_NAME}</td>
<td width="12%" align="left"><b>Last Name:</b></td>
<td width="38%" align="left">{LAST_NAME}</td>
</tr>
<tr>
<td width="11%" align="left"><b>Mobile:</b></td>
<td width="39%" align="left">{MOBILE}</td>
<td width="12%" align="left"><b>EngineNumber:</b></td>
<td width="38%" align="left">{CF_354}</td>
</tr>
<tr>


Basically i have no idea how it works, but it does. I think in the PHP file you can assign the fields $xtpl->assign("MOBILE", $focus->mobile);

So that in the html file you can call them up with the curly braces {MOBILE}.

I've been testing it and it works. Please comment on this with regards to have i done this ok? Is there a better or quicker way?

Thanks and Kind Regards,

Yous
Back to top  
minnie



Joined: 06 Sep 2005
Posts: 299
Location: CHENNAI,INDIA

Posted: Mon Jun 26, 2006 6:52 am    Post subject: RE: Custom contact layouts  

Hello Yous,

Thank you for your interest in vtigerCRM.

Yes, what you have done is absolutely correct. In all DetailView.php we have processed the data and parsed it to html files through xtemplate variables. For eg., take the following staement
Quote: $xtpl->assign("MOBILE", $focus->mobile);
where MOBILE is a xtemplate variable. we are parsing all the xtemplate variables to corresponding html file.
Quote: for eg., $xtpl=new XTemplate('modules/Contacts/DetailView.html');
In html file, all xtemplate variables replaced by the assigned values. This is the way to pass the value to html files.

Hope this helps you.

Thanks & Regards,
Minnie.
Back to top  
yousufp



Joined: 03 Jan 2006
Posts: 6

Posted: Mon Jun 26, 2006 1:19 pm    Post subject: RE: Custom contact layouts  

Hi Minnie,

Thanks for your reply, I've got a big smile on my face...:)

Kind regards

Yous.
Back to top  
 
       vtiger Forum Index -> Code Contributions - 4.x
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.15 © 2001, 2002 phpBB Group