﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-随心芸芸 @ JPeanut（旧版）-随笔分类-小陈翻译</title><link>http://www.blogjava.net/JPeanut/category/20995.html</link><description>搬迁至 http://www.17m.net.cn/</description><language>zh-cn</language><lastBuildDate>Tue, 27 Mar 2007 13:42:31 GMT</lastBuildDate><pubDate>Tue, 27 Mar 2007 13:42:31 GMT</pubDate><ttl>60</ttl><item><title>Drupal5.x创建自定义模块指南－02把你的模块告知Drupal系统(Creating modules - a tutorial: Drupal 5.x －－02. Telling Drupal about your module)</title><link>http://www.blogjava.net/JPeanut/archive/2007/03/27/106584.html</link><dc:creator>陈市明</dc:creator><author>陈市明</author><pubDate>Tue, 27 Mar 2007 01:32:00 GMT</pubDate><guid>http://www.blogjava.net/JPeanut/archive/2007/03/27/106584.html</guid><wfw:comment>http://www.blogjava.net/JPeanut/comments/106584.html</wfw:comment><comments>http://www.blogjava.net/JPeanut/archive/2007/03/27/106584.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JPeanut/comments/commentRss/106584.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JPeanut/services/trackbacks/106584.html</trackback:ping><description><![CDATA[		 <span style="font-weight: bold;"><font size="2">[翻译:陈市明 摘自:http://drupal.org/node/82926]</font></span><br />   在5.x中，你模块的基本信息不再是通过函数hook_help提供给Drupal，而是在info文件定义name和description即可（具体格式参见info文件指南）。在我们的例子中，该文件为onthisdate.info<br /> 通常格式如下：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">; $Id$<br />name </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Module Name<br />description </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">A description of what your module does.</span><span style="color: rgb(0, 0, 0);">"</span></div><br />如果没有这个文件，则drupal不能在模块安装的时候找到该模块。<br />在我们的例子中，onthisdate.info应该包含如下数据：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">; $Id$<br />name </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> On </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> date<br />description </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">A block module that lists links to content such as blog entries or forum discussions that were created one week ago.</span><span style="color: rgb(0, 0, 0);">"</span></div>将把这些代码写到onthisdate.info文件中，保存到sites/all/modules/onthisdate目录<br />下面3句是在info文件中是可选的<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">dependencies </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> module1 module2 module3<br /></span><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Your arbitrary grouping string</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br />version </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">$Name$</span><span style="color: rgb(0, 0, 0);">"</span></div>在我们的例子中，将不使用这些代码。如果你的模块依赖其他模块，则Drupal在你的依赖模块没有被激活的情况下是不允许激活的。<br />Package：在模块列表页面中的显示分组，如果该值为空则默认为“Uncategorized”。<br />Version：通过cvs直接得到的模块的版本号<br />该文件使用的是ini格式，所以该文件可以包含;表示注释；<br />; $Id$则让cvs自动把该文件的ID信息自动替换掉<br />关于ini的格式，具体参见PHP.net parse_ini_file documentation<br /><br />除了info文件，我们还可以通过实现help钩子来添加额外的帮助信息。不管怎么样，最好还是实现help钩子。onthisdate模块的help钩子叫做onthisdate_help：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php<br />function onthisdate_help($section</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">) {<br />}</span><span style="color: rgb(0, 0, 0);">?&gt;</span></div>$section变量：是该页面的结点路径。官方推荐，最好在模块中通过swtich case语句来判断是否是该模块的结点路径。你可以参照如下代码：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php<br /></span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />* 显示帮助和模块信息<br />* </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> 当前帮助结点的路径#模块名<br />* </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"> 显示的帮助信息<br /></span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />function onthisdate_help($section</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">) {<br />  $output </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">;<br />  </span><span style="color: rgb(0, 0, 255);">switch</span><span style="color: rgb(0, 0, 0);"> ($section) {<br />    </span><span style="color: rgb(0, 0, 255);">case</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">admin/help#onthisdate</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:<br />      $output </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;p&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">.  t(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Displays links to nodes created on this date</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">). </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;/p&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br />      </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br />  }<br />  </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> $output;<br />} </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> function onthisdate_help</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">?&gt;</span></div>把这些代码写到onthisdate.module文件中，保存到目录sites/all/modules/onthisdate<br /><br /><br /><br />原文：<br /><br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">In Drupal </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">.x the basic information about your module, its name and description, is no longer provided by hook_help. Instead, all modules now need to have a modulename.info file, containing meta information about the module (</span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> details see Writing .info files (Drupal </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">.x)). For our example, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">onthisdate.info'.</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br />The general format is:<br /><br />; $Id$<br />name </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Module Name<br />description </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">A description of what your module does.</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /><br />Without </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> file, your module will not show up in the module listing</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">.<br /><br /></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> our example, it could contain the following:<br /><br />; $Id$<br />name </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> On </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> date<br />description </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">A block module that lists links to content such as blog entries or forum discussions that were created one week ago.</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /><br />Add the source above to a file named to onthisdate.info before saving in your module</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">s directory at sites/all/modules/onthisdate.</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br />There are also three optional lines that may appear in the .info file:<br />dependencies </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> module1 module2 module3<br /></span><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Your arbitrary grouping string</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br />version </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">$Name$</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /><br />For our example module, these don</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">t apply and we will simply omit them. If you assign dependencies for your module, Drupal will not allow it to be activated until the required dependencies are met.</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br />If you assign a </span><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> string </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> your module, on the admin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">build</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">modules page it will be listed with other modules with the same category. If you </span><span style="color: rgb(0, 0, 255);">do</span><span style="color: rgb(0, 0, 0);"> not assign one, it will simply be listed as </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">Uncategorized</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">. Not assigning a </span><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> your module is perfectly ok; in general packages are best used </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> modules that are distributed together or are meant to be used together. If you have any doubt, leave </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> field blank.<br /><br />Suggested examples of appropriate items </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> the </span><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> field:<br /><br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Audio<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Bot<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> CCK<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Chat<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> E</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">Commerce<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Event<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Feed Parser<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Organic groups<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Station<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Video<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Views<br />    </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> Voting (</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> it uses</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">requires VotingAPI) <br /><br />The version line will provide the version string </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> users getting their modules directly from CVS rather than using the tarball </span><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> that is created with a release.<br /><br />The files use the ini format and can include a ; $Id$ to have CVS insert the file ID information.<br /><br />For more information on ini file formatting, see the PHP.net parse_ini_file documentation.<br /><br />We can also provide help and additional information about our module. Because of the use of the .info file described above, </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> hook is now optional. However, it is a good idea to implement it. The hook name </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> function is </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">help</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, so start with the onthisdate_help function:<br /><br /></span><span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php<br />function onthisdate_help($section</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">) {<br /><br />}<br /></span><span style="color: rgb(0, 0, 0);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />The $section variable provides context </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> the help: where in Drupal or the module are we looking </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> help. The recommended way to process </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> variable is with a </span><span style="color: rgb(0, 0, 255);">switch</span><span style="color: rgb(0, 0, 0);"> statement. You</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">ll see this code pattern in other modules.</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php<br /></span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />* Display help and module information<br />* </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> section which section of the site we're displaying help<br />* </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"> help text for section<br /></span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />function onthisdate_help($section</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">) {<br /><br />  $output </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">;<br /><br />  </span><span style="color: rgb(0, 0, 255);">switch</span><span style="color: rgb(0, 0, 0);"> ($section) {<br />    </span><span style="color: rgb(0, 0, 255);">case</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">admin/help#onthisdate</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:<br />      $output </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;p&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">.  t(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Displays links to nodes created on this date</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">). </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;/p&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br />      </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br />  }<br /><br />  </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> $output;<br />} </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> function onthisdate_help</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />The admin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">help#modulename </span><span style="color: rgb(0, 0, 255);">case</span><span style="color: rgb(0, 0, 0);"> is used by the Drupal core to linked from the main help page (</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">admin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">help or </span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);">q</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">admin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">help). You will eventually want to add more text to provide a better help message to the user.<br /><br />More information about the help hook:<br />Drupal HEAD<br /><br />Add the source above to a file named to onthisdate.module before saving in your Drupal installation. </span></div><br /><img src ="http://www.blogjava.net/JPeanut/aggbug/106584.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JPeanut/" target="_blank">陈市明</a> 2007-03-27 09:32 <a href="http://www.blogjava.net/JPeanut/archive/2007/03/27/106584.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Drupal5.x创建自定义模块指南－01开始(Creating modules - a tutorial: Drupal 5.x －－01. Getting started)</title><link>http://www.blogjava.net/JPeanut/archive/2007/03/26/106555.html</link><dc:creator>陈市明</dc:creator><author>陈市明</author><pubDate>Mon, 26 Mar 2007 15:43:00 GMT</pubDate><guid>http://www.blogjava.net/JPeanut/archive/2007/03/26/106555.html</guid><wfw:comment>http://www.blogjava.net/JPeanut/comments/106555.html</wfw:comment><comments>http://www.blogjava.net/JPeanut/archive/2007/03/26/106555.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JPeanut/comments/commentRss/106555.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JPeanut/services/trackbacks/106555.html</trackback:ping><description><![CDATA[ <span style="font-weight: bold;"><font size="2">[翻译:陈市明 摘自:http://drupal.org/node/82926]</font></span><br />   To focus this tutorial, we'll start by creating a block module that lists links to content such as blog entries or forum discussions that were created one week ago.这份指南将教会我们如何在一个drupal的结点上创建block content,创建链接和回复信息。<br />   首先在drupal的安装路径下创建目录sites/all/modules/onthisdate（呵呵 当然先得创建目录sites/all/modules哈）。在目录sites/all/modules/ onthisdate下创建一个文件，命名为onthisdate.module。在drupal 5.x中，目录sites/all/modules放置的是一些非核心模块。这个使得你在升级核心模块的时候更加方便，无需担心你之前定制化。<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php<br /></span><span style="color: rgb(0, 128, 0);">/*</span><span style="color: rgb(0, 128, 0);"> $Id$ </span><span style="color: rgb(0, 128, 0);">*/</span></div><br />   在每个模块的php文件末尾可以省去?&gt;的标记，只要在开头加上&lt;?php即可。$Id$则是有助CVS的版本控制。在你模块中，所有需要被Drupal调用的函数都必须以“{模块名}_{钩子名}”命名，钩子名是drupal中一些预定义的方法的前缀。通过这样的命名方式，可以很容易的让Druapl调用到这些方法，从而得到你定制的数据。<br />   这个模块目前还没运行起来，因为它还没有被激活。在后面的章节中，我们可以看到如何激活该模块。<br /><br /><p class="MsoNormal" style="margin-left: 17.95pt; text-indent: 13.45pt;"><span style="font-family: 宋体;"></span><span style="" lang="EN-GB"><o:p></o:p></span></p><br /><br />原文<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">01</span><span style="color: rgb(0, 0, 0);">. Getting started<br />Drupal </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">.x<br /><br />To focus </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> tutorial, we</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">ll start by creating a block module that lists links to content such as blog entries or forum discussions that were created one week ago. The full tutorial will teach us how to create block content, write links, and retrieve information from Drupal nodes.</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br />Start your module by creating a folder in your Drupal installation at the path: sites</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">all</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">modules</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">onthisdate You may need to create the sites</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">all</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">modules directory first. Create a PHP file and save it as onthisdate.module in the directory sites</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">all</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">modules</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">onthisdate. As of Drupal </span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">.x, sites</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">all</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">modules is the preferred place </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> non</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">core modules (and sites</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">all</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">themes </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> non</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">core themes), since </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> places all site</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">specific files in the sites directory. This allows you to more easily update the core files and modules without erasing your customizations.<br /><br /></span><span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php<br /></span><span style="color: rgb(0, 128, 0);">/*</span><span style="color: rgb(0, 128, 0);"> $Id$ </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /><br />As per the Coding standards, omit the closing </span><span style="color: rgb(0, 0, 0);">?&gt;</span><span style="color: rgb(0, 0, 0);"> tag and use the longhand </span><span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php tag. The $Id$ string will help keep track of the revision number and date when you commit the file to CVS.<br /><br />All functions in your module that will be used by Drupal are named {modulename}_{hook}, where </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">hook</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> is a pre</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">defined function name suffix. Drupal will call these functions to get specific data, so having these well</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">defined names means Drupal knows where to look. We will come to hooks in a </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">.<br /><br />The module is not operational yet: it hasn</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">t been activated. We</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">ll activate the module later in the tutorial. </span></div><br /><img src ="http://www.blogjava.net/JPeanut/aggbug/106555.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JPeanut/" target="_blank">陈市明</a> 2007-03-26 23:43 <a href="http://www.blogjava.net/JPeanut/archive/2007/03/26/106555.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Drupal Object Reference--$node - Node object(Drupal 结点对象) for drupal 5.1</title><link>http://www.blogjava.net/JPeanut/archive/2007/03/25/106281.html</link><dc:creator>陈市明</dc:creator><author>陈市明</author><pubDate>Sun, 25 Mar 2007 14:34:00 GMT</pubDate><guid>http://www.blogjava.net/JPeanut/archive/2007/03/25/106281.html</guid><wfw:comment>http://www.blogjava.net/JPeanut/comments/106281.html</wfw:comment><comments>http://www.blogjava.net/JPeanut/archive/2007/03/25/106281.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JPeanut/comments/commentRss/106281.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JPeanut/services/trackbacks/106281.html</trackback:ping><description><![CDATA[
		<span style="font-weight: bold;">
				<font size="2">[翻译:陈市明 摘自:http://drupal.org/node/49768]<br /><br />Node对象:<br />[name] =&gt; 创建结点的用户名<br />[date] </font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">=&gt; 创建结点的时间<br />[status] </font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">=&gt; 是否发布{True:发布|False:未发布</font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">}(在action+workflow中可以做审核处理)</font>
		</span>
		<br />
		<span style="font-weight: bold;">
				<font size="2">[moderate]</font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">
				</font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">=&gt; 是否可修改{0:只读|1:修改}<br />[promote]</font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">
				</font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">=&gt; 是否发布首页{0:是|1:否}</font>
		</span>
		<br />
		<span style="font-weight: bold;">
				<font size="2">[sticky]</font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">
				</font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">=&gt; 是否置顶{0:否|1:是}<br />[revision]</font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">
				</font>
		</span>
		<span style="font-weight: bold;">
				<font size="2">=&gt; </font>
		</span>TRUE/FALSE  this is a new revision (if TRUE, will be saved as a separate entry in the database)<br /><span style="font-weight: bold;"><font size="2">[comment]</font></span><span style="font-weight: bold;"></span><span style="font-weight: bold;"><font size="2"></font></span><span style="font-weight: bold;"><font size="2">=&gt; 对该结点是否允许添加,阅读或者是对其设置权限<br />[simple_access]</font></span><span style="font-weight: bold;"></span><span style="font-weight: bold;"><font size="2"></font></span><span style="font-weight: bold;"><font size="2">=&gt; 对权限模块的一个<br />[title] =&gt; 显示结点页面的标题<br />[taxonomy] =&gt; 分类(数组,具体查看Taxonomy模块)<br />[body] =&gt; 结点的内容<br />[format] =&gt; 符合Filter模块的Content内容<br />[uid] =&gt; 创建结点的用户ID<br />[created] =&gt; 创建结点的Unix类型的时间戳<br />[type] =&gt; 结点类型(如:book,page,forum,具体查看cck模块)<br />[teaser] =&gt; 内容概要<br />[validated] =&gt; 该结点是否有效{0:否|1:是}(是否已经保存)<br />[changed] =&gt; </font></span><span style="font-weight: bold;"><font size="2">修改结点的Unix类型的时间戳</font></span><br /><span style="font-weight: bold;"><font size="2">[nid] =&gt; 结点ID</font></span><span style="font-weight: bold;"></span><br /><br /><br /><br /><span style="font-weight: bold;"><font size="2">原文:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&amp;</span><span style="color: rgb(0, 0, 0);">$node </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> Node object<br /><br />[name] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Username of node creator<br />[date] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Date the node was created<br />[status] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> TRUE</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">FALSE </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> published</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">unpublished<br />[moderate] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Moderation enabled (</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">)<br />[promote] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Promoted to front page (</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">)<br />[sticky] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Sticky (</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">)<br />[revision] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> TRUE</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">FALSE </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> is a </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> revision (</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> TRUE, will be saved as a separate entry in the database)<br />[comment] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> whether comments can be added, read, or accessed, </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> node<br />[simple_access] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Array </span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);"> A list of permissions </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> the Simple Access module<br />(<br />[view] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"><br />)<br /><br />[title] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Page title<br />[taxonomy] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Array </span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);"> Taxonomy classification<br />(<br />[</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"><br />)<br /><br />[body] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Body content of node<br /><br />[format] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> which filter applies to </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> content.<br />[uid] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> User ID of node creator<br />[created] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> UNIX timestamp of node creation date.<br />[type] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Type of node (e.g. book, page, forum)<br />[teaser] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Teaser (the initial part of the body)<br /><br />[validated] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> has the node passed validation</span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">) (is it ready to be saved).<br />[changed] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> UNIX timestamp of last time node was changed.<br />[nid] </span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> Node ID</span></div><br /></font></span><img src ="http://www.blogjava.net/JPeanut/aggbug/106281.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JPeanut/" target="_blank">陈市明</a> 2007-03-25 22:34 <a href="http://www.blogjava.net/JPeanut/archive/2007/03/25/106281.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Jython项目（The Jython Project）</title><link>http://www.blogjava.net/JPeanut/archive/2007/02/27/101036.html</link><dc:creator>陈市明</dc:creator><author>陈市明</author><pubDate>Tue, 27 Feb 2007 15:34:00 GMT</pubDate><guid>http://www.blogjava.net/JPeanut/archive/2007/02/27/101036.html</guid><wfw:comment>http://www.blogjava.net/JPeanut/comments/101036.html</wfw:comment><comments>http://www.blogjava.net/JPeanut/archive/2007/02/27/101036.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JPeanut/comments/commentRss/101036.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JPeanut/services/trackbacks/101036.html</trackback:ping><description><![CDATA[
		<span style="font-weight: bold;">
				<font size="2">[翻译:陈市明 摘自:http://www.jython.org]</font>
				<br />
				<br />Jython项目</span>
		<span style="display: none;">SupeSite/X-Space社区门户+V&#xF;|&#x7;t
D&#x18;W3]</span>
		<br />  Jython是用纯java实现的动态面向对象的高级语言，她无缝的结合了java和python两种语言。用户可以在任何java虚拟机上使用python。<br /><span style="display: none;">&#x17;H&#x1D;T3L)q&amp;~&#x1C;z'v#c:J2</span>  最新消息：目前发布的最新Release版本是Jython 2.2 Beta<br /><span style="display: none;">&#x14;H&#x1F;D3|8F'l2h&#x8;w2</span><span style="font-weight: bold;">什么是Jython</span><span style="display: none;">SupeSite/X-Space社区门户&#xF;Z0d�~&#x8;@5n&#x1;[&#x18;_</span><br />  Jython是动态面向对象的高级语言，可以无缝集成到java平台上。不管你是商业还是非商业的，都可以免费的使用Jython，也可以和你的源码一起发布。Jython可以弥补java的某些缺点特别是在一下几个方面：<br /><span style="display: none;">(N%n&#x11;?&#x11;r:a
E;i.^;W&#x1E;S&#x13;{2</span>   * 嵌入式教本 － Java开发人员在他们的系统中添加Jython的类库后，可以允许最终用户在他们的系统中编写各种脚本<br /><span style="display: none;">&#xB;_.y'\,Z%{!J'h2</span>   * 交互式测试 － Jython可以提供允许和java交互的接口，方便开发人员在java系统中有效调试<span style="display: none;">SupeSite/X-Space社区门户&#x1C;Z	@6|&#x17;z$l&#xE;r M</span><br />   * 快速开发 － 同样的功能，java的代码量是python的2到10倍左右，python的开发效率远远比高于java的开发。python和java的无缝的交互是的快发爱发人员可以免费的同时使用两种语言进行开发。<br /><span style="display: none;">&#x1C;z
y#t&#x1D;~&#x1B;H$}6F&#x1;F*d2</span>  有许多脚本语言可以在java虚拟机中运行，但是jython相比较，有以下优势：<br /><span style="display: none;">5G/Q&#x10;c&#x8;w&#x13;O&#xE;d%y2</span>   * 动态编译成java字节码 <br /><span style="display: none;">&#x15;P8G9f
k'O-a&#x13;c2</span>   * 通过jython可以直接调用现有的java类<span style="display: none;">SupeSite/X-Space社区门户4L1J#D&#x6;]&#x11;f$n'O&#x1C;C</span><br />   * Bean Properties<span style="display: none;">SupeSite/X-Space社区门户
p4u/{*_&#x7;s(|6H</span><br />   * python语法<br /><span style="display: none;">&amp;c&#x19;C�Q;[6y&#x13;h	P2</span><br /><span style="display: none;">&#x10;Q!y9?.z$?&#x2;F&#x10;S2</span><br /><span style="display: none;">"]&#x1E;L
U+?&#x3;d9?!I2</span><br /><span style="display: none;">&#x19;a&#x5;^	v&#x1A;y&#xF;H&#xC;a9R:g&#x1E;S6B3u2</span><span style="display: none;"><span style="font-weight: bold;">The Jython Project</span><br /><span style="display: none;">6B&#x1D;f0x&#x1D;m�s/S&#x11;~*V&#xB;v&#x8;z&#x15;[2</span><span style="display: none;">SupeSite/X-Space社区门户&#x1E;p&#x4;K&#x1B;A#n;N;S#S P;j%f</span><br />Jython
is an implementation of the high-level, dynamic, object-oriented
language Python written in 100% Pure Java, and seamlessly integrated
with the Java platform. It thus allows you to run Python on any Java
platform.<span style="display: none;">SupeSite/X-Space社区门户&#x17;Y&#x16;S,L&#x18;P7K#~!@</span><br /><span style="display: none;">SupeSite/X-Space社区门户*{$x	i&#x16;`&#x14;Q9o</span><br />Latest News<br /><span style="display: none;">&#x11;T&#x10;K*i&#x10;_8d&#x4;K9L&#x10;V2</span><br /><span style="display: none;">'I&#x12;L"D&#x8;g-J8T2</span>The Jython development team is proud to announce a new release: Jython 2.2 Beta1!<span style="display: none;">SupeSite/X-Space社区门户&#x17;e&#x5;K&#x1C;W/M&#xB;Y&#x4;Q</span><br /><br /><span style="display: none;">&#x1B;m/L&amp;K5B</span>upeSite/X-Space社区门户&#x17;e&#x5;K&#x1C;W/M&#xB;Y&#x4;Q</span><br /><b>The Jython Project</b><br /><br />Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.<br /><br />Latest News<br /><br />The Jython development team is proud to announce a new release: Jython 2.2 Beta1!<br /><br />    * Download it,<br />    * install it,<br />    * then kick the tires and start filing bug reports to help get 2.2 polished up and done, so we can get going on the next Jython 2.x.<br /><br /><b>What is Jython?</b><br /><br />    Jython, lest you do not know of it, is the most compelling weapon the Java platform has for its survival into the 21st century:-)<br /><br />    —Sean McGrath, CTO, Propylon<br /><br />Jython is an implementation of the high-level, dynamic, object-oriented language Python seamlessly integrated with the Java platform. The predecessor to Jython, JPython, is certified as 100% Pure Java. Jython is freely available for both commercial and non-commercial use and is distributed with source code. Jython is complementary to Java and is especially suited for the following tasks:<br /><br />    * Embedded scripting - Java programmers can add the Jython libraries to their system to allow end users to write simple or complicated scripts that add functionality to the application.<br />    * Interactive experimentation - Jython provides an interactive interpreter that can be used to interact with Java packages or with running Java applications. This allows programmers to experiment and debug any Java system using Jython.<br />    * Rapid application development - Python programs are typically 2-10X shorter than the equivalent Java program. This translates directly to increased programmer productivity. The seamless interaction between Python and Java allows developers to freely mix the two languages both during development and in shipping products.<br /><br />There are numerous alternative languages implemented for the Java VM. The following features help to separate Jython from the rest:<br /><br />    * Dynamic compilation to Java bytecodes - leads to highest possible performance without sacrificing interactivity.<br />    * Ability to extend existing Java classes in Jython - allows effective use of abstract classes.<br />    * Optional static compilation - allows creation of applets, servlets, beans, ...<br />    * Bean Properties - make use of Java packages much easier.<br />    * Python Language - combines remarkable power with very clear syntax. It also supports a full object-oriented programming model which makes it a natural fit for Java's OO design.<br /><br /><span style="display: none;">&#x1B;m/L&amp;K5B</span><br /><span style="display: none;">&#x1B;m/L&amp;K5B</span><img src ="http://www.blogjava.net/JPeanut/aggbug/101036.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JPeanut/" target="_blank">陈市明</a> 2007-02-27 23:34 <a href="http://www.blogjava.net/JPeanut/archive/2007/02/27/101036.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>