Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2010
    Location
    Orange County, CA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    YOOtheme's Built-In Social Buttons Not Referencing Proper Image

    I was wondering if ANYONE could help me with a PHP question? I'm using YOOtheme's ZOO 2.6.6 in Joomla 2.5.7. The built-in social buttons are not referencing the proper image when clicked.

    I'm trying to figure out how I can dynamically retrieve the proper image, which is located in the same article as are the buttons, using PHP. I've heard about using XPath but everytime I try to configure it, my site never loads up right away or it crashes.

    Here's the block of HTML I have to work with--it's all generated via the template PHP:

    Code:
    <div id="yoo-zoo" class="yoo-zoo news news-title-of-article" itemscope itemtype="http://schema.org/Article">
      <div class="item">
        <h2 class="pos-title">Title of article</h2>
        <div class="meta">
          <div class="author">Author</div>
          <div class="date">Date</div>
        </div>
      <div class="media">
        <div class="element element-image first last">	
          <img src="http://mywebsite.com/cache/com_zoo/images/random-alphanumeric-charaters.jpg" alt="Title of article" width="###px" height="###px" itemprop="image">
        </div>
      </div>
      <div class="share">
        <div class="quote">
          <div class="element element-textarea first last">“This is the main article quote."
          </div>
        </div>
      <div class="social">
        <div class="element element-socialbuttons first last">
          <div class="yoo-zoo socialbuttons clearfix">
            <div><iframe src="..."></iframe></div>
            <div><iframe src="..."></iframe></div>
            <div><iframe src="..."></iframe></div>
          </div>
        </div>
      </div>
    </div>
    I've successfully configured every other open graph meta tag (dynamically) but can't seem to solve the og:image issue. I know this should be an easy fix but I'm still a relative noob to PHP. Any advice would be greatly appreciated!

  • #2
    0x3
    0x3 is offline
    New Coder
    Join Date
    Sep 2013
    Location
    Somewhere on a map
    Posts
    37
    Thanks
    0
    Thanked 5 Times in 5 Posts
    I would report this to the author, this sounds more like a css problem, or a problem with the generated template.

  • #3
    New to the CF scene
    Join Date
    Oct 2010
    Location
    Orange County, CA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's the code I have currently running in the <head> of template. I have a default image set to load in the event the article in question doesn't have an image.

    PHP Code:
    <?php $option JRequest::getVar('option'''); if($option=='com_zoo') {$db $database JFactory::getDBO(); $doc =& JFactory::getDocument(); $id JRequest::getInt('id'); $sql "SELECT * FROM #__content WHERE id=".$id." LIMIT 1"$db->setQuery($sql); $item $db->loadObject(); preg_match('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i'$item->image$image); if(!empty($image)) $doc->addCustomTag("<meta property='og:image' content='"JURI::base().$image[1]."'>" ); else $doc->addCustomTag("<meta property='og:image' content='http://www.mywebsite.com/images/ogp/default.png'>"); } ?>
    Any ideas why it's not working?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •