source: Dev/trunk/rdfapi/util/magpie/scripts/simple_smarty.php @ 12

Last change on this file since 12 was 12, checked in by basvannuland, 14 years ago

Added RAP RDF API
Added RDF reader writer for save and load survey

File size: 1.6 KB
Line 
1<?php
2
3// Define path to Smarty files (don't forget trailing slash)
4// and load library.  (you'll want to change this value)
5//
6// NOTE:  you can also simply add Smarty to your include path
7define('SMARTY_DIR', '/home/kellan/projs/magpierss/scripts/Smarty/');
8require_once(SMARTY_DIR.'Smarty.class.php');
9
10// define path to Magpie files and load library
11// (you'll want to change this value)
12//
13// NOTE: you can also simple add MagpieRSS to your include path
14define('MAGPIE_DIR', '/home/kellan/projs/magpierss/');
15require_once(MAGPIE_DIR.'rss_fetch.inc');
16require_once(MAGPIE_DIR.'rss_utils.inc');
17
18
19// optionally show lots of debugging info
20# define('MAGPIE_DEBUG', 2);
21
22// optionally flush cache quickly for debugging purposes,
23// don't do this on a live site
24# define('MAGPIE_CACHE_AGE', 10);
25
26// use cache?  default is yes.  see rss_fetch for other Magpie options
27# define('MAGPIE_CACHE_ON', 1)
28
29// setup template object
30$smarty = new Smarty;
31$smarty->compile_check = true;
32
33// url of an rss file
34$url = $_GET['rss_url'];
35
36
37if ( $url ) {
38        // assign a variable to smarty for use in the template
39        $smarty->assign('rss_url', $url);
40       
41        // use MagpieRSS to fetch remote RSS file, and parse it
42        $rss = fetch_rss( $url );
43       
44        // if fetch_rss returned false, we encountered an error
45        if ( !$rss ) {
46                $smarty->assign( 'error', magpie_error() );
47        }
48        $smarty->assign('rss', $rss );
49       
50        $item = $rss->items[0];
51        $date = parse_w3cdtf( $item['dc']['date'] );
52        $smarty->assign( 'date', $date );
53}
54
55// parse smarty template, and display using the variables we assigned
56$smarty->display('simple.smarty');
57
58?>
Note: See TracBrowser for help on using the repository browser.