改善用户阅读体验(上)

2008年10月14日 02:11  |  分类:wordpress

linuxabc选用的第一款主题是ProSense,虽然号称2007年最佳adsense主题,然而alfie对它还是有诸多不满,因而踏上了优化主题这条不归路,结果,耗费了大量的时间后发现自己根本不是网页设计那块料。术业有专攻,网页漂不漂亮还是留给专业设计师去烦心吧。那就回归到博客的本质,博客就要在互联网上把自己的思想、见解展示给别人看,所以内容才是根本。有了好的内容就要让读者阅读起来舒服,这段时间也试用了不少国外优秀的主题,可惜对中文的展示欠佳,文章阅读起来有些吃力,主要是字体设置过小,于是alfie这两天着手改善文章的阅读体验。

全文阅读 »

这是一个样式测试文章

2008年10月12日 23:40  |  分类:其他

在该文章里面将包括以下要素:

  1. 段落
  2. 链接
  3. 有序序列
  4. 无序序列
  5. 标签
  6. 代码块
  7. 引用块
  8. 标题
一、段落/链接/标签

这是一段文字,对于阿根廷足球来说,结果很重要,但不是最重要的。过程是否优美,才是潘帕斯雄鹰的追求目标。正如阿根廷著名教练巴西莱曾经说过的那样-“我们要赢得的不是世界杯,而是世界。”当阿根廷以6比0的悬殊比分战胜塞黑后,这句话成为了现实。阿根廷在本场较量中,他们所展现的绝不是3分这样一个结果,而是优美古典足球的回归。这种回归对于世界足球来说,是在太重要了。

二、代码块

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
34
35
36
37
38
39
40
41
42
43
44
45
* {
   margin:0;
   padding:0;
   }
 
body,html {
   min-height:101%;
   }
 
body {
   background: #333;
   color: #333;
   padding: 13px 0 25px 0;
   }
 
body, select, input, textarea {
   font: 12px Arial, Verdana, Sans-Serif;
   line-height:1.5em;
   }
 
p {   
   margin: 15px 0;
   }
 
a:link, a:visited {
   color: #333;
   text-decoration:none
   }
 
a:hover, a:active {
   color:#333;
   text-decoration:underline;
   }
 
hr {
   display: block;
   height:1px;
   background:#333;
   border:0;
   }
 
small {
   font-size: 0.9em;
   padding:3px 6px;
   }

三、引用块

这是来自http://wordpress.org/的英文解决方案。

By default, Geshi wraps code blocks in pre tags (header_type = GESHI_HEADER_PRE). In this mode, tabs are not substituted for spaces, so the browser is displaying the tab directly and the width is browser dependent. Personally, I avoid tabs like the plague in my source code, but if you’re not like me, you can try setting the header type to GESHI_HEADER_DIV. For example: …

四、无序序列
  • 如何在Debian中安装QQ?
  • 如何在Debian中安装和配置phpMySQL?

wp-syntax(geshi)使用小技巧

2008年10月12日 21:21  |  分类:wordpress

一般情况下,wp-syntax会自动将代码中的tab设置成8,这对于紧张的网页来说是很浪费的,解决的方法有两种:一种是修改geshi的源代码,另一种是用文本编辑器将代码中的tab转换成空格。

By default, Geshi wraps code blocks in pre tags (header_type = GESHI_HEADER_PRE). In this mode, tabs are not substituted for spaces, so the browser is displaying the tab directly and the width is browser dependent. Personally, I avoid tabs like the plague in my source code, but if you’re not like me, you can try setting the header type to GESHI_HEADER_DIV. For example: http://wordpress.org/support/topic/138861

请对比下面两种效果:

一、tab未转换之前
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
<?php get_header(); ?>
<div id="wrapper">
	<div id="content">
	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<div class="navigation">
			<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
			<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
			<div style="clear:both;"></div>
		</div>
		<div class="post" id="post-<?php the_ID(); ?>">
			<h2><a href="&lt;?php echo get_permalink() ?&gt;" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
		<!-- display the postmetadata -->
		<div class="postmetadata">
      	<?php the_time('Y/m/d') ?>&nbsp;&nbsp;&nbsp;<?php the_tags('Tags: ', ', ', ''); ?>
		</div>
			<div class="entrytext">
				<?php the_content('<p class="serif">阅读全文 &raquo;</p>'); ?>
				<?php if(function_exists('the_ratings')) { echo '<div class="postmetadata p_ratings">评价本文:'; the_ratings(); echo '</div>'; } ?>
				<?php link_pages('<p><strong>页:</strong> ', '</p>', 'number'); ?>
				<div style="clear:both;"></div>
			</div>
		</div>
	<?php include('adsense_singlepost_bottom_square.php') ?>
	<?php comments_template(); ?>
	<?php endwhile; else: ?>
		<p>不好意思,没有找到符合您条件的文章。</p>
<?php endif; ?>
	</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
二、tab转换成空格后
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
<?php get_header(); ?>
<div id="wrapper">
   <div id="content">
   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
      <div class="navigation">
         <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
         <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
         <div style="clear:both;"></div>
      </div>
      <div class="post" id="post-<?php the_ID(); ?>">
         <h2><a href="&lt;?php echo get_permalink() ?&gt;" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
      <!-- display the postmetadata -->
      <div class="postmetadata">
         <?php the_time('Y/m/d') ?>&nbsp;&nbsp;&nbsp;<?php the_tags('Tags: ', ', ', ''); ?>
      </div>
         <div class="entrytext">
            <?php the_content('<p class="serif">阅读全文 &raquo;</p>'); ?>
            <?php if(function_exists('the_ratings')) { echo '<div class="postmetadata p_ratings">评价本文:'; the_ratings(); echo '</div>'; } ?>
            <?php link_pages('<p><strong>页:</strong> ', '</p>', 'number'); ?>
            <div style="clear:both;"></div>
         </div>
      </div>
   <?php include('adsense_singlepost_bottom_square.php') ?>
   <?php comments_template(); ?>
   <?php endwhile; else: ?>
      <p>不好意思,没有找到符合您条件的文章。</p>
<?php endif; ?>
   </div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>

很多文本编辑器都有tab转换空格的功能,alfie用的是UltraEdit-32。

wordpress中代码高亮显示的三种方式

2008年10月11日 01:14  |  分类:其他

由于alfie经常要写技术文档,经常需要在文章中插入代码块,于是比较了几种代码高亮的解决方案。

一、通过style.css格式化代码块

这种方式是最原始的,一般的主题的样式表中都会有都会有类似下面的语句:

code{
    font:1em 'Courier New',Courier,Fixed;
    display:block;
    overflow:auto;
    text-align:left;
    margin: 10px 0;
    padding: 5px 10px;
    background: #FBF5DF;
    border-top: solid 1px #EDE0B3;
    border-bottom: solid 1px #EDE0B3;
}

只需要在代码块前后加上<code> 和</code>就可以在文章中简单的格式化代码块了,不过这种方式比较简陋,仅能实现代码的字体和大小,无法实现关键字高亮、缩进等。效果见上

全文阅读 »

如何正确地配置locale

2008年10月7日 01:19  |  分类:Debian

不知改动了什么,导致每次使用aptitude的时候都会出现如下提示信息:

perl: warning: Setting locale failed .
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US",
        LC_ALL = "en_US",
        LANG = "en_US"
     are supported and installed on your system.

尝试dpkg-reconfigure locales未果,经过水木清华BBS linuxAPP版主Dieken的帮忙,终于解决,步骤如下:

全文阅读 »

Pages: Prev 1 2 3 ...13 14 15 16 17 18 19 20 21 Next