让Smarty在DW里好看

 

利用Prefilter重写Smarty delimiters,实现设计时变量tag可见,逻辑tag不可见

设计时:{$variable}

<!–{setction name=aaa loop=$bbb}–>

…content

<!–{/section}–>

 

实现思想:

delimiter 分为design time delimiterparse time delimiter两种

Prefilterdesign time delimiter重写为parse time delimiter

如果有时候,design time delimiter为可见(非HTML comment tag),但是Smarty tag太长了,也会影响布局。可以引入fake design time delimiter的概念,例如(||),在fake design time delimiter间写在DW中看起来爽的,而把真正给Smartytag选成HTML coment tag写在后面,利用prefilter在编译之前把所有fake design time delimiter间的内容remove

Advertisements
This entry was posted in PHP Rocks. Bookmark the permalink.

2 Responses to 让Smarty在DW里好看

  1. Unknown says:

    wow gold!All wow gold US Server 24.99$/1000G on sell! Cheap wow gold,wow gold,wow gold,Buy Cheapest/Safe/Fast WoW US EU wow gold Power leveling wow gold from the time you wWorld of Warcraft gold ordered!

    wow power leveling wow power leveling power leveling wow power leveling wow powerleveling wow power levelingcheap wow power leveling wow power leveling buy wow power leveling wow power leveling buy power leveling wow power leveling cheap power leveling wow power leveling wow power leveling wow power leveling wow powerleveling wow power leveling power leveling wow power leveling wow powerleveling wow power leveling buy rolex cheap rolex wow gold wow gold wow gold wow gold -209993352361213

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s