Customising Contact Category to show image

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Forum rules
Post Reply
petersen
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Jan 23, 2008 5:35 pm

Customising Contact Category to show image

Post by petersen » Fri Mar 14, 2008 1:07 pm

I'm using J1.5 with a modified Beez template (default). I wish to alter the main Contacts Category page. Currently I have a menu item which doesn't specify a Contact Category to display and therefore lists all of the contacts. I've altered \templates\default\html\com_contact\category\default_items.php to display as I require, but I can't pickup the URL for for images (I have images defined for the contacts). My code is:

Code: Select all

<?php foreach ($this->items as $item) : ?>
<div class="contact">
		<img src="<?php echo $item->image; ?>" alt="<?php echo $item->name; ?>" height="200" width="170" />
		<dl>
			<?php if ($this->params->get('show_position')) : ?>
				<dt><?php echo JText::_('Position'); ?></dt>
				<dd><?php echo $item->con_position; ?></dd>
			<?php endif; ?>

			<dt><?php echo JText::_('Name'); ?></dt>
			<dd><a href="<?php echo $item->link; ?>"><?php echo $item->name; ?></a></dd>

			<?php if ($this->params->get('show_email')) : ?>
				<dt><?php echo JText::_('Email'); ?></dt>
				<dd><?php echo $item->email_to; ?></dd>
			<?php endif; ?>

			<?php if ($this->params->get('show_telephone')) : ?>
				<dt><?php echo JText::_('Telephone'); ?></dt>
				<dd><?php echo $item->telephone; ?></dd>
			<?php endif; ?>

			<?php if ($this->params->get('show_mobile')) : ?>
				<dt><?php echo JText::_('Mobile'); ?></dt>
				<dd><?php echo $item->mobile; ?></dd>
			<?php endif; ?>

			<?php if ($this->params->get('show_fax')) : ?>
				<dt><?php echo JText::_('Fax'); ?></dt>
				<dd><?php echo $item->fax; ?></dd>
			<?php endif; ?>

		</dl>
</div>

<?php endforeach; ?>
At teh top I wish to display the image (I'll add the base URL after). Currently this isn't appearing in the HTML. Do I need to modify part of the com_contact to get this to display?

petersen
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Jan 23, 2008 5:35 pm

Re: Customising Contact Category to show image

Post by petersen » Fri Mar 14, 2008 1:09 pm

Apologies. I'm been a nobber. I was getting the image path through, just not on the image I was looking for!

Code: Select all

<?php // @version $Id: default_items.php 9718 2007-12-20 22:35:36Z eddieajau $
defined('_JEXEC') or die('Restricted access');
$cparams = JComponentHelper::getParams ('com_media');
?>
<?php foreach ($this->items as $item) : ?>
<div class="contact">
		<img src="<?php echo  $this->baseurl .'/'. $cparams->get('image_path').'/'. $item->image; ?>" alt="<?php echo $item->name; ?>" height="200" width="170" />
		<dl>
			<?php if ($this->params->get('show_position')) : ?>
				<dt><?php echo JText::_('Position'); ?></dt>
				<dd><?php echo $item->con_position; ?></dd>
			<?php endif; ?>

			<dt><?php echo JText::_('Name'); ?></dt>
			<dd><a href="<?php echo $item->link; ?>"><?php echo $item->name; ?></a></dd>

			<?php if ($this->params->get('show_email')) : ?>
				<dt><?php echo JText::_('Email'); ?></dt>
				<dd><?php echo $item->email_to; ?></dd>
			<?php endif; ?>

			<?php if ($this->params->get('show_telephone')) : ?>
				<dt><?php echo JText::_('Telephone'); ?></dt>
				<dd><?php echo $item->telephone; ?></dd>
			<?php endif; ?>

			<?php if ($this->params->get('show_mobile')) : ?>
				<dt><?php echo JText::_('Mobile'); ?></dt>
				<dd><?php echo $item->mobile; ?></dd>
			<?php endif; ?>

			<?php if ($this->params->get('show_fax')) : ?>
				<dt><?php echo JText::_('Fax'); ?></dt>
				<dd><?php echo $item->fax; ?></dd>
			<?php endif; ?>

		</dl>
</div>

<?php endforeach; ?>


Post Reply