[wp-hackers] Zen-Coding for WordPress?

Philip Walton philip at philipwalton.com
Thu Apr 7 17:02:40 UTC 2011


If anyone is interested. I've put together some documentation on the PHP 
- Zen Coding project I wrote about a few weeks ago. Here is the URI: 
http://philipwalton.com/2011/04/06/zen-coding-for-php-and-wordpress/

I've optomized it for WordPress to take advantage of functions like 
esc_attr() and esc_url() so developers don't have to worry about that stuff.

Here's a quick example:

echo $zc->expand(
   '.posts>ul>li.post$*6',
   array("Red","Orange","Yellow","Green","Blue","Violet")
);

outputs:

<div class="posts">
   <ul>
     <li class="post1">Red</li>
     <li class="post2">Orange</li>
     <li class="post3">Yellow</li>
     <li class="post4">Green</li>
     <li class="post5">Blue</li>
     <li class="post6">Violet</li>
   </ul>
</div>


On 3/30/11 5:05 PM, Philip Walton wrote:
> Otto, I'm mainly planning on duplicating functionality, not trying to 
> tap into their existing code. And, I'm not planning on implementing 
> every single feature of the specification, since many of them don't 
> make sense in PHP.
>
> Also, there needs to be a way to pass content since, in the 
> text-editor version, the content is manually typed in.
>
> I've already got some ideas that are working pretty well, and I'll 
> post a demonstration when I'm finished.
>
> Philip
>
>
> On 3/30/11 4:53 PM, Otto wrote:
>> On Wed, Mar 30, 2011 at 5:16 PM, Philip 
>> Walton<philip at philipwalton.com>  wrote:
>>> Paul, yes, It is a module for a text editor, but I think it would 
>>> also be
>>> useful programmatically.
>> The problem is that the entire zen-coding core is written in
>> Javascript, not in PHP. So unless you want to create a JS->PHP
>> converter or tie in a Javascript interpreter of some sort, there's no
>> way to process this sort of thing server-side.
>>
>> -Otto
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list