internetearnings.com

Add Related Listings in phpMyDirectory

In WordPress, related post plugin is very good to get visitors to read more or your blog & reducing bounce rate. If you want to have the same function in phpMyDirectory, need to add the following code.

Update : For phpMyDirectory version starting 1.4.3, you no longer have to edit “listing.php” file. This feature includes by default. You only need to edit “listing_default.tpl” if the template does not include this feature.

1. “listing.php” in phpMyDirectory installation

Find the following code

$PMDR->get('Statistics')->insert('listing_impression',$listing['id']);

Add the following code directly above it

// Related Listing start
if(!$related_listings = $PMDR->get('Cache')->get('listing_related_'.$listing['id'], 2592000)) {
    $related_listings = $db->GetAll("SELECT id, title, friendly_url, MATCH(title, description_short, keywords) AGAINST('".$listing['title']." ".$listing['keywords']."') AS score
    FROM ".T_LISTINGS."
    WHERE MATCH(title,  description_short, keywords) AGAINST('".$listing['title']." ".$listing['keywords']."') AND id!=?
    ORDER BY score DESC LIMIT 10",array($listing['id']));
    if(is_array($related_listings)) {
       foreach($related_listings AS &$related_listing) {
          $related_listing['url'] = $PMDR->get('Listings')->getURL($related_listing['id'],$related_listing['friendly_url']);
       }
    }
    $PMDR->get('Cache')->write('listing_related_'.$listing['id'],$related_listings);
}
$template_content->set('related_listings',$related_listings);
// Related Listing end

2. “listing_default.tpl” in template folder.

Add the following code where you want to display the Related Listing

<h2>Related Listings</h2>
<?php if($related_listings) { ?>
   <strong>
     <?php foreach($related_listings AS $related_listing) { ?>
     <li><a href="<?php echo $related_listing['url']; ?>"><?php echo $related_listing['title']; ?></a></li>
     <?php } ?>
   </strong>
<?php } ?>

Disable “[ipcheck] Problem with DNS setup…” cPanel email

IMPORTANT: Do not ignore this email.

Your hostname (yourhostname.com) could not be resolved to an IP
address. This means that /etc/hosts is not set up correctly, and/or
there is no dns entry for yourhostname.com. Please be sure that the
contents of /etc/hosts are configured correctly, and also that
there is a correct 'A' entry for the domain in the zone file.

Some or all of these problems can be caused by /etc/resolv.conf
being setup incorrectly. Please check that file if you believe
everything else is correct.

You may be able to automatically correct this problem by using the
'Add an A entry for your hostname' option under 'Dns Functions' in
your Web Host Manager.

If you are using cPanel/WHM & getting this email everyday, it means that your IP configuration is not done correctly. But maybe some of you purposely done this due to security reason. Due to this, you may not want to receive this email everyday.

To disable this login to WHM. Go to

Server Contacts   Alert Priority Assignment → IP Address DNS Check → Set Priority to Disabled → Save