Adding Google Map to Project or Profile page

It is possible to show Google Map on Project detail page and on User Profile page with the help of third-party plugin and JoomBri custom fields.

Follow the steps carefully for the successful implementation.

Step 1 - Installing Plug-in

Download Googlemap plugin and install it. Please make sure you have enabled it in your site's backend Plug-in Manager.

Step 2 - Creating Custom Field

Create a custom field of type Textbox from Custom Fields. Give the field a title name, say Address. After saving the field, make of note of the field ID (say 12). It is assumed that the field has been assigned some value.

Step 3 - Customizing the PHP page

Project Detail Page:

  • Open the file <root>/components/com_jblance/views/project/tmpl/detailproject.php
  • Add the following code in an appropriate place. In this docs page, it has been placed right below the Skills Required.
<?php $fields = JblanceHelper::get('helper.fields'); ?>
{mosmap lightbox address='<?php echo $fields->getFieldValue(12, $row->id, 'project');?>'|lbxzoom='16'}

after

<h4><?php echo JText::_('COM_JBLANCE_SKILLS_REQUIRED'); ?>:</h4>
<div><?php echo JblanceHelper::getCategoryNames($row->id_category); ?></div>

User Profile Page:

  • Open the file <root>/components/com_jblance/views/user/tmpl/viewprofile.php
  • Add the following code in an appropriate place. In this docs page, it has been placed right below the User's Status.
<?php $fields = JblanceHelper::get('helper.fields'); ?>
{mosmap lightbox address='<?php echo $fields->getFieldValue(6, $userid, 'profile');?>'|lbxzoom='16'}

after

<div class="control-group">
	<label class="control-label nopadding"><?php echo JText::_('COM_JBLANCE_STATUS'); ?>: </label>
	<div class="controls">
		<?php
		//get user online status
		$status = $jbuser->isOnline($this->userInfo->user_id);
		?>
		<?php if($status) : ?>
			<span class="label label-success"><?php echo JText::_('COM_JBLANCE_ONLINE'); ?></span>
		<?php else : ?>
			<span class="label"><?php echo JText::_('COM_JBLANCE_OFFLINE'); ?></span>
		<?php endif; ?>	
	</div>
</div>

Notes:

  1. You need to replace the appropriate Field IDs obtained from Step 2.
  2. Back up the files to be modified before making any changes.

© Copyright 2012 - 2023 BriTech Solutions. All rights reserved.