MODxでCMSの恩恵を賜りつつ、validを保ち、かつWEB標準化を目指そう
[ スニペット ]
pieX is snippets which take in RSS news in your site.
You can use original template(chunk). This snippets runs on "allow_url_fopne = off". (Of course, also on "allow_url_fopne = on"). Also this snippets works using Simplepie.
Reference : puti power / w.ZeRo (in Japanese)
Download : pieX Ver0.6.1
[!pieX? &url=`feedURL`!]
You rewrite each as follows.
[!pieX? &url=`http://yoursite.com/index.php?act=rss&id=1`!][!pieX? &url=`http://yoursite.com/index.php|xq|act|xe|rss|xa|id|xe|1`!]pieX needs "simplepie.inc" of Simplepie addition to pieX.
You can get "simplepie.inc" from simplepie:Download
piex-v061 └ [simplepie] └ class.html2text.inc └ simplepie_hatena.inc └ piex.snippet.php(snippet code)
[assets]
└ [snippets]
└ [simplepie]
└ class.html2text.inc
└ simplepie.inc
└ simplepie_hatena.inc
Create snippets in the manager.
&cache_enable=cache enable;text;true &cache_time=cache life time;text;60
&extclass=extend item class;text; &noitem=no item template chunk name;text; &dateformat=date
format;text;%Y/%m/%d %H:%M &max=max items;text;30 &rows=pattern rows;text;0 &embed=embed property Chunk Name;text;Property has the following meaning. The inside of a parenthesis is a parameter name in case it is called by snippets.
Determine whether to use cache. [true | false]. Default is "true".
Determine the time to save in cache. A unit is "second". Default is 60 second.
If you want to use "extend item class of Simplepie", set the class name. Default is blank.
Set the template(chunk), when pieX can not get data or there is no data.
Default is the following.
<p>no item</p>
<p>There is no items. Or can not get items in order to be some trouble. </p>
[+feed_url+]
Set the format of date. Format follows strftime function of PHP. Default is "%Y/%m/%d %H:%M".
Determine the maximum number of item which want to display. Default is "10".
Determine the maximum number of "[+no+]".
Thereby, a value of "[+no+]" is repeated between 1-maximum until number of item.
For example, if it assumes that 2 was set to it, the value of "[+no+]" will
repeat 1 and 2.
When 0 is specified, [+no+] will show sequential number until number of item. Default "0".
Set a chunk name which wrote the parameter of embed. Defalt is blank.
It is the required parameter which you can call in snippets.
Set URI of RSS feed.
It is the option parameter which you can call in snippets.
Set the chunk for header template. Default is the following.
<h2><a href="[+permalink+]"
title="[+title+]">[+image_url+]</a></h2><ul>
Set the chunk for footer template. Default is the following.
</ul>
Set the chunk for row template. Default is the following.
<li><a href="[+permalink+]"
title="[+description+]">[+title+]</a>([+date+])[+category+]</li>
You can set property of snippets as parameter. The following.
Please refer to "About property" about meaning of each parameter.
You can set the following as type .
Set to "length" which you display. In case 0 or blank, It will be displayed all.
[+description(text,300)+]It inserts for URL of each service.
<a href="[+subscribe_google+]" title="Subscribe google">Subscribe google</a>Please look at "simplepie API document" about other subscribe function.
You can use get method of Simplepie. For more information, refer to "Simplepie:Extending the SimplePie class".
It inserts for URL of each Bookmarklet.
<a href="[+add_to_delciou+]" title="Register del.ci.ou">Register del.ci.ou</a>For more information, refer to "simplepie:API document".
Determine the format of display of [+enclosure+]. The format of display depends on Simplepie.
Create the chunk for. Value of chunk name turns into the value specified by "embed property Chunk Name" or "embed".
Write option of "embed" into chunk code.
alt=Download this enclosure!
audio=assets/image/place_audio.png
video=assets/image/place_video.png
mediaplayer=assets/flash/mediaplayer.swf
widescreen=true
For more information, refer to "simplepie:native_embed".
You can create the original extending the Simplepie class by yourself.
simplepie_classname.inc[!pieX? &url=`feed url` &extclass=`classname`!]You can change the cache. Change the following in the snippets code.
define("SIMPLEPIE_CACHE_LOCATION",$modx->config['base_path'] . "assets/cache/");