Comment ajouter image 2, 3, 4... sur flux rss xml
Posté : 25 mars 2014, 13:29
Bonjour,
Je suis nouveau sur le site et espère trouver quelques réponses à mes recherches..
Alors j'ai script d'annonce entièrement remodelé à ma sauce, soit simple et pas beau (lien par MP)..
Je souhaite y apporter encore des modifications mais je suis limité en codage..
Bref, je souhaite ajouter à mon flux les différentes photos de chaque annonce quand il y en a.
Ficher de flux php joint sinon pas eccepté dans le tuto, la partie image si image elle s'affiche sinon affiche pas d'image :
Merci d'avance.
Je suis nouveau sur le site et espère trouver quelques réponses à mes recherches..
Alors j'ai script d'annonce entièrement remodelé à ma sauce, soit simple et pas beau (lien par MP)..
Je souhaite y apporter encore des modifications mais je suis limité en codage..
Bref, je souhaite ajouter à mon flux les différentes photos de chaque annonce quand il y en a.
Ficher de flux php joint sinon pas eccepté dans le tuto, la partie image si image elle s'affiche sinon affiche pas d'image :
<g:image_link><?php if ($postImage!="" && RSS_IMAGES) echo "$postImage"; else echo "".SITE_URL."/images/no_pic.png"; ?></g:image_link>
je cherche à faire : si plus qu'une image, afficher image 2, 3,..<?php
require_once('../includes/functions.php');
if (file_exists(SITE_ROOT.'/themes/'.THEME.'/feed-rss.php')){//feed-rss from the theme!
require_once(SITE_ROOT.'/themes/'.THEME.'/feed-rss.php');
}
else{//not found in theme
header("Content-type: text/xml; charset=utf-8");
?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
<channel>
<title>RSS - <?php echo $html_title;?></title>
<description>RSS - <?php echo $html_description." ".$currentCategory;?></description>
<link><?php echo SITE_URL;?>/</link>
<pubDate><?php echo date(DATE_RFC822);?></pubDate>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="<?php echo SITE_URL;?>/rss/" type="application/rss+xml" />
<?php
if ($resultRSS){
foreach ( $resultRSS as $row ){
$idPost=$row['idPost'];
$postType=$row['type'];
$postTypeName=getTypeName($postType);
$postTitle=html_entity_decode($row['title'],ENT_COMPAT,CHARSET);
$postPrice=$row['price'];
/*$postPlace=$row['place'];*/
$postPhone=$row['phone'];
$postPlace= str_replace (" "," ",strip_tags(html_entity_decode($row['place'],ENT_COMPAT,CHARSET)));
if (LOCATION) $postLocation = getLocationName($row['idLocation']);
else $postLocation='';
$postDesc= $row['description'];
/*$postDesc= str_replace (" "," ",strip_tags(html_entity_decode($row['description'],ENT_COMPAT,CHARSET)));*/
$category=$row['category'];//real category name
$fcategory=$row['friendlyName'];//frienfly name category
$idCategoryParent=$row['idCategoryParent'];
$fCategoryParent=$row['parent'];
$insertDate=date(DATE_RFC822,strtotime($row['insertDate']));
if ($row["hasImages"]==1){
$postImage=getPostImages($idPost,setdate($row['insertDate']),true,true);
$expire_date = date('Y-m-d', strtotime("+30 days"));
$postImage= str_replace ("thumb_","",$postImage);
}
else $postImage="";//there's no image
$categoryUrl=$fcategory;
$postUrl=itemURL($idPost,$fcategory,$postTypeName,$postTitle,$fCategoryParent,$postPrice);
?>
<?php if ($postPrice > 0){?>
<item>
<title><![CDATA[<?php echo $postTitle;?><?php if ($postLocation!='' && LOCATION) echo ' - '.$postLocation;?>]]></title>
<link><?php echo SITE_URL.$postUrl;?></link>
<description><![CDATA[
<?php echo $postDesc;?>
<br /><br />
<hr> ]]>
</description>
<g:image_link><?php if ($postImage!="" && RSS_IMAGES) echo "$postImage"; else echo "".SITE_URL."/images/no_pic.png"; ?></g:image_link>
<g:google_product_category>Maison et jardin</g:google_product_category>
<g:condition>occasion</g:condition>
<g:shipping>
<g:country>FR</g:country>
<g:service>Standard</g:service>
<g:price>0</g:price>
</g:shipping>
<g:brand><?php echo $html_title;?></g:brand>
<g:mpn><?php echo $fcategory;?>-<?php echo $idPost;?></g:mpn>
<g:id><?php echo $idPost;?></g:id>
<g:availability>en stock</g:availability>
<g:price><?php if ($postPrice!=0) echo getPrice($postPrice);?>
<?php /*
$pourcent = 20;
$number = ($row['price'] *= (1 + $pourcent / 100));
$prix = number_format((float)$number, 2, '.', '');
echo $prix;
*/ ?>
</g:price>
<g:phone><?php echo $postPhone;?></g:phone>
<g:product_type>Maison et jardin</g:product_type>
</item>
<?php }?>
<?php
}
}
$ocdb->closeDB();
?>
</channel>
</rss>
<?php
}//if else
?>
Si vous avez besoin de autres pages n'hésitez pas.Merci d'avance.