131个字符的php framework

friendfeed上看到这个链接 —— The 140 Characters Webapp Challenge!,这个比赛要求用140个字符的代码造就一个web应用。

里头有36个程序可供投票,基本上全是脚本语言大杂烩:php,perl,ruby,javascript。实现的应用也是五花八门,有相册,类twitter,小游戏,甚至还有php代码框架?摘录如下:

require __DIR__.'/c.php';
if (!is_callable($c = @$_GET['c'] ?: function() { echo 'Woah!'; }))
        throw new Exception('Error');
$c();

这段代码利用了php5.3的一些新特性:

  • __DIR__
  • Anonymous functions
  • ?:运算符

代码只有131个字符,由于代码极为简陋,安全性也是没得保障的,只能算一个程序的统一入口罢了。

如果用php 5.2来写这段代码,大概就是:

require dirname(__FILE__).'/c.php';
if (!is_callable($c = @$_GET['c'] ? $_GET['c'] : create_function('', "echo 'Woah!';")))
        throw new Exception('Error');
$c();

如果要让这段代码变得实用点,可以在$c前面加上一个前缀,这样安全性会有进一步提升,代码也会相应的增加若干字节。

PRADO 3.0.2 is released

prado 3.02发布

We are pleased to announce that PRADO version 3.0.2 is formally released! Version 3.0.2 is a maintenance release of PRADO 3.0, which mainly contains bug fixes and minor enhancements and features.

The most significant feature introduced in this release is the paging capability which is made inherently available to all data-bound controls, such as TRepeater, TDataList, TCheckBoxList, etc. A new TPager control is also introduced which can be used together with the data-bound controls to achieve paging of contents rapidly and easily.

Starting from this release, we provide a Macromedia Dreamweaver extension (thanks to Stanislav). The extension installs a PRADO tag library which allows auto-completion of component tags when using Dreamweaver to create PRADO templates. We also provide a script named prado-cli.php which can create a skeleton PRADO application.

PRADO v3.0.2 may be downloaded at http://www.pradosoft.com/download/.

To unsubscribe from these announcements, login to the forum and uncheck “Receive forum announcements and important notifications by email.” in your profile.

You can view the full announcement by following this link:

http://www.pradosoft.com/forum/index.php?topic=5013.0

什么是prado

Zend Framework Preview 0.1.3

zend framework预览版0.13发布。这个版本主要是一些bug修正和功能改进,其中Zend_Search_Lucene已经从incubator(雏形模块?)目录移到Zend目录,应该是完善一些的版本了。

BTW:最近刚换了工作环境,公司屏蔽了qq,msn,回家还没有网络可上,真是一片愁云惨雾

Zend Releases Zend Framework Preview Release

Zend发布了Zend Framework的第一个预览版本:

We are glad to finally unveil the Zend Framework project. We have worked hard in the past few months with our partners and the community to get to this stage. We believe the Zend Framework can already be of great use to PHP developers, although we still have a lot of work ahead of us.

他们为此新建了一个窝点framework.zend.com,可以在此搜缴出这个framework的下载,详细文档,FAQ等等.且让俺来试试这个php的第一个官方开发框架….

Zend Framework is a high quality and open source framework for developing Web Applications and Web Services. Built in the true PHP spirit, the Zend Framework delivers ease-of-use and powerful functionality. It provides solutions for building modern, robust, and secure websites.

后记:运行其中的一个demo: demos\Zend\Feeds,报错(原因是library\Zend\InputFilter.php未定义类常量HOST_ALLOW_DNS):

Fatal error: Undefined class constant ‘HOST_ALLOW_DNS’ in D:\xampp\htdocs\ZendFramework-0.1.1\library\Zend\Uri\Http.php on line 373

显然预览版比较失败~~

Continue reading “Zend Releases Zend Framework Preview Release”

Rasmus Lerdorf: 无框架式的PHP MVC 框架

Rasmus Lerdorf 在他的blog上发表了一篇文章no-framework PHP MVC framework,这篇文章的例子是一个简单的web应用,使用sqlite和pdo做为数据库应用层,用ajax和json做为数据校验,view层使用了一些Yahoo! User Interface Library.的组件,全部例子完全由PHP+HTML+JAVASCRIPT组成,没有使用第三方的Framework.

注:这篇文章的主题只是提出如何使用php本身构建mvc的web应用,并不讨论面向过程还是面向对象两种编程方式哪种更好.

PRADO v2.0RC发布

PRADO v2.0RC发布,还不是稳定版本,但是可以尝试一下.更新如下:

[@more@]

– Added I18N, L10N support (with several relevant components)
– Added TDataGrid, TTable, TDataList, TWizard, TRequiredListValidator controls
– Implemented viewstate manager handler
– Implemented enumerable property type
– Changed the way of including a parameter file within another one
– Added EncodeText property to controls with Text property
– The parameter of TComponent::removeChild() is changed to component from ID
– Control state synchronization is done in addBody() now (instead of addChild())
– Control viewstate maintenance is now based on container-containee relationship
– TComponent::addParsedObject() is now invoked when parsing an object
– List control now renders values instead of indexes
– Implemented TCollection class, Bodies property of TControl
is now of type TCollection that allows insertion
– Added Datalist, Datagrid and I18N examples
– Implemented feature 1093392: Better package layout
– Implemented feature 1094956: display spaces
– Implemented feature 1102525: Module spec file
– Fixed bug 1093843: TRepeater::getItemCount() returns wrong value
– Fixed bug 1094219: TDateFormat patterns missing
– Fixed bug 1093018: Translation table cache and php open tag
– Fixed bug 1091966: Error handler doesn’t make allowances for @ operator
– Fixed bug 1100512: Controls losing viewstate
– Fixed bug 1103937: TListControl fatal error within TDataList
– Fixed bug 1099808: TTextBox: Slashes won’t be stripped
– Fixed visibility bug related with selection controls

PRADO v1.7发布

PRADO v1.7发布。PRADO是什么?

PRADO是在PHP5环境下的一个基于事件驱动和基于组件的WEB应用开发框架。使用PRADO开发WEB应用,你主要需要做的工作就是使用已有的组件(原文是"实例化已经定义好的组件",熟悉面向对象编程的开发者可能比较容易理解这句话),设置组件的属性,为控件组件的各种事件编写对应的处理函数,然后把这些组织成一个个的页面。这里是prodo 1.6的中文教程

更新如下:

Changes since v1.6
=============
– solved the incompatibility problem of Javascript used in validators
– enhanced event handler binding (allow binding indirect child component events in template)
– introduced parent-child relationship, the old one renamed to container-containee relationship
– expression, statement tags with context being themselves
– replaced TApplication::getInstance() with pradoGetApplication()
– implemented handler concept in TApplication
– added handler classes: TResourceParser, TResourceLocator, TRequest, TCacheManager, and TErrorHandler
– defined new exception classes
– TComponent added many properties
– introduced module concept and implemented TModule
– implemented application state handling
– added AutoTrim to TTextBox
– removed the application-level data encoding
– instantiateTemplate will init properties
– addChild will also load view state and synchronize life cycle of the new component
– added blog example
– added new components including TFormLabel, TValidatorGroup, TFileUpload, TCheckListBox, TListControl
– added a tutorial for using validators