get_pageinfo(); # Get Data $sql = "SELECT {$table_prefix}wpClassified_lists.lists_id,{$table_prefix}wpClassified_lists.name, {$table_prefix}wpClassified_ads.subject, {$table_prefix}wpClassified_ads.status, {$table_prefix}wpClassified_ads.image_file, {$table_prefix}wpClassified_ads.post,{$table_prefix}wpClassified_ads_subjects.ads_subjects_id, {$table_prefix}wpClassified_ads.date, {$table_prefix}wpClassified_ads.ads_id, {$table_prefix}wpClassified_ads.ads_ads_subjects_id, {$table_prefix}wpClassified_ads.post FROM {$table_prefix}wpClassified_lists, {$table_prefix}wpClassified_ads_subjects, {$table_prefix}wpClassified_ads WHERE {$table_prefix}wpClassified_lists.lists_id = {$table_prefix}wpClassified_ads_subjects.ads_subjects_list_id AND {$table_prefix}wpClassified_ads_subjects.ads_subjects_id = {$table_prefix}wpClassified_ads.ads_ads_subjects_id AND {$table_prefix}wpClassified_ads.status='active' ORDER BY {$table_prefix}wpClassified_lists.name, {$table_prefix}wpClassified_ads.date DESC LIMIT 0, ".$limit; $posts = $wpdb->get_results($sql); # Define Channel Elements $rssTitle=get_bloginfo('name').' - '.__("Classified"); $rssLink = get_bloginfo('wpurl'). "/?page_id=". $pageinfo["ID"]. "∓_action=wpcfeed"; $atomLink= $rssLink; $rssDescription=get_bloginfo('description'); $rssGenerator=__('wp-classified Version ') . '1.4'; $rssItem=array(); if($posts) { foreach($posts as $post){ # Define Item Elements $item = new stdClass; $item->title=htmlspecialchars(trim($post->subject)); $item->pubDate=@date($wpcSettings['date_format'], $post->date); $item->category=htmlspecialchars(trim($post->name)); $item->post=htmlspecialchars(trim($post->post)); preg_replace(array('/\s/'), '', $post->image_file); if ( !empty($post->image_file) ) { $array = preg_split('/\#\#\#/', $post->image_file); $item->photo = $array[0]; } $item->guid=wpcRssLink(array("name"=>$post->subject, "lid"=>$post->lists_id, "asid"=>$post->ads_subjects_id)); $rssItem[]=$item; } } $contents = '\n"; $contents .= '\n"; $contents .= "\n$rssTitle\n"; $contents .= "" . WPC_PLUGIN_DIR . "/cache/wpclassified.xml\n"; $contents .= "$rssDescription\n"; $contents .= "$rssGenerator\n"; $contents .= "" . get_option('rss_language') . "\n"; $contents .= "" . date("r") . "\n"; $filename = WPC_PLUGIN_DIR . '/cache/wpclassified.xml'; $fp = fopen($filename, 'w') or die("can't open file"); fwrite($fp, $contents); do_action('rss2_head'); foreach($rssItem as $item): ob_start(); start_wp();?> <?php echo $item->title ?> guid ?> category ?> guid ?> post ?> photo)) { ?> public_url ."/" . $item->photo; ?> pubDate ?>