CONTROL IMAGES ON FACEBOOK STATUS POSTS?

5 posts by 2 authors in: Forums > CMS Builder
Last Post: April 22, 2013   (RSS)

By gregThomas - April 22, 2013

Hi Tina, 

I think the problem is that the getRecords function is returning an array of 3 products_featured, and it looks as if you're not looping through them first, if you modify your code like this, it should work:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="en-US" />

<?php foreach($products_featuredRecords as $products_featuredRecord: ?>
  <?php foreach ($products_featuredRecord['images'] as $index => $upload): ?>
    <link rel="image_src" href="<?php echo $upload['urlPath'] ?>" / >
  <?php endforeach ?>
<?php endforach; ?>

So the page loops through each products_featured record, then loops through each products images.

Let me know if you have any questions.

Cheers!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By csdesign - April 22, 2013 - edited: April 22, 2013

Thanks for the help, Greg! 

I added a ")" after the"Record" in the first line and I also changed "endforach" to "endforeach" in the last line

<?php foreach($products_featuredRecords as $products_featuredRecord): ?>
<?php foreach ($products_featuredRecord['images'] as $index => $upload): ?>
<link rel="image_src" href="<?php echo $upload['urlPath'] ?>" / >
<?php endforeach ?>
<?php endforeach; ?>

 Off to test in facebook now that all the errors are gone! :) 

By gregThomas - April 22, 2013

Woops! It needs more brackets:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="en-US" />

<?php foreach($products_featuredRecords as $products_featuredRecord): ?>
  <?php foreach ($products_featuredRecord['images'] as $index => $upload): ?>
    <link rel="image_src" href="<?php echo $upload['urlPath'] ?>" / >
  <?php endforeach ?>
<?php endforeach; ?>

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By csdesign - April 22, 2013

It's creating the correct source code now! Nice!!  

<link rel="image_src" href="/cmsAdmin/uploads/long-term-food-storage_1.jpg" / >
<link rel="image_src" href="/cmsAdmin/uploads/assault-cross-draw-vest.jpg" / >
<link rel="image_src" href="/cmsAdmin/uploads/shockwave_2targets.jpg" / >

But not working with facebook yet. I'm still getting the same image choices as before. I will test on another computer and OS tonight and tomorrow and see if it works.  Maybe it just needs some time to "think about it".. ha