Post by kimelin » Fri Nov 19, 2010 7:21 pm

<?php

define('APP','CATALOG');

// Configuration
require('config.php');

// Install
if (!defined('DIR_LIBRARY')) { header('Location: install/index.php'); exit; }

// Initialisation
require('init.php');

// Locator
require(DIR_LIBRARY . 'locator.php');
$locator =& new Locator();

// Config
$config =& $locator->get('config');

// Database
$database =& $locator->get('database');

// Settings
$sql="select * from setting where type = 'catalog' or type = 'global'";
$settings = $database->getRows($sql);

foreach ($settings as $setting) {
$config->set($setting['key'], $setting['value']);
}

// Image
$image =& $locator->get('image');

// URL
$url =& $locator->get('url');

// Language
$language =& $locator->get('language');

// Base URL
$catalog_url = $request->isSecure()?HTTPS_SERVER:HTTP_SERVER;
$image_url = $request->isSecure()?HTTPS_IMAGE:HTTP_IMAGE;

// Product Data
$product_data = array();
$sql="select *, p.date_added as date_product_added from product p left join product_description pd on (p.product_id = pd.product_id) left join image i on (p.image_id = i.image_id) where p.status = '1' and pd.language_id = '%s' and p.date_available < now() and p.status = '1' order by date_product_added desc limit 20";
$sql=sprintf($sql,(int)$language->getId());
$results = $database->getRows($sql);

$products=array();
foreach ($results as $result) {
$products[]=array(
'name' => htmlentities(strip_tags($result['name'])),
'url' => htmlentities($url->href('product', FALSE, array('product_id' => $result['product_id']))),
'add_date' => date("D, d M Y H:i:s T", strtotime($result['date_product_added'])),
'desc' => htmlentities(strip_tags($result['description'],'ENT_QUOTES')) .
htmlentities('<br><img width="100" height="100" src="' .
$image->resize($result['filename'], 100, 100) . '">')
);
}

header('Content-type: text/xml');
?>
<rss version="2.0">
<channel>
<title><?php echo $config->get('config_store'); ?></title>
<description><?php echo $config->get('config_store'); ?></description>
<link><?php echo $catalog_url; ?></link>
<copyright><?php echo $config->get('config_store'); ?></copyright>
<?php foreach ($products as $product) { ?>
<item>
<title><?php echo $product['name']; ?></title>
<description><?php echo $product['desc']; ?></description>
<link><?php echo $product['url']; ?></link>
<pubDate><?php echo $product['add_date']; ?></pubDate>
<guid isPermaLink="true"><?php echo $product['url']; ?></guid>
</item>
<?php } ?>
</channel>
</rss>

谁能看看错在哪?

http://www.watchesabc.com


Newbie

Posts

Joined
Fri Nov 19, 2010 7:13 pm


Post by joanorsky » Fri Jan 07, 2011 12:00 am

What's this? Can you please go further on this code? I'm interested...

Newbie

Posts

Joined
Thu Jan 06, 2011 11:50 am

Post by joanorsky » Fri Jan 07, 2011 12:06 am

似乎缺少某些部件!你找到一个解决方案的RSS喂了吗?

Newbie

Posts

Joined
Thu Jan 06, 2011 11:50 am
Who is online

Users browsing this forum: No registered users and 3 guests