Total Pageviews

Tuesday, 8 October 2013

Phrozn -PHP语言实现的静态网站

 http://www.phrozn.info/

System Requirements§
    PHP 5.3+

安装:
If you do not have Composer installed, install it first:
  #curl -s https://getcomposer.org/installer | php
Once Composer is installed, proceed with Phrozn installation:
  #php composer.phar create-project farazdagi/phrozn phrozn
  #cd phrozn
You can then symlink phr executable located in bin folder:
  #ln -s `pwd`/bin/phrozn.php /usr/local/bin/phr
(参考http://www.phrozn.info/en/installation/)

# mkdir /root/phrozn-site
# cd /root/phrozn-site
#phr init
有可能遇到错误:
PHP Fatal error:  require_once(): Failed opening required 'PEAR/Exception.php' (                                                                             include_path='/root/phrozn/vendor/pear/console_commandline:/root/phrozn/Phrozn/:                                                                          /root/phrozn:/root/phrozn/bin/../:.:/usr/share/php:/usr/share/pear') in /root/phrozn/vendor/pear/console_commandline/Console/CommandLine/Exception.php on line 28 

解决办法
#wget http://pear.php.net/go-pear.phar
#php go-pear.phar (see http://pear.php.net/manual/en/installation.getting.php,)

#phr init (在当前目录/root/phrozn-site下,会生成.phrozn/目录)

就会出现:
Initializing new project

  Project path: /root/phrozn-site/.phrozn/
  [ADDED]   config.yml
  [ADDED]   entries/index.twig
  [ADDED]   scripts/default.js
  [ADDED]   media/README
  [ADDED]   media/img/README
  [ADDED]   styles/default.less
  [ADDED]   plugins/README
  [ADDED]   archive/README
  [ADDED]   layouts/default.twig
# cd  .phrozn

as3:~/phrozn-site/.phrozn# ls
archive  config.yml  entries  layouts  media  plugins  scripts  styles
as3:~/phrozn-site/.phrozn# phr up (这个就是生成/更新静态网站的命令)
Phrozn 0.5.4 by Victor Farazdagi

Starting static site compilation.

  [OK]      Source directory located: /root/phrozn-site/.phrozn/
  [OK]      Destination directory located: /root/phrozn-site/.phrozn/
  [OK]      ./entries/demos/modal.twig parsed
  [OK]      ./demos/modal.html written
  [OK]      ./entries/demos/popup.twig parsed
  [OK]      ./demos/popup.html written
  [OK]      ./entries/demos/tabs.twig parsed
  [OK]      ./demos/tabs.html written
  [OK]      ./entries/demos/twipsy.twig parsed
  [OK]      ./demos/twipsy.html written
  [OK]      ./entries/index.twig parsed
  [OK]      ./index.html written
  [OK]      ./entries/about.twig parsed
  [OK]      ./about/index.html written
  [OK]      ./styles/default.less parsed
  [OK]      ./styles/default.css written
  [OK]      ./styles/bootstrap.less parsed
  [OK]      ./styles/bootstrap.css written
  [OK]      ./scripts/default.js parsed
  [OK]      ./scripts/default.js written
  [FAIL]    /root/phrozn-site/.phrozn/media/README: Failed transfering "/root/phrozn-site/.phrozn/media/README" from media folder
  [FAIL]    /root/phrozn-site/.phrozn/media/img/README: Failed transfering "/root/phrozn-site/.phrozn/media/img/README" from media folder
  [FAIL]    /root/phrozn-site/.phrozn/media/img/phrozn.png: Failed transfering "/root/phrozn-site/.phrozn/media/img/phrozn.png" from media folder
Phrozn is extremely flexible static site generator for PHP.
For additional information, see http://phrozn.info
as3:~/phrozn-site/.phrozn# ls
about    config.yml  entries     layouts  plugins  styles
archive  demos       index.html  media    scripts
as3:~/phrozn-site/.phrozn#
可见~/phrozn-site/.phrozn/就是静态网站的根目录。可绑定域名到该目录。

demo site: http://frz.brite.biz/

发贴方法:
 Now, it is time to create our first entry. All entries go to folder .phrozn/entries
as3:~/phrozn-site/.phrozn/entries# nano test1.twig
as3:~/phrozn-site/.phrozn/entries# cat test1.twig
帖子的格式如下:
<h3>test1</h3>

这是测试1.

as3:~/phrozn-site/.phrozn/entries# cd ..
as3:~/phrozn-site/.phrozn# phr up  (这个就是生成/更新静态网站的命令)


参考:
https://web.archive.org/web/20151118232725/http://www.phrozn.info/en/documentation/articles/getting-started/
 
https://web.archive.org/web/20151118232720/http://phrozn.info/en/installation/