Issuu on Google+

封 面

-3-


前 言 《国外 PHP 动态》是一份将最近国外 PHP 的新闻和文章,以中英文对照形式提供 给大家的一份杂志。 国内已有的 PHP 杂志,文章都是国人所写,尽管水平不错,但是 PHP 毕竟是国际 性社区来维护和发展的技术,所以有必要了解国外的最新咨询和技术来提高国内整体的水 平和氛围。 《国外 PHP 动态》希望达到的目标: 1、让国内的 PHP 开发者了解国外动态 2、提供获得更多的知识给国内的开发者 3、为国内的开发者提高英语能力提供一个辅助 4、以我们的努力为开源事业做一些贡献 最新翻译文章请浏览 QQ 群空间:http://group.qq.com/group_index.shtml?groupid=25186583 或者加入 QQ 群:49199487 、25186583 、与众多开发者讨论 PHP 及相关技术 翻译团队:双瞳、$劣头→ 翔℃ 、bob 编辑团队:江浪菜菜 申请加入团队请联系:lightsaber 文锋、QQ:176564452 、MSN:wfnlxp@hotmail.com

-2-


目 录 封 面 .................................................................................................................................................. 1 前 言 .................................................................................................................................................. 2 目 录 .................................................................................................................................................. 3 一、IMPROVE WEBSITE LOAD TIME BY 500% WITH 3 LINES OF CODE ($劣头→ 翔℃ 译).............................................................................................................................................. 4 二、WHAT IS MISSING IN PHP SOAP EXTENSION? ($劣头→ 翔℃ 译) ................................ 5 三、5 ESSENTIAL DEVELOPMENT FACTS EVERY PHP DEVELOPER SHOULD KNOW ($劣头→ 翔℃ 译) .................................................................................................................... 6 四、USING YAHOO! WEB SERVICES WITH PHP 5 (BOB 译)................................................. 7 五、WRITING A CMS/COMMUNITY WITH SMARTY AND THE ZEND FRAMEWORK: PART 8 (BOB 译) .................................................................................................................... 8 六、CREATE A FACEBOOK APPLICATION WITH PHP (BOB 译) ......................................... 9 七、ECLIPSE 和 PHP (BOB 译) ................................................................................................... 10 八、CYGWIN (双瞳 译) ................................................................................................................ 11 九、TRACING PHP APPLICATIONS WITH XDEBUG (劣头→ 翔℃ 译)................................ 12 十、FROM PHP TO RUBY - 30 SIMILARITIES AND DIFFERENCES (劣头→ 翔℃ 译)....... 13 十一、THE BAKERY:EIGHT NEW ARTICLES, HELPERS & COMPONENTS (劣头→ 翔℃ 译)............................................................................................................................................ 14 封 底 ................................................................................................................................................ 15

-3-


国外 PHP 动态 2007 年 1 月[第四期]

一、 Improve website load time by 500% with 3 lines of code ($劣头→ 翔℃ 译) 发布时间:2007-1-3 原文: Leon Chevalier has posted about a class he's developed (you can download it) that can help to speed up the load times for your site. There are 4 relatively easy ways by which you can speed up the time it takes a browser to download a page. Following on from my post on joining CSS and JavaScript files, I have written a PHP script which will automatically do all of the above. He gives example code of the class in action and includes some screenshots of the benchmarks from the YSlow Firefox extension showing the improvements. 译文: Leon Chevalier 发布了他开发的一个类(附上下载地址)来帮助加速你的站点的载入 时间。有四种相对简单的办法来加速浏览器下载页面的时间。继上次我写的合并 CSS 和 JS 文件的文章之后,我又写了一个 PHP 脚本来自动完成上述过程。他给出了类的代码实 例,并包括一些 YSlow Firefox 扩展显示的优化效果的截图。 原文地址:http://aciddrop.com/2008/01/21/boost-your-website-load-time-with-3-lines-of-code/ 下载地址:http://aciddrop.com/2008/01/23/site-speed-boost-script-updated/

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 4 -


国外 PHP 动态 2007 年 1 月[第四期]

二、 What is Missing in PHP SOAP Extension? ($劣头→ 翔℃ 译) 发布时间:2007-1-5 原文: On the PHP Web Services blog today, Sami asks "what's missing from PHP's SOAP extension" that needs to be added or corrected. PHP SOAP extension is good to get started, to play around with. However, it falls much short in meeting the enterprise demands in the SOA era. He talks about things missing (like binary file features and lots of security features). He also notes something that most PHP developers love about the extension - the WSDL parsing that makes it so easy to simply call a remote service without having to go through the pain of hacking through it yourself. 译文: PHP SOAP 扩展缺了什么? 在今日的 PHP Web Services blog 上,Sami 提问: “PHP 的 SOAP 扩展中缺少了什么”需要被增加或更正的。 PHP SOAP 扩展容易上手,起步 简单。然而它在满足 SOA 时代的企业需求方面有很大欠缺。他讨论了欠缺的因素(比如 二进制文件特性和许多安全特性)。同时他也提到了大多数 PHP 开发者喜好这个扩展WSDL 解析令呼叫远程服务如此简单,免去亲自操劳之苦。 原文地址: http://phpwebservices.blogspot.com/2008/01/what-is-missing-in-php-soap-extension.html

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 5 -


国外 PHP 动态 2007 年 1 月[第四期]

三、 5 essential development facts every PHP developer should know ($劣头 → 翔℃ 译) 发布时间:2007-1-7 原文: The Developer Tutorials website has started up a blog and has already posted some great content to it including this new post covering five things that every PHP coder should know about development. There's always a bridge between textbook knowledge of programming syntax, procedure etc. - and the real world knowledge that you get from actually developing real applications. Here are five things every PHP developer should be familiar with before they begin developing web applications in PHP The list is: * Frameworks * Templating engines Code availability * Don't reinvent the wheel * IRC is a wonderful thing I'm a particular fan of that last one and regularly hang out in the same ##php channel over on Freenode. 译文: 5 个 PHPer 不能不知的开发要素 Dveloper Tuorials 网站建立了一个博客并在其中 发布了一些很棒的内容,包括这篇,5 个 PHPer 不能不知的开发要素。在编程的书面知 识(比如表达式,流程等)和你在真实世界中开发真正的项目所获得的知识之间总有联系 存在。以下是五点 PHP 开发者在他们开始用 PHP 作 Web 应用开发之前就应该熟悉的。 列表如下:* 框架 * 模板引擎代码可用性 * 要有拿来主义 *IRC 是个好东西 我尤其崇 尚最后一个,而且我常在 Freenode 的固定 PHP 频道晃悠。 原文地址: http://www.developertutorials.com/blog/server-side-scripting/php/5-essential-facts-every-p hp-developer-should-know-6/

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 6 -


国外 PHP 动态 2007 年 1 月[第四期]

四、 Using Yahoo! Web Services with PHP 5 (bob 译) 发布时间:2007-1-8 原文: On DevShed a new series has started (a six-part one) with This new tutorial posted today talking about the use of the Yahoo! web services in a PHP5 application. It's not my intention to provide you here with a fully-featured guide on how to use Yahoo!'s Web services with PHP 5, because the best place to go is simply the aforementioned Developer Network. Instead, I'll offer to you a bunch of code samples that hopefully will assist you in the development of PHP 5 applications that will utilize some of these useful web services. You'll need to get an Application ID to work with before you get started (go here to sign up, you'll also need a Yahoo! ID), but the rest of the code is provided. They make a search request to the Yahoo! backend for "madonna" and show the XML formatting of the results. They also include examples of querying two other services offered by the company's backend API - video search and an image search. 译文: 通过 PHP 5 使用 Yahoo Web 服务 今天,DevShed 开始了一个新的系列教程(共有 6 部分),讲述的是如何在 PHP 5 程序中使用 Yahoo 的 Web 服务。我写这篇教程的目的, 不是为了提供一个完整的在 PHP 5 中使用 Yahoo Web 服务的指南,因为你完全可以在 以前提到的 Developer Network 上找到最理想的指南。在本文中,我将给出一些示范代码, 希望这些代码能帮助你学会如何在开发 PHP 5 应用程序时利用这些有用的 Web 服务。 在开始以前,你需要获取一个 Application ID(点这里注册,注册时需有 Yahoo ID),其 余的代码我全给出了。这些代码的作用是向 Yahoo 的后台提交一个搜索请求,关键字为 “Madonna” ,然后以 XML 格式输出搜索结果。文章还包含了通过 Yahoo 的后台 API 查询另两项服务的实例,分别是视频搜索和图片搜索。

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 7 -


国外 PHP 动态 2007 年 1 月[第四期]

五、 Writing a CMS/Community with Smarty and the Zend Framework: Part 8 (bob 译) 发布时间:2007-1-10 原文: The ProDevTips website has posted the eighth part of their series looking at using the Zend Framework and Smarty to create your own custom CMS/community website: The blog saga continues, we still don’t have any fancy Wordpress style filtering of the content. You know, creating these nice looking quotes and filtering potentially nasty html and stuff. Sure enough, TinyMCE has some function for allowing only certain tags and discarding others... They work on some of the administrative functionality and methods to grab more custom lists of articles. They cover some of the Smarty templates for the admin pages and the new functionality to handle things like removing articles and updating their contents. 译文: ProDevTips 网站发布了其关于如何用 Zend Framework 和 Smarty 创建自己的定制 化 CMS/社区网站的系列教程第 8 部分:Blog 大虾继续说道:我们还没有像 Wordpress 那种形式的内容过滤功能,也就是那些美观的引用样式,并且过滤掉可能带来麻烦的 HTML 代码之类的。当然了,TinyMCE 可视化编辑器拥有一部分过滤功能,可以只保留 特定的标签,去除其它的标签… … 文章谈到了一些管理功能,以及抓取更多自定义文章 列表的方法;还提及了一些用于后台管理页面的 Smarty 模板,以及删除文章、更新文章 内容之类的新功能。

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 8 -


国外 PHP 动态 2007 年 1 月[第四期]

六、 Create a Facebook Application With PHP (bob 译) 发布时间:2007-1-13 原文: The DeveloperTutorials website has a new tutorial posted that walks the reader through a step-by-step process to create a PHP Facebook application of their very own. Everyone is talking about Facebook and their new Application Platform and I have to admit I think it's pretty cool too. So I decided to create an application that uses the Facebook Platform. I'm writing the application in PHP and I thought it might be useful for others to know how to write their own Facebook applications with PHP. They show you where you'll need to go to set up an ID with Facebook to develop with, the developer application you'll need to add, where to grab the Facebook developer API and, finally, creating a simple application. Their example is just of the "Hello World" sort, but it gives you a good foundation to start from. They also include pointers to the Facebook Markup Language and a reference for the Facebook REST-based API interface. 译文: DeveloperTutorials 网站贴出了一份新的教程,指导读者一步步地用 PHP 创建出完 全属于自己的 Facebook 应用程序。引用:所有人都在谈论 Facebook 以及他们新的应用 平台(Application Platform),我得承认,我也觉得这个平台很酷。因此我决定写一个运用 Facebook 平台的应用。我是用 PHP 写的,我想它可能会对其他想要用 PHP 写自己的 Facebook 应用的人有帮助。 该网站说明了怎样在 Facebook 上创建一个 ID 以便开发、 你需要添加哪些开发工具、如何获取 Facebook 的开发 API ,以及如何创建一个简单的 应用。 他们举的例子仅仅是“Hello World”性质的,不过仍是一个不错的起点。教程中 还包括了一些 Facebook 标记语言(Facebook Markup Language)的指南,以及 Facebook 基于 REST 的 API 接口的参考。

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 9 -


国外 PHP 动态 2007 年 1 月[第四期]

七、 Eclipse 和 PHP (bob 译) 发布时间:2007-1-15 原文: The Tiger Heron blog has a new post from Tony Freixas looking at some of his experiences working with PHP in the Eclipse editor (including a mini-installation tutorial). In my last article, I talked about installing PHP. With PHP installed, you will want to start writing code, so today's article is about developing PHP using the open source Eclipse integrated development environment (IDE). He talks about what the Eclipse software has to offer before getting into the download and installation part of the tutorial. He goes all the way through - from configuration out to creating a sample PHP application (and debugging) with the software. 译文: Tiger Heron 日志新发表了一篇来自 Tony Freixas 的文章,文中讲述了他在 Eclipse 编辑器中撰写 PHP 代码的经验(包括一个简短的安装教程)。在我的上一篇文章里,我 讲了怎么安装 PHP 。装好 PHP 后,你就要开始写代码了,所以今天的文章就来谈谈如 何使用开源的 Eclipse 集成开发环境(IDE)开发 PHP 程序。 他首先介绍了 Eclipse 软 件可以提供的功能特性,然后介绍了怎样下载和安装。他还讲述了从软件的配置,到利用 该软件写出一个 PHP 程序实例(以及排错)的全过程。

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 10 -


国外 PHP 动态 2007 年 1 月[第四期]

八、 Cygwin (双瞳 译) 发布时间:2007-1-17 原文: Project Goal The Cygwin GNOME project aims to port the GNOME desktop to Windows OS, using Cygwin as a porting tool and user environment. This project is based on the Cygwin GNOME patches contributed by Steven O'Brien. Without his great work (and some others' efforts), this project won't come to reality. We also had some additional applications ported to Cygwin. To make maximum use of the power of Cygwin and Cygwin/X (together with the libraries and applications already ported to Cygwin), currently we have no plan to make any effort toward the native Windows UI. Please visit http://www.gimp.org/win32 for some info regarding that aspect. And gtk2 on Cygwin also have got Win32 UI port of gtk2 and some other libraries. Some complain that projects like CyGNOME is preventing 'Windows users' from 'converting' to *NIX. This is not true, we belive it is the other way. To clear these doubt please see article by Joshua Lokken an answer to those who complained about KDE-Cygwin (a similar project, more KDE users comments, more KDE-Cygwin Press Articles). 译文: Cygwin GNOME 这个项目是为了在 Windows 系统上建立 GNOME 桌面,使用 Cygwin 做为���植 【porting】 工具和用户环境。 这个项目是基于 Cygwin GNOME ,由 Steven O'Brien 修改。没有他的巨大贡献(以及其他人员的努力),这个项目是不可能完 成 的 。 我 们 同 样 也 有 其 他 的 一 些 应 用 实 例 移 植 到 了 Cygwin 。 为 了 使 Cygwin 和 Cygwin/X (已经移植到 Cygwin 的库文件以及应用程序)达到最高的效率,目前我们还 没有计划要对 Windows 用户界面做任何开发。 请访问 http://www.gimp.org/win32 来获 取一些关于那方面的信息。cygwin 上的 gtk2 也已经有了 gtk2 和其它库的移植(And gtk2 on Cygwin also have got Win32 UI port of gtk2 and some other libraries.)有些抱怨说, 类似 CyGNOME 这样的项目是防止 Windows 用户向 *NIX 转变。 这种说法是错误的, 你可以阅读 Joshua Lokken 的文章来弄清这个问题,在文章里回答了关于 KDE-Cygwin 的抱怨。 原文地址:http://cygnome.sourceforge.net/ 关于 KDE-Cygwin: http://dot.kde.org/990126889 http://kde-cygwin.sourceforge.net/press.php 网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 11 -


国外 PHP 动态 2007 年 1 月[第四期]

九、 Tracing PHP Applications with xdebug (劣头→ 翔℃ 译) 发布时间:2007-1-20 原文: Continuing on from the previous part of his series, Stefan Priebsch has posted part two of his look at using XDebug over at the Zend Developer Zone. Welcome to the second installment of our five-part series of articles on xdebug, the PHP developer's swiss army knife extension. The installation of xdebug and its basic features were covered last week. This week, we will explore the tracing feature of xdebug. He details what tracing is and how it's helpful (no more repetitive var_dumps!) in finding issues in your code. He shows how to set up a trace log, add the code to your application to pass debugging information off to the log and how to add additional information to the log to make narrowing down the error even easier. 译文: C 继之前的第一部分,Stefan Priebsch 在 Zend 开发者地带发布了关于 XDebug 应 用的第二部分。欢迎来到五个系列中的第二部分。上周我们已经讨论了基本的特性和安装, 本周我们 将探索 PHP 开发者的瑞士军刀 –Xdebug 的追踪特性。他分析了追踪是什么, 在代码问题的查询中是多么有用(不再需要 var_dumps!)。他展示了如何更简便地建立追 踪记录,向你的应用中添加代码将调试信息写入记录,以及如何在记录中添加额外的信息 以缩小错误的范围。 原文地址:http://devzone.zend.com/article/2871-Tracing-PHP-Applications-with-xdebug

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 12 -


国外 PHP 动态 2007 年 1 月[第四期]

十、 From PHP to Ruby - 30 similarities and differences (劣头→ 翔℃ 译) 发布时间:2007-1-24 原文: Reinhold Weber has posted his lists of some of the similarities and differences between Ruby and PHP: If you are a PHP developer chances are you have heard some of the buzz on Ruby on Rails, an open source web framework for rapid application development. [...] These are similarities and differences of Ruby compared to PHP. If you know PHP, this should give you a good and quick insight in what Ruby is all about and how it compares to PHP. Some of the similarities include the dynamic typing, class scoping, heredoc abilities and current object references. Differences include syntax differences, method calling, naming conditions and Ruby's lack of interface/abstract classes. 译文: Reinhold Weber 在他新发布的文章中比较了 Ruby 和 PHP 的一些相似和不同之处。 如果你是个 PHP 开发人员,你可能碰巧听过 Ruby on Rails ,一个开源的快速的开发应 用 web 框架。… 以下是 Ruby 和 PHP 的一些相似和不同点。如果你了解 PHP ,对于 Ruby 是什么并且是如何与 PHP 比较的,这将给你一个快速且深入的了解。相似点中包 括动态输入,类构建,文档语法能力和当前对象参照。不同点包括语法,方法调用,命名 环境和 Ruby 对于类的接口/抽象的欠缺。 原文地址:http://reinholdweber.com/?p=7

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 13 -


国外 PHP 动态 2007 年 1 月[第四期]

十一、 The Bakery:Eight New Articles, Helpers & Components (劣头→ 翔℃ 译) 发布时间:2007-1-26 原文: The Bakery has a few new articles, helpers, components - even an event posted including: Want to order your SQL Persian Date Helper Using equalTo Validation To Compare Two Form Fields CakeFest: 2008-02-06, Orlando, FL Asset Mapper Modified Preorder Tree Traversal Component Ajax elements available anywhere Bindable Behavior: control your model bindings Keep an eye on The Bakery for more great CakePHP-related content. 译文: Bakery 新增了几篇文章和教程等等,如下:整理你的 SQL 波斯日期助手,使用 equalTo 认证比较两个表单 CakeFest:2008-02-06,奥兰多,佛罗里达,财富指南,定制 树形组件 Ajax 元素随处可得;可编联表现:控制你的模型编联,关注 Bakery 站点,获 得更多 CakePHP 相关的精品文章。 原文地址:http://bakery.cakephp.org/

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 14 -


国外 PHP 动态 2007 年 1 月[第四期]

封 底

网站:http://www.phpchina.com

投搞:phper@phpchina.com

《PHPer》 - 14 -


国外PHP动态第四期