phpMyDirectory

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 -->

Remove Address & Description in Recent Listing Sidebox in phpMyDirectory

Recent Listing Sidebox in phpMyDirectory is very long because it contains listing address & short description. I prefer short sidebox hence I want to remove listing address & short description.

To do this, need to edit 2 files.

/includes/sidebox_data.php

Under the “// RECENT” section find the following

$results[$key]['link'] = $PMDR->get('Listings')->getURL($value['id'],$value['friendly_url']);

Add the following code directly above it.

$results[$key]['nodetails'] = 1;

blocks/sidebox_listings.tpl file in template directory

Find the following

<span class="listing_sidebox_location"><?php echo $this->escape($listing['address']); ?></span><br />
<span class="listing_sidebox_description"><?php echo $this->escape_html($listing['description_short']); ?></span><br />

Replace it with the code below

<?php if($listing['nodetails'] != 1) { ?>
<span class="listing_sidebox_location"><?php echo $this->escape($listing['address']); ?></span><br />
<span class="listing_sidebox_description"><?php echo $this->escape_html($listing['description_short']); ?></span><br />
<?php } ?>