View Single Post
Old 11-02-2015, 09:01 AM  
zerovic
Confirmed User
 
zerovic's Avatar
 
Industry Role:
Join Date: Apr 2010
Posts: 1,098
Ok, so you posted this line, which doesn't seem to be working

Quote:
<meta property="og:image" content="<?php echo base_url(); ?>upload/gallery.php?imagen=<?php echo $fila['imagen1']; ?>
and what I see, is that the $fila['imagen1']; don't display anything.

I would like to ask you to add this under this meta property line
Quote:
<?php
if($_GET['dev']) {
print_r($fila);
}
?>
and call the same url adding ?dev=1 to the end of the url

So we can make sure the the array already exists! As you stated, that the code works below, I assume that the array is not created when you try to use it. To make it work, simply create the array before adding the meta property, so it will look like this

Quote:
<?php foreach ($data->result_array() as $fila) { ?>
<?php if (!empty($fila['imagen1'])) { ?>
<meta property="og:image" content="<?php echo base_url(); ?>upload/gallery.php?imagen=<?php echo $fila['imagen1']; ?>
<?php } } ?>
What it does, is basically creates the array based on $data->result_array(), and when $fila['imagen1'] is available, it will display the meta property.

Try it and let's see if it works out for you.
__________________
php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com
zerovic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote