What I have so far, preg_match isn’t working though.
All it’s doing is saying “If the file starts like this, then
the title must be this.”, I thought I could do it with
arrays but couldn’t get that working either….
[code=php]
<?php
echo “<pre>r”;
echo “t<?xml version=”1.0″ encoding=”utf-8″ standalone=”yes”?>r”;
echo “t<rss version=”2.0″ xmlns:media=”http://search.yahoo.com/mrss/”r”;
echo “txmlns:atom=”http://www.w3.org/2005/Atom”>r”;
echo “t<channel>r”;
$t = “ttt”;
$base = “http://omnisistem.com/images/media/tradeshows/”;
$dir = opendir (“../images/media/tradeshows/explode/”);
while (false !== ($file = readdir($dir))) {
if (strpos($file, ‘.gif’,1)||strpos($file, ‘.jpg’,1) ) {
$item = “rtt<item>”;
$item .= “r$t<title>”;
# NAMM Tripcodes
if(preg_match(‘/^n09/’, $file, $card, PREG_OFFSET_CAPTURE, 3)) { $item .= ‘NAMM 2009’; }
if(preg_match(‘/^n08/’, $file, $card, PREG_OFFSET_CAPTURE, 3)) { $item .= ‘NAMM 2008’; }
if(preg_match(‘/^n02/’, $file, $card, PREG_OFFSET_CAPTURE, 3)) { $item .= ‘NAMM 2002’; }
# LDI Tripcodes
if(preg_match(‘/^l08/’, $file, $card, PREG_OFFSET_CAPTURE, 3)) { $item .= ‘LDI 2008’; }
if(preg_match(‘/^l07/’, $file, $card, PREG_OFFSET_CAPTURE, 3)) { $item .= ‘LDI 2007’; }
if(preg_match(‘/^l06/’, $file, $card, PREG_OFFSET_CAPTURE, 3)) { $item .= ‘LDI 2006’; }
if(preg_match(‘/^l05/’, $file, $card, PREG_OFFSET_CAPTURE, 3)) { $item .= ‘LDI 2005’; }
if(preg_match(‘/^l01/’, $file, $card, PREG_OFFSET_CAPTURE, 3)) { $item .= ‘LDI 2001’; }
$item .= “</title>r”;
$item .= “$t<link>explode/$file</link>r”;
$item .= “$t<media:thumbnail url=”$base/thumb/$file”/>r”;
$item .= “$t<media:content url=”$base/explode/$file”/>r”;
$item .= “tt</item>r”;
echo $item;
}
}
echo “rt</channel>rt</rss>”;
echo “r</pre>”;?>