I want to write a blog. Later, because there is no time, some code I feel that I don't feel very well, so I gave up the road; I saw 9CBS out of blog, huh, huh. This is fine, don't have it. .
Now give a PHP code that you can think of writing, this code refers to the RSS 2.0 norm of bamboo shoots. Because of its limited level, it is not very understandable to XML. I hope that the broad masses of the people will criticize and correct, thank you.
php / ************************************************* RSS2.0 Generator * CREATE BY MAGICBOY (DARASION) * COPYRIGHT? Magic boy ************************************************ **** /
/ * ----------------
How to use: Use the following array to bring the corresponding function.
1. Channel main $ channel = array (Title => 'channel name (must)', link => 'channel URL (essential)', Description => 'channel description (essential)', language => The language (optional) ', WebMaster =>' is responsible for the website administrator Email (optional) ', managingEditor =>' responsible for channel technical transaction, is the Email (optional) ' Release date, Follow the RFC822 format (2 or 4 digits) (optional) ', lastbuilddate =>' channel content final modification date (SAT, 07 Sep 2002 09:42:31 GMT) (optional) ', Skipdays =>' prompt news aggregat, those days it can skip. (Optional) ', copyright =>' channel content copyright instructions (optional) ', TTL =>' validity period, to indicate the channel The maximum time (optional) ',) can be cached.
2, channel picture $ image = array (URL => 'picture Link (essential)', title => 'image title, URL of an Alt property (essential)', link => 'website for HTTP ( In practice, it is often replaced by channel URL) (essential) ', width =>' picture of the width (pixel) of the pixels of 144, the default 88 (optional) ', Height =>' picture height (pixel) ) Maximum 400, default 31 (optional) ', description =>' Used for LINK Title attributes (optional) ');
3, channel item $ item = array (item) ', description =>' URL (essential) 'URL (essential)', LINK => 'item Comments => 'This review page URL (optional)', GUID => '1 unique marker string (optional)', author => 'The author's email (optional ) ', Enclosure =>' Describes the included media object (optional) ', category =>' contains one or several categories (optional) ', Pubdate =>' items ( Optional) ', Source_URL =>' This item comes from the RSS Road (optional) ', Source_Name =>' This item comes from the RSS Road (optional) '); ------------ ---- * / Class RSS2 {var $ channel_pre = ""; var $ str_image = ""; var $ str_item = "; var $ channel_end ="; / * constructor * / function RSS2 ($ CHANNEL, $ CHANNEL, $ Encoding = "GB2312") {$ this-> Channel ($ CHANNEL, $ Encoding);} / * Generate Channel Body * / Function Channel ($ Channel, $ Encoding = "GB2312") {$ this-> channel_pre. = " XML Version = / "1.0 /" Encoding = / "$ encoding /"?> / n "; $ this-> channel_pre. =" / n ";