server {
listen 80;
server_name www.liumin.name;
root /www.liumin.name/web;
index index.php;

charset utf-8;

location / {
if (-f $request_filename) {
expires max;
break;
}

if ($request_filename !~ "\.(js|htc|ico|gif|jpg|png|css)$") {
rewrite ^(.*) /index.php last;
}
}

location ~ \.php($|/) {
set $script $uri;
set $path_info "";

if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}

fastcgi_pass unix:/tmp/php-cgi.sock;

include fcgi.conf;

fastcgi_param SCRIPT_FILENAME /www.liumin.name/web$script;
fastcgi_param PATH_INFO $path_info;

log_format liuminlogs '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /logs/liumin.log liuminlogs;
}
}

jobbeet logo
Symfony 为1.2版本写的新手册,Joobeet Turorial类似与Askeet tutorial一天一课,有需要翻译的可以去报名了。

中文版

在jQuery 1.2.6版本中,sortable的ajax调用,没有serialize一个sortable对象到javascript数组的方法。
这有一个例子,使用的是symfony代码,其他的php代码也类似。

  1. <ul id="item_list">
  2. < ?php foreach ($items as $item): ?>
  3.   <li id="item_order_<?php echo $item->getId() ?>">< ?php echo $item->getName() ?></li>
  4. < ?php endforeach ?>
  5. </ul>

调用ajax的方法:

  1. $('#save_btn').click(function(){
  2.     $.post("< ?php echo url_for('collection/reorder') ?>", { item_order_str: $('#item_list').sortable("serialize") });
  3. });

Continue reading »

把session存入数据库后,它是一个经过serialize过的数据,如果想不通过symfony读取出来,需要unserialize。
通过这个函数:

  1. function unserialize_session_data($serialized_string)
  2. {
  3.     $variables = array();
  4.     $a = preg_split( "/(\w+)\|/", $serialized_string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
  5.  
  6.     for( $i = 0; $i < count( $a ); $i = $i+1 ) {
  7.         if ($a[$i] == 'attributes'){
  8.             $variables[$a[$i]] = unserialize( $a[$i+1] );
  9.             break;
  10.         }
  11.     }
  12.     return $variables;
  13. }

Continue reading »

This issue will be fixed with symfony 1.1.1:
http://trac.symfony-project.com/ticket/3857 (see comments)

终于来了,等了好长时间.

从1.0升级到1.1的文档

http://trac.symfony-project.com/browser/branches/1.1/UPGRADE

© 2011 刘敏的Blog Suffusion theme by Sayontan Sinha