Also, the order of the (optional) offset and limit for chunk calls has been switched. Should be: {{ITEM(limit,offset)->chunkName}} rather than {{ITEM(offset,limit)->chunkName}}
Thanks for testing. You’re right, PHx is interpreting the colon as a modifier. The best solution at this point would be to simply replace colons with another character; how about a dash/minus or perhaps the pipe symbol?
I’d be glad to add a function for returning the cached/parsed data structure. You should also be able to access it like:
Edit...
$feedx = new FeedX($config);
$feedx->getData();
$mydata = $feedx->elements;
The cacheType must be set to 0 for this to work correctly; let me know what method for retrieving the data works best for you.
Also, what do you think about the current method of passing a configuration array to the class, would it be any easier for you if I also wrote a function for setting the configuration parameters?
<?php $config="url=`http://feeds.feedburner.com/ListenToEnglish-LearnEnglish?format=xml`&cacheType=`0`&maxElements=`ITEM(3)`"; $feedx = new FeedX($config); $feedx->getData(); $myData = $feedx->items[3]; print_r($myData); ?>
<?php $url="http://feeds.feedburner.com/ListenToEnglish-LearnEnglish?format=xml"; $feedx = new FeedX($url); $feedx->getData(); $myData = $feedx->rss; print_r($myData); ?>
What exactly are you trying to accomplish where you need to call an instance of FeedX within your snippet?
$feedx->config['url'] = 'feeds.feedburner.com/ListenToEnglish-LearnEnglish?format=xml'; $filename="assets/snippets/FeedX/classes/feedx.class.inc.php"; include($filename); $filename1="assets/snippets/FeedX/classes/debug.class.inc.php"; include($filename1); $config[url]='http://feeds.feedburner.com/ListenToEnglish-LearnEnglish?format=xml'; $config[cacheType] ='0'; $config[debug] ='1'; $config[cacheTime] ='9000'; $config[cachePath] ='assets/snippets/FeedX/'; $feedx = new FeedX($config); $feedx->getData(); $myData1 = $feedx->elements[0][children][0][children][33][children][0][value]; //date published $myData2 = $feedx->elements[0][children][0][children][33][children][1][value]; //title $myData3 = $feedx->elements[0][children][0][children][33][children][10][value]; //ITUNES:SUBTITLE $myData4 = $feedx->elements[0][children][0][children][33][children][12][value]; //DESCRIPTION
{{ITEM->item}}{{ITEM(4,0)->item}}{{ITEM(1,0)->item1}}
{{ITEM(1,1)->item2}}
{{ITEM(1,2)->item3}}
etc. Preset for Google Calendar
--------------------------
For date parsing via PHx, create a new snippet named: phx:google
And enter the following PHP code:
<?php
if (strpos($output, 'T')) {
$mystring = str_replace('T', ' ', $output);
$mystring = substr($mystring, 0,16);
$dt = strftime($options,strtotime($mystring));
if ($modx->config['modx_charset'] == 'UTF-8')
$dt = utf8_encode($dt);
return $dt;
}
else {
$dt = strftime($options,strtotime($output));
$dt = trim(substr($dt,0,strpos($dt, '@')));
return $dt;
}
?>
Then change:
<p><b>Starts:</b> [+GD|WHEN.STARTTIME+] <br />
<b>Ends:</b> [+GD|WHEN.ENDTIME+]</p>
To:
<p><b>Starts:</b> [+GD|WHEN.STARTTIME:google=`%B %d, %G @ %T`+] <br />
<b>Ends:</b> [+GD|WHEN.ENDTIME:google=`%B %d, %G @ %T`+]</p>$item1[description] = $feedx->elements[Item1][description];
$myData1 = $feedx->elements[0][children][0][children][33][children][0][value]; //description