鍍金池/ 教程/ PHP/ 樣式和翻譯
開(kāi)始構(gòu)建一個(gè)框架應(yīng)用程序
模塊
路由和控制器
表單和動(dòng)作
結(jié)尾
開(kāi)始使用 Zend Framework 2
樣式和翻譯
數(shù)據(jù)和模型

樣式和翻譯

打包好 SkeletonApplication 的樣式,但是我們需要改變標(biāo)題和移除版權(quán)信息。

ZendSkeletonApplication 使用 Zend\I18n 的翻譯功能來(lái)處理所有文字。它使用 .po 文件,文件存在 module/Application/language,你可以使用 poedit 來(lái)進(jìn)行編輯。用 poedit 打開(kāi) module/Application/language/en_US.po。在 Original 設(shè)置列表中點(diǎn)擊 Skeleton Application,然后輸入 “Tutorial” 作為翻譯的類(lèi)型。

http://wiki.jikexueyuan.com/project/zend2-user-guide/images/stylingandtranslations1.png" alt="image" />

點(diǎn)擊工具欄的保存按鈕,poedit 將會(huì)創(chuàng)建一個(gè) en_US.mo 文件。如果你不能找到 .mo 文件的話,點(diǎn)擊 Preferences -> Editor -> Behavior 然后選中復(fù)選框 Automatically compile .mo file on save。

移除版權(quán)信息,我們需要編輯 Application 模塊的 layout.phtml 視圖腳本。

 // module/Application/view/layout/layout.phtml:
 // Remove this line:
 <p>&copy; 2005 - 2014 by Zend Technologies Ltd. <?php echo $this->translate('All
 rights reserved.') ?></p>

現(xiàn)在這個(gè)頁(yè)面看起來(lái)比之前纖細(xì)多了。

http://wiki.jikexueyuan.com/project/zend2-user-guide/images/stylingandtranslations2.png" alt="" />