Drupal的安裝及ZEN主題的使用

Drupal的安裝

1. 下載程序Drupal 6.19中文包
2. 新建一個數據庫
3. 解壓縮后進行安裝,這里要注意的是sites\default\default.settings.php這個文件是要復制一份并改名為settings.php。

ZEN主題的使用

1. 下載ZEN主題
2. 解壓后放到sites\all\themes\目錄下,如果沒有themes目錄則建立一個

以ZEN主題創建自己的主題

1. 拷貝STARTERKIT目錄到sites\all\themes\目錄下并改名,如fy907
2. 把STARTERKIT.info.txt改名為fy907.info
3. 替換template.php和theme-settings.php文件中的STARTERKIT為fy907
4. 登陸后臺,在admin/build/themes下找到新建的主題并啟用。

添加江陰印刷網主題自定義菜單并支持二級分類

如果你在使用江陰印刷網風格,而且升級到了WordPress3.0,那么你可以看看主題在3.0下首頁的分類名不顯示的解決辦法,而這篇是使主題支持自定義菜單并支持二級分類。

編輯functions.php文件,在 include (TEMPLATEPATH . ‘/settings.php’); 下添加

1
2
3
4
5
6
7
8
9
register_nav_menus( array(
    'primary' => __( 'Primary Navigation', 'cnt1' ),
) );
   
function cnt1_page_menu_args( $args ) {
    $args['show_home'] = true;
    return $args;
}
add_filter( 'wp_page_menu_args', 'cnt1_page_menu_args' );

編輯header.php文件,查找下例代碼
繼續閱讀

解決江陰印刷網風格適應WordPress3.0

如果你正在使用江陰印刷網風格,而且升級到了WordPress3.0,會出現首頁的分類名不顯示,搜索了一下官方,找到了解決辦法:

編輯主題的index.php文件,找到

1
$wp_query->is_category = false;

改為

1
$wp_query->is_category = true;

再找

1
<?php single_cat_title(); ?>

改為

1
<?php printf( __('%s','ctn1'), single_cat_title('', false)); ?>

這樣就可以正確顯示分類名,如果還有其它問題,可以留言解決。

WordPress主題的jQuery應用之TAB切換效果

首先在header.php的head標簽中加載jQuery庫

1
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>

新建一個JS文件,在header.php的head標簽中加載,JS文件中加入下例代碼:

1
2
3
4
5
6
7
8
9
$(document).ready(function(){
$(".entry-foot span:first").addClass("current");  // 為第一個span添加 .current 的樣式,默認選中
$(".entry-foot ul:not(:first)").hide();  //ul 不是第一個時隱藏
$(".entry-foot span").mouseover(function(){  // 鼠標移到 span 上時觸發函數
$(".entry-foot span").removeClass("current");  //為第一個 span 移除 .current 樣式
$(this).addClass("current");  //為觸發的 span 添加樣式
$(".entry-foot ul").hide();  // 隱藏 ul
$("."+$(this).attr("id")).fadeIn("slow");  // 這句是核心,class(.) 和觸發 span 的ID 一致的 fadeIn(漸顯)
});});

HTML代碼如下:

1
2
3
4
5
6
7
8
9
<div class="tab">
<p>
<span ID="tab1">tab1</span>
<span ID="tab2">tab2</span>
<span ID="tab3">tab3</span></p>
<ul class="tab1">以 LI 形式呈現的 tab1 的內容</ul>
<ul class="tab2">以 LI 形式呈現的 tab2 的內容</ul>
<ul class="tab3">以 LI 形式呈現的 tab3 的內容</ul>
</div>

添加CSS代碼如下:

1
2
3
4
5
6
7
.entry-foot{background-color:#FAFAFA;margin:5px 8px;padding:5px 10px;}
.entry-foot p span{background-color:#EFEFEF;border:1px solid
#CCCCCC;cursor:pointer;margin-right:6px;padding:2px 5px;}
.entry-foot p span.current{background-color:#FAFAFA; border-bottom-color:#fafafa;}
.entry-foot p{border-bottom:1px solid #CCCCCC;font-weight:bold;padding:0 10px 2px;}
.entry-foot li{border-bottom:1px dotted #CCCCCC;padding-bottom:3px;margin:5px 0;}
.entry-foot .mhot,.entry-foot.allhot{display:none;}

原文:http://www.xiaorsz.com/jquery-realize-tab-switch-effect/

WordPress主題的jQuery應用之幻燈片效果

首先在header.php的head標簽中加載jQuery庫

1
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>

新建一個JS文件,在header.php的head標簽中加載,JS文件中加入下例代碼:

1
2
3
4
5
6
7
8
9
10
11
12
13
function slideSwitch() {
var $current = $("#slideshow div.current");
if ( $current.length == 0 ) $current = $("#slideshow div:last");
var $next = $current.next().length ? $current.next() : $("#slideshow div:first");
$current.addClass('prev');
$next.css({opacity: 0.0}).addClass("current").animate({opacity: 1.0}, 1000, function() {
$current.removeClass("current prev");
});
} $(function() {
$("#slideshow span").css("opacity","0.7");
$(".current").css("opacity","1.0");
setInterval( "slideSwitch()", 3000 );
});

HTML代碼如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div ID="slideshow">
    <div class="current">
        <a href="http://www.jssanhong.com/"><img src="1.jpg" alt="" /></a>
        <span>The First Image</span>
    </div>
    <div>
        <a href="http://www.jssanhong.com/"><img src="2.jpg" alt="" /></a>
        <span>The Second Image</span>
    </div>
    <div>
        <a href="http://www.jssanhong.com/"><img src="3.jpg" alt="" /></a>
        <span>Yes, thd third.</span>
    </div>
</div>

添加CSS代碼如下:

1
2
3
4
5
6
#slideshow{position:relative;height:195px;width:425px;border:10px solid #ddd;margin:0 auto 15px;}
#slideshow div{position:absolute;top:0;left:0;z-index:3;opacity:0.0;height:195px;overflow:hidden;background-color:#FFF;}
#slideshow div.current{z-index:5;}
#slideshow div.prev{z-index:4;}
#slideshow div img{display:block;border:0;margin-bottom:10px;}
#slideshow div span{display:none;position:absolute;bottom:0;left:0;height:50px;line-height:50px;background:#000;color:#fff;width:100%;}

原文:http://www.happinesz.cn/archives/1015/

WordPress主題的jQuery應用之返回頂部滑動效果

首先在header.php的head標簽中加載jQuery庫

1
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>

新建一個JS文件,在header.php的head標簽中加載,JS文件中加入下例代碼:

1
2
$('.top').click(function(){$('html,body').animate({scrollTop: '0px'}, 800);});
$('.bot').click(function(){$('html,body').animate({scrollTop:$('#footer').offset().top}, 800);});

在footer.php文件中加入代碼:

1
2
3
4
<div ID="goto">
    <div class="top">頂端</div>
    <div class="bot">底端</div>
</div>

在CSS文件中添加下例代碼:

1
2
3
4
5
*html #goto { position: absolute; top: expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight/2));}
#goto { position: fixed; left: 50%; top: 50%; bottom: auto; margin-left: -500px; z-index: 999;}
#goto .top, #goto .bot { width: 28px; height: 41px; margin: 5px 0; background-image: url('images/goto.gif'); background-repeat: no-repeat; display: block; text-indent: -9999px; cursor: pointer;}
#goto .top { background-position: 0 0;}
#goto .bot { background-position: 0 100%;}

原文:http://immmmm.com/added-sliding-effect-enhanced.html

WordPress主題的jQuery應用之標題提示

首先在header.php的head標簽中加載jQuery庫

1
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>

新建一個JS文件,在header.php的head標簽中加載,JS文件中加入下例代碼:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var sweetTitles = {
    x : 10,                            
    y : 20,                            
    tipElements : "a",                 
    init : function() {
        $(this.tipElements).mouseover(function(e){
            this.myTitle = this.title;
            this.myHref = this.href;
            this.myHref = (this.myHref.length > 30 ? this.myHref.toString().substring(0,30)+"..." : this.myHref);       // url 超過 30 個字符的部分用 ... 代替
            this.title = "";
            var tooltip = "<div id='tooltip'><p>"+this.myTitle+"<em>"+this.myHref+"</em>"+"</p></div>";
            $('body').append(tooltip);
            $('#tooltip')
                .css({
                    "opacity":"0.8",                   // 0.8 為透明度可自行根據喜好調整數字
                    "top":(e.pageY+20)+"px",
                    "left":(e.pageX+10)+"px"
                }).show('fast');   
        }).mouseout(function(){
            this.title = this.myTitle;
            $('#tooltip').remove();
        }).mousemove(function(e){
            $('#tooltip')
            .css({
                "top":(e.pageY+20)+"px",
                "left":(e.pageX+10)+"px"
            });
        });
    }
};
$(function(){
    sweetTitles.init();
});

在CSS文件中添加下例代碼:

1
2
3
body div#tooltip { position:absolute;z-index:1000;max-width:220px;width:auto !important;width:220px;background:#000;text-align:left;padding:5px;min-height:1em;}
body div#tooltip p { margin:0;padding:0;color:#fff;font:12px verdana,arial,sans-serif; }
body div#tooltip p em { display:block;margin-top:3px;color:#f60;font-style:normal;font-weight:bold; }

如果你還用了@回復這樣的jQuery提示效果的話會被標題提示遮掉,可以參照下面解決:
代碼中的tipElements : “a”改成tipElements : “a:not(‘.atreply’)”來排除class為atreply的a標簽,或者用tipElements : “a:not([href^=’#’])”來排除href為錨點的a標簽

原文:http://leeiio.me/sweet-titles-for-jquery/

江陰印刷網新版風格

其實江陰印刷網換上新風格有一段時間了,只是首頁的JS幻燈片一直沒有完成。今天總算找到了一個,換上了。

風格仿的是Discuz的Supesite的默認風格,支持二級分類,后臺自定義MEAT,廣告,統計代碼等。

主題要改的地方是index.php文件的array(1,3,4,5,6,7),把里面的數字改成你想顯示的分類ID號,幻燈片是自動讀取文章中的圖片,演示中最下面的最新圖片是用advanced-post-image做的(注意:這個插件要求在你的uploads目錄下建立thumb目錄及寫入權限)

下載:CMS THEME NO.1
截圖
jyprint

在用的WP風格

沒什么技術含量的,都是東抄西借,想名字也麻煩,就直接用縮寫命名了(Blog Theme No. 1),主題側欄支持 WordPress 自帶的 Widgets 功能。
后臺可自定義關鍵,Meta,可選顯示頁面或分類,可用Google自定義搜索,帶公告欄(在博客首頁的文章區域上方顯示),自主義側欄RSS訂閱地址,可選顯示廣告,可選顯示備案和統計。

btn1

下載:btn1