让Aptana支持cx标签库

ThinkPHP是一个优秀的国产PHP框架,内置了一套性能卓越的模板引擎ThinkTemplate,并且默认导入cx标签库,这样我们就可以像使用JSTL一样通过<volist>, <foreach>, <switch>等标签来完成复杂的操作。

遗憾的是,当我们在Aptana里写了如下的代码时,编辑器会报错,告诉我们<volist>标签无法识别

<volist name='list' id='vo'>
	编号:{$vo.id}<br/>
	标题: {$vo.title}<br/>
	内容: {$vo.content}
	<hr>
</volist>

aptana error.jpg

虽说项目一样可以正常运行,但是这红叉叉看起来那么刺眼,真是让人不爽。通过html validation配置,我们可以让编辑器忽略掉这类“不是错误的错误”。

打开Window -> Preferences,定位到Aptana -> Editors -> HTML -> Validation,这里有两种选择

1. 直接去掉Tidy Html Validator复选框前的勾。这样编辑器就不会检查语法,带来的副作用就是你其它的错误它也发现不了了

2. 保持Tidy Html Validator被选中,在下面的filter区域里用正则表达式来添加需要过滤的错误。

html validation.jpg

当然这样也有缺点,就是需要手工把所有的cx标签都加进去,比较麻烦。查看ThinkPHP 2.0完全开发手册的第7章模板指南,发现一共有如下这些标签:

include, import, volist, foreach, switch, case, default, if, elseif, else, eq, neq, gt, egt, lt, elt, heq, nheq, in, notin, range, present, notpresent, empty, notempty, defined, notdefined, literal, php

配置完成后确定,红叉叉去无踪~

手工为aptana安装php debugger插件

昨天重装了Aptana studio 2.0,装pdt、embedded firefox、jQuery等插件,花了几个小时,发现php debugger装不上

An error occurred while collecting items to be installed
  session context was:(profile=AptanaProfile, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect, operand=, action=).
  No repository found containing: osgi.bundle,org.zend.php.debug.debugger,5.3.7.v20091116
  No repository found containing: osgi.bundle,org.zend.php.debug.debugger.win32.x86,5.3.7.v20091116
  No repository found containing: org.eclipse.update.feature,org.zend.php.debug_feature,5.3.7.v20091116

找不到文件,自动更新真杯具。自动的不行,自己动手呗。

打开downloads.zend.com/pdt,下载下面三个文件

org.zend.php.debug_feature_5.3.7.v20091124.jar
org.zend.php.debug.debugger.win32.x86_5.3.7.v20091124.jar
org.zend.php.debug.debugger_5.3.7.v20091124.jar

20091124,貌似比自动更新上的20091116还新一点。。。

用winrar解压这3个jar包,文件夹用对应的文件名来命名。第一个复制到features目录,后面两个复制到plugins目录。

我记得Eclipse装插件是不用解压的,这玩意为啥需要解压我也不知道,反正我试过不解压丢进去它不认识。。。

Aptana抽风

Aptana是Web开发神器,关于神器的介绍可以看这里,昨天重装了下Aptana Studio 2.0,悲剧出现了,启动不了。

Could not launch the product because the specified workspace cannot be created. The specified workspace directory is either invalid or read-only.

搞这种事,十分不爽。打开configurations目录下的config.ini,发现

# The default workspace location
osgi.instance.area.default=@user.home/My Documents/Aptana Studio Workspace

嗯?工作区默认在我的文档,可是我早就把我的文档移到E盘了,好吧,改成

osgi.instance.area.default=E:\My Documents\Documents\Aptana Studio Workspace

不过话说win7下面我的文档貌似也不是My Documents,直接就是Documents。真不明白为啥它就不能mkdirs()一下呢?搞得启动都不行。