All posts in PHP

Grid Archives 0.6.2 Bug Fix

Minor change in this bug fix build: PHP magic quotes (default on) causes the “‘” been escaped to “\’”, then “\” itself escaped to “\\”, and so on…. a simple stripslashes should fix this issue.

[ChangeLog]

Grid Archives 0.6.0 released

As promised before, a version (0.6.0) of Grid Archives just got released.

[Change Log in this version:]

  • added settings page in admin
  • added options in settings for user to specify the maximum post title and maximum post content length
  • added options in settings for user to specify the monthly summaries
  • remove .grid_archives_column width property
  • trim monthly summaries before parse

[Screenshots]

Grid Archives 0.5.0 released

Grid Archives finally got released on wordpress:
http://wordpress.org/extend/plugins/grid-archives/

To be frank, this can not be called a stable release, there’s still a lot more work to do:

  • add options page for users to input monthly summaries and other possible options (excerpt words length, grid size, color etc)
  • tweak css to be more compatible with different themes

These are the 2 big items current in my mind, and also the things that are very critical to make the plugin really “works”.

So my suggestion is: DO NOT install this version (0.5.0) of grid archives i, instead, waiting a few days after Grid Archives really get mature. That shouldn’t take very long as I’m currently actively developing it. You can also fork me on github if you’re interested and do not want to wait just a couple of days.

[Footnotes]
  1. You may have to manually edit the plugin file after installation, well, 80% … []

New Grid Archives Page

Announce the newly designed “Archives” page:

(click here to view the live demo)

All the work here concludes to a fresh new wordpress plugin – Grid Archives, which is actively under development.

There’s definitely a lot more work to do to make the plugin more flexible and more compatible with other themes, all the code has been checked in to github if you’re interested:

http://github.com/samsonw/wp-grid-archives

Any feedback or suggestion is welcome and appreciated.

PHP dev & debug: var_dump, var_export, error_log and FirePHP (Part 2)

接上篇: PHP dev & debug: var_dump, var_export, error_log and FirePHP (Part 1)

前面介绍到的基本上都是php 5自带的,下面介绍一个third party的solution。

6. FirePHP
[Installation]
第三方工具不好的一点是需要另外安装,php不自带(不然就不叫 third party了…),FirePHP的安装包括2个部分,firefox plugin和php lib.

(1) Firefox Plugin
可以在这里找到FirePHP plugin的下载地址,由于其本质上其实属于firebug的extension/plugin,所以install之前确保firebug已经安装.

(2) php lib
official site给出了清晰的instructions:

sudo pear channel-discover pear.firephp.org
sudo pear install firephp/FirePHPCore

Continue reading →

PHP dev & debug: var_dump, var_export, error_log and FirePHP (Part 1)

总结一下最近比较常用或是刚刚发现觉得比较好用的php dev & debug tool,肯定不全面,欢迎大伙补充。

1. var_dump()
用法很简单,就是你要dump什么data就传给这个方法什么data(其支持可变参数,不过一般还是习惯一个data一个var_dump())。它的好处很像ruby里的PP(pretty print),不过limit是只能输出到标准输出(php-cli是输出到控制台,php网页便是browser).

<?php
$tools = array("var_dump", "var_export", "error_log", array("Firebug", array("FirePHP")));
var_dump($tools);
?>
array
  0 => string 'var_dump' (length=8)
  1 => string 'var_export' (length=10)
  2 => string 'error_log' (length=9)
  3 =>
    array
      0 => string 'Firebug' (length=7)
      1 =>
        array
          0 => string 'FirePHP' (length=7)

Continue reading →