Example #1
0
/** 
 * Get full content for related items including related images
 */
function getRelatedList($listing_id, $rel_categories, $limit = 4)
{
    $db =& JFactory::getDBO();
    if (is_array($rel_categories)) {
        $rel_categories = implode(",", $rel_categories);
    }
    $sql = "SELECT c.id, c.title, c.catid, c.images, u.name  " . "FROM `#__content` c, `#__relate_listings` r, `#__users` u " . "WHERE (r.id1 = {$listing_id} AND r.id2 = c.id) AND u.id = c.created_by " . "AND c.id != '{$listing_id}' AND c.state > 0 AND c.catid IN ({$rel_categories}) " . "ORDER BY c.id DESC ";
    if ($limit) {
        $sql .= "LIMIT {$limit}";
    }
    $db->setQuery($sql);
    $listings = $db->loadObjectList('id');
    // todo get relatedThumbnail
    foreach ($listings as $listing) {
        $thisid = $listing->id;
        $photos = getRelatedThumb($thisid);
        $photocount = "0";
        foreach ($photos as $photo) {
            if (!$photocount) {
                $default_thumbnail = $photo->thumbnail;
            }
            $photocount++;
        }
    }
    $listings->tn = $default_thumbnail;
    $listings->photocount = $photocount;
    return $listings;
    //
}
Example #2
0
<?php

$related_photos = getRelatedThumb($listing['Listing']['listing_id']);
if (count($related_photos)) {
    $document =& JFactory::getDocument();
    $document->_metaTags['property']['og:image'] = JURI::base() . $related_photos[0]->thumbnail;
    // **depends on core hax**
    $desc = trim(strip_tags($listing['Listing']['text']));
    if (strlen($desc)) {
        $document->setDescription($desc);
    }
}
?>

<div class="fl">
<div class="article-likes">

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="<?php 
echo JURI::getInstance()->toString();
?>
" data-send="true" data-layout="button_count" data-width="100" data-show-faces="false"></div>
Example #3
0
require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
//time
$datetime = "";
$jr_startdate = $CustomFields->field('jr_startdate', $listing, false, false);
$jr_time = $CustomFields->field('jr_time', $listing, false, false);
if ($jr_startdate) {
    $datetime = $jr_startdate;
    if ($jr_time) {
        if ($jr_startdate) {
            $datetime .= ' - ';
        }
        $datetime .= $jr_time;
        $datetime = htmlentities($datetime, ENT_QUOTES, "UTF-8");
    }
}
$relatedThumb = getRelatedThumb($listing['Listing']['listing_id'], 3);
$preview_html = $listing['Listing']['title'] . '::';
foreach ($relatedThumb as $thumb) {
    if ($thumb->storage == "file") {
        $tnlink = "";
    } else {
        $tnlink = "http://hooked.no.s3.amazonaws.com/";
        //todo prefix with amazon url
    }
    $tnlink .= $thumb->thumbnail;
    $preview_html .= "&lt;img src=&quot;" . $tnlink . "&quot; class=&quot;fl&nbsp;jomtips&quot; /&gt;";
}
$preview_html .= ' ' . $datetime;
$preview_html .= '&lt;br /&gt;Click to see catch details &raquo;';
$link = ContentHelperRoute::getArticleRoute($listing['Listing']['listing_id'], $listing['Category']['cat_id'], $listing['Section']['section_id']);
?>