sullyman Posted December 27, 2008 Share Posted December 27, 2008 Hi Folks, I have created an RSS feed and the following calls a data value successfully from mysql $veh["year"]="int_1"; $veh["make"]="vmake"; $veh["model"]="vmodel"; For the title, i would like to call three different fields to make one title. Is this possbile? e.g. $veh["title"]="int_1+vmake+vmodel"; Thanks, S Quote Link to comment https://forums.phpfreaks.com/topic/138580-rss-php-help/ Share on other sites More sharing options...
MadTechie Posted December 27, 2008 Share Posted December 27, 2008 you mean like this $title=$veh["int_1"].$veh["vmake"].$veh["vmodel"]; you may wanna post a little code so i can give a better example Quote Link to comment https://forums.phpfreaks.com/topic/138580-rss-php-help/#findComment-724598 Share on other sites More sharing options...
sullyman Posted December 27, 2008 Author Share Posted December 27, 2008 Thanks, i tried your way but couldn't get it to work. The first part of the code must stay like this $veh["title"]= I think i just need the correct way then to add the three fields together $veh["title"]="int_1+vmake+vmodel"; Quote Link to comment https://forums.phpfreaks.com/topic/138580-rss-php-help/#findComment-724603 Share on other sites More sharing options...
sullyman Posted December 27, 2008 Author Share Posted December 27, 2008 Any help appreciated folks Quote Link to comment https://forums.phpfreaks.com/topic/138580-rss-php-help/#findComment-724633 Share on other sites More sharing options...
MadTechie Posted December 27, 2008 Share Posted December 27, 2008 Well where are the fields coming from ? $veh["title"]=$int_1.$vmake.$vmodel; if you don't give any useful infomation its kinda hard to help! you may wanna post a little code so i can give a better example Quote Link to comment https://forums.phpfreaks.com/topic/138580-rss-php-help/#findComment-724643 Share on other sites More sharing options...
Philip Posted December 27, 2008 Share Posted December 27, 2008 <?php $veh["title"] = $veh["int_1"].$veh["vmake"].$veh["vmodel"]; ?> Quote Link to comment https://forums.phpfreaks.com/topic/138580-rss-php-help/#findComment-724646 Share on other sites More sharing options...
sullyman Posted December 28, 2008 Author Share Posted December 28, 2008 Sorry guys. Here is the code below. I need it to extract listings to place on Oodle.com I can't get the following line to work to add Year+Make+Model together for the Title. Everything else works great. $vehicles_oodle["title1"]=$veh["int_1"].$veh["v_255_9"].$veh["v_255_10"]; <?php //settings section $vehicles_oodle=array(); $vehicles_oodle["id"]="link_id"; $vehicles_oodle["url"]="http://www.mysite.com/index.php?page=out&id=#link_id"; $vehicles_oodle["title"]="v_title"; $vehicles_oodle["title1"]=$veh["int_1"].$veh["v_255_9"].$veh["v_255_10"]; $vehicles_oodle["year"]="int_1"; $vehicles_oodle["make"]="v_255_9"; $vehicles_oodle["model"]="v_255_10"; $vehicles_oodle["body_type"]="v_255_1"; $vehicles_oodle["color"]="v_255_15"; $vehicles_oodle["fuel_type"]="v_255_4"; $vehicles_oodle["mileage"]="int_2"; $vehicles_oodle["price"]="v_price"; $vehicles_oodle["description"]="v_descr"; $vehicles_oodle["expire_time"]="exp_date"; $vehicles_oodle["city"]="v_255_14"; $vehicles_oodle["image_url"]="images"; $feed_oodle=array(); $feed_oodle["filename"]="oodle.xml"; $feed_oodle["vehicles"]=$vehicles_oodle; $feed_oodle["vehicles_id"]=960; $feed_oodle["vehicles_category"]="Vehicles"; $feed_oodle["vehicles_category_tag"]="category"; $feeds=array(); $feeds[]=$feed_oodle; //settings section*** //function section function dbConnect($host, $user, $password, $name) { $connection = mysql_connect($host, $user, $password); mysql_select_db($name, $connection); } function saveXmlTag($fp,$tag,$category,$category_tag,$fields,$values) { $data="<$tag>\r\n"; $category=str_replace("&","&",$category); $category=str_replace("<","<",$category); $category=str_replace(">",">",$category); $data.=" <$category_tag>$category</$category_tag>\r\n"; foreach ($fields as $current_field=>$current_value) { if (strpos($current_value,"#link_id")) { $value=str_replace("#link_id",$values["link_id"],$current_value); } else { if ($current_value=="images") { $value=$values[$current_value]; if ($value!="") { if (strpos($value,"\n")) { $value=substr($value,0,strpos($value,"\n")); } $value="http://www.mysite.com/files/".$value; } } else { $value=$values[$current_value]; } } $value=utf8_encode(htmlspecialchars($value)); $data.=" <$current_field>".$value."</$current_field>\r\n"; } $data.=" <country>US</country>\r\n"; $data.="</$tag>\r\n"; fputs($fp,$data); unset($data); } function saveCategory($feed_fields,$feed_id,$feed_category,$category_tag,$fp) { $sql = "select * from table_ad where catid=$feed_id order by link_id"; $result = mysql_query($sql); while ($record = mysql_fetch_assoc($result)) { saveXmlTag($fp,"listing",$feed_category,$category_tag,$feed_fields,$record); } mysql_free_result($result); } //function section*** //main section dbConnect($dbSettings["host"], $dbSettings["user"], $dbSettings["password"], $dbSettings["name"]); foreach ($feeds as $feed_item) { $filename=$feed_item["filename"]; $fp = fopen($xmlDir.$filename,'w'); $data='<?xml version="1.0" encoding="ISO-8859-1"?>'."\r\n"; $data.='<listings>'."\r\n"; fputs($fp,$data); unset($data); //vehicles saveCategory($feed_item["vehicles"],$feed_item["vehicles_id"],$feed_item["vehicles_category"],$feed_item["vehicles_category_tag"],$fp); $data='</listings>'."\r\n"; fputs($fp,$data); unset($data); fclose($fp); } //main section*** ?> Quote Link to comment https://forums.phpfreaks.com/topic/138580-rss-php-help/#findComment-724825 Share on other sites More sharing options...
MadTechie Posted December 28, 2008 Share Posted December 28, 2008 Not sure what to say.. Okay your need to read the values in before you can use them.. if you just want int_1 v_255_9v_255_10 then set that ie $vehicles_oodle["title1"]="int_1 v_255_9v_255_10"; if your reading them in then concat them after reading them in ie $vehicles_oodle["title1"]=$veh["int_1"].$veh["v_255_9"].$veh["v_255_10"]; who wrote the code ? Quote Link to comment https://forums.phpfreaks.com/topic/138580-rss-php-help/#findComment-724871 Share on other sites More sharing options...
Philip Posted December 28, 2008 Share Posted December 28, 2008 If you want it in the format "Year+Make+Model" $vehicles_oodle["title1"]=$veh["int_1"]."+".$veh["v_255_9"]."+".$veh["v_255_10"]; Quote Link to comment https://forums.phpfreaks.com/topic/138580-rss-php-help/#findComment-725014 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.