Wednesday, 8 January 2014

Joomla contacts lists with Photos and misc information

I'm making a website for a client and I want it to be easy for the client to edit the "meet the team" page. Previously I just made an article and add the information in the article and format.

Of course there is the contacts section in Joomla which can be used. A menu item can display all contacts in a list, only problem is also want a photo and the 'misc information' field.

I've looked at a few different extensions, but couldn't find something which simply added these two things to the list view.

I found a forum here which describes how to add the picture to the table in the contacts list view. It involves editing the default_items.php file and inserting:

<th class="item-picture">
<td class="item-picture">
   <?php if ($item->image) : ?>
      <a href="<?php echo JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid)); ?>">
         <img alt="<?php echo $item->name; ?>" src="<?php echo $item->image; ?>" />
   <?php endif; ?> 

I wonder how hard it is to also get another cell with misc-information in?

To get the misc info in I inserted this code:
<div class="item-misc"> &lt;?php echo $item->misc; ?&gt; </div>

I've also read here that you can override the default_item.php by creating folders with your template directory /com_content/views/featured/

Will need to look into both of these. But not sure if I currently have the time!

So, looking further into it looks like in Joomla 3.2 you can create overrides from within the management system which I found here.

Go into the template files, then there is a tab called "create overrides". Sorted.  I picked the "com_contact" > Featured. This placed some new files in the template directory so that only this template overrides the defaults.

From there you can access the "default_items.php" file.

I basically replaced all li elements with div elements. Then I styled it with CSS

No comments:

Post a Comment