CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Making Custom Profile formats/layouts
Pages: [1]

Author Topic: Making Custom Profile formats/layouts  (Read 6380 times)

sbrawner

  • Guest
Making Custom Profile formats/layouts
March 01, 2008, 06:47:00 am

Docs are thin for this, was wondering if anyone had managed to make different profile layouts, and how you implemented them.  Some examples would be great.  I saw that link to Smarty, but was not sure how that was related.

TIA!
Scott

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Making Custom Profile formats/layouts
March 01, 2008, 11:08:08 am

check:

http://svn.civicrm.org/kabissa/trunk/templates/Kabissa/CRM/Profile/ for some simple examples

the docs are here: http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in+and+Profile+Screens

which seem pretty detailed for us :) any specific comments on where u think it is thin?

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

sbrawner

  • Guest
Re: Making Custom Profile formats/layouts
March 01, 2008, 07:57:41 pm
I didn't mean that the explanation for how the screens and profiles work is thin, I just meant there aren't really any docs on how to actually *make* the custom stuff is.  Now that I look at your links I realize that this is really beyond the purview and responsibility of the CCRM team to have to document.


Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Making Custom Profile formats/layouts
March 01, 2008, 08:16:11 pm

I'm still a bit confused here. The docs give you fairly explicit step by step instructions on how to take a template and customize/modify it for your needs. So what is missing/unclear? i.e. how can we improve it?

We've pointed it to a few people and folks in general have found it useful. It does assume a certain level of system knowledge (i.e. being able to create directories and modify files)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

thebenedict

  • Guest
Re: Making Custom Profile formats/layouts
March 12, 2008, 09:02:16 pm
I'll echo sbrawner's concerns. I would like to be able to put together profiles that contain a lot of data (many fields and some large text fields) and are publicly viewable (i.e. they also have to look good). As an accidental techie type I am finding this difficult to do.

I started with the docs. Looking at View.tpl I see that

Code: [Select]
{foreach from=$profileGroups item=group}
    {*<h2>{$group.title}</h2>*}
    {$group.content}
{/foreach}

is handling the display of content, and it's clear that I can add tags around this code to add some custom text or styling. What's not clear (even with smarty debug turned on in an effort to find out what the template variables are) is how to modify the display of data within the above 4 lines of code.

For example, since there are a large number of fields, it would be helpful to add separators between or boxes around groups of related fields. The default layout makes a very good looking display for small amounts of data:

http://redwoodtech.org/civicrm/profile/view?gid=6&reset=1&search=0&id=967

but less so when there's more to display:

http://www.kabissa.org/civicrm/profile/view?reset=1&id=517&gid=3

The field labels on the left are too close together, and the column of text would look better if it was wider. I think this is a css issue, not a .tpl issue, but I'm not sure. Eventually I would also like to add some conditional statements, e.g. to only display a user's e-mail address in their profile if they've checked a 'display my e-mail' box.

I don't see a lot on the forums about this... I'd love to find a resource I've overlooked, or some examples of significantly customized profiles. Also, these are frustrating but mostly minor concerns. I am new to CCRM and am impressed with all the things it can do.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Making Custom Profile formats/layouts
March 13, 2008, 12:22:29 am

View.tpl works in conjunction with Dynamic.tpl in the same directory. You can specialize the below tpl for one specific profile and get rid of the foreach loop and lay the table and fields out manually as you see fit :) (or add conditions within the foreach)

Let us know if u have any more questions or need more help. You can also catch us on irc

lobo

Code: [Select]
if ! empty( $row )}
{* wrap in crm-container div so crm styles are used *}
<div id="crm-container" lang="{$config->lcMessages|truncate:2:"":true}" xml:lang="{$config->lcMessages|truncate:2:"":true}">
<fieldset>
<table class="form-layout-compressed">
{foreach from=$row item=value key=name}
  <tr><td class="label">{$name}</td><td class="view-value">{$value}</td></tr>
{/foreach}
</table>
</fieldset>
</div>
{/if}
{* fields array is not empty *}

{literal}
<script type="text/javascript">
function popUp (path)
{
window.open(path,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,screenX=150,screenY=150,top=150,left=150')
}
</script>
{/literal}
1
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

thebenedict

  • Guest
Re: Making Custom Profile formats/layouts
March 14, 2008, 05:54:29 pm
Thanks Lobo, this is starting to get at what I want to do.

I've been looking at the variable $row in Dynamic.tpl. I assume it's an array made up of the field labels and field contents that are supposed to show up in a specific profile view. For example "First Name" and "John". Rather than use a foreach I'd like to pick these fields and labels out individually (as you suggest). Can you help me out with the syntax for this? I've been trying things like {$row[number]} and {$row[number].labelorfieldname} but to no avail.
« Last Edit: March 14, 2008, 10:59:53 pm by thebenedict »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Making Custom Profile formats/layouts
March 14, 2008, 05:58:06 pm
The Smarty Debug window is your friend when trying to do this. It will show you all the variables assigned to your template.

http://wiki.civicrm.org/confluence/display/CRMDOC/Debugging
Protect your investment in CiviCRM by  becoming a Member!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Making Custom Profile formats/layouts
March 14, 2008, 07:04:15 pm

try:

{assign var=name value='First Name'}
{$name} for the label
{$row.$name} for the value

You should check: http://smarty.php.net/manual/en/ for syntax and help if the above does not work :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Making Custom Profile formats/layouts

This forum was archived on 2017-11-26.