Scripts

How to Change Google Map Type in phpMyDirectory

To change Google Map Type in listing details of phpMyDirectory from the default “ROADMAP” is very easy. You only to edit “/includes/class_map.php” file.

Find the following

MapTypeId.HYBRID

Replace it with any of 4 options below, depending on your map selection.

  1. MapTypeId.ROADMAP – displays the default road map view. This is the default map type.
  2. MapTypeId.SATELLITE – displays Google Earth satellite images
  3. MapTypeId.HYBRID – displays a mixture of normal and satellite views
  4. MapTypeId.TERRAIN – displays a physical map based on terrain information.

Add “Edit” Link in the Front-end of phpMyDirectory

“Edit” link for the listing in the Frontend (listing details page) is very useful for phpMyDIrectory admin. This is useful when admin browsing the listing detail page & found an error. It will save time to search the exact listing in the admin area.

This feature is similar to WordPress and will only appear if the admin already log-in.

To add this feature, you have to modify 2 files.

1. listing.php file

Fine the following code

$template_content->set('related_listings',$related_listings);

add the following code just after it.

// If admin session active, add edit listing link
if(@in_array('admin_login',$_SESSION['admin_permissions'])) {
    $template_content->set('edit_listing', '/cp/admin_listings.php?action=edit&id='.$listing['id']);
}

2. “listing_default.tpl” file in template directory. Add where you want the “Edit link to appear.

<!-- Admin Edit Listing -->
<?php if($edit_listing) { ?>
<a rel="nofollow" target="_blank" href="<?php echo BASE_URL.$edit_listing; ?>">Edit ID# <?php echo $id; ?></a>
<?php } ?>
<!-- end Admin Edit Listing -->