新聞中心
Drupal技術(shù)文檔翻譯:按照路徑來定制站點(diǎn)的logo和名稱
作者 / 無憂主機(jī) 時(shí)間 2012-10-10 03:00:04
按照路徑來定制站點(diǎn)的logo和名稱站點(diǎn)名稱,這是通過一個(gè)代碼片段來讓您可以載入一個(gè)定制的布局文件來根據(jù)路徑來重寫站點(diǎn)的名稱和logo。當(dāng)然,無憂主機(jī)(www.love62.cn)小編這篇文章是來自drupal官網(wǎng)的文章,如果您對(duì)我的譯文有什么好的意見和建議來聯(lián)系QQ340555007。廢話不多說,直接進(jìn)入主題吧。 用法 做為一個(gè)實(shí)例,下面無憂主機(jī)(www.love62.cn)將一步步的引導(dǎo)您來如何使用這個(gè)php片段。 1、將相關(guān)主機(jī)下的page.tpl.php文件拷貝一份,并將其命名為page-blog.tpl.php。 2、用notepad.exe或者是dreamweaver之類的文本編輯器來按照您的意愿來修改模版。 3、把修改好的page-blog.tpl.php文件使用ftp工具上傳到“php虛擬主機(jī)”相對(duì)應(yīng)的主題目錄中。 建立好自定義的模版以后,下面就來加入php片段吧。
<?php /** * This snippet loads a custom page-blog.tpl.php layout file and * overrides the logo and site name when users * are viewing blogs. */ function _phptemplate_variables($hook, $variables = array()) { switch ($hook) { case 'page': if ((arg(0) == 'blog')) { $variables['template_file'] = 'page-blog'; // loads the custom page-blog.tpl.php file $variables['site_name'] = 'blog section name'; // change the site name $variables['logo'] = '/path/to/newlogo/logo.png'; // change the site logo } break; } return $variables; } ?>更多drupal中文教程,請(qǐng)您查看www.love62.cn/drupal。 原文地址:http://drupal.org/node/154096 純Linux環(huán)境下高端免備案【香港獨(dú)立IP地址】?php空間,僅僅只需199元一年起。商務(wù)中國域名核心代理直銷50元注冊(cè)國際頂級(jí)域名
本文地址:http://www.love62.cn/drupal/9128.html
![1](/wp-content/themes/starow_z/img/o-1.png)
![1](/wp-content/themes/starow_z/img/o-2.png)
![1](/wp-content/themes/starow_z/img/o-3.png)
![1](/wp-content/themes/starow_z/img/o-4.png)
![1](/wp-content/themes/starow_z/img/o-5.png)
![1](/wp-content/themes/starow_z/img/o-6.png)
![1](/wp-content/themes/starow_z/img/o-7.png)