B2-1index.php

首先我们可以先看一下b2的整个文件夹结构。

一、整个b2文件夹下,除了根目录下的很多文件外,还有两个文件夹(b2-img、b2-include)。整个b2文件夹中的php、html、css、javascript文件都处于b2根目录和b2-include目录中。而余下的图片都处于b2-img文件夹中。整个b2文件夹解压后,一共524kb。

<!--more-->

(1)b2根目录

<img class="alignnone size-full wp-image-69" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE-INCLUDE1.png" alt="" width="1176" height="417" />

(2)下面是b2-include文件夹里的文件。

<img class="alignnone size-full wp-image-70" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE-INCLUDE.png" alt="" width="1187" height="149" />

(3)接下来,我们看一下b2-img里面的内容。

<img class="alignnone size-full wp-image-68" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE.png" alt="" width="1190" height="426" />

(3.1)包含一些小图标和smiles文件夹

<img class="alignnone size-full wp-image-71" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE-IMG.png" alt="" width="1179" height="181" />

(3.2)smiles文件夹中内容。

<img class="alignnone size-full wp-image-72" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE-IMG-SMILE.png" alt="" width="1192" height="338" />

&nbsp;

关于B2,小木建站为您讲解的第一个文件是index.php。

这是整个b2博客系统的入口文件。即博客的首页。

我们将整个过程分为四步:原文件展示(0index_original.php)、注释版本展示(1index_annotate.php)、静态页面展示(2index_static-xiaomuweb-0.0.1)、模拟动态页面展示(3index_dynamic-xiaomuweb-0.0.1)。

我们将这些文件进行了打包,命名为1index-xiaomuweb-0.0.1.rar。1表示这是第一个文件,index是这个文件的名称。xiaomuweb是表明这是我们进行了注解之后的,0.01表明了这个文件的版本号。在之后的其他文件的讲解中(如blog.header.php),如果有些功能是会在index.php中使用的,我们会在之后的版本如1index-xiaomuweb-0.0.2.rar中加入该功能。在最后一个文件的讲解中,我们会将这些文件全部整合起来。由于有些函数在PHP中已经过期了。所以我们会加入新的函数,来

首先我们可以先看一下b2的整个文件夹结构。

一、整个b2文件夹下,除了根目录下的很多文件外,还有两个文件夹(b2-img、b2-include)。整个b2文件夹中的php、html、css、javascript文件都处于b2根目录和b2-include目录中。而余下的图片都处于b2-img文件夹中。整个b2文件夹解压后,一共524kb。

<!--more-->

(1)b2根目录

<img class="alignnone size-full wp-image-69" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE-INCLUDE1.png" alt="" width="1176" height="417" />

(2)下面是b2-include文件夹里的文件。

<img class="alignnone size-full wp-image-70" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE-INCLUDE.png" alt="" width="1187" height="149" />

(3)接下来,我们看一下b2-img里面的内容。

<img class="alignnone size-full wp-image-68" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE.png" alt="" width="1190" height="426" />

(3.1)包含一些小图标和smiles文件夹

<img class="alignnone size-full wp-image-71" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE-IMG.png" alt="" width="1179" height="181" />

(3.2)smiles文件夹中内容。

<img class="alignnone size-full wp-image-72" src="http://www.xiaomuweb.com/wp-content/uploads/2017/08/B2FILE-IMG-SMILE.png" alt="" width="1192" height="338" />

&nbsp;

关于B2,小木建站为您讲解的第一个文件是index.php。

这是整个b2博客系统的入口文件。即博客的首页。

我们将整个过程分为四步:原文件展示(0index_original.php)、注释版本展示(1index_annotate.php)、静态页面展示(2index_static-xiaomuweb-0.0.1)、模拟动态页面展示(3index_dynamic-xiaomuweb-0.0.1)。

我们将这些文件进行了打包,命名为1index-xiaomuweb-0.0.1.rar。1表示这是第一个文件,index是这个文件的名称。xiaomuweb是表明这是我们进行了注解之后的,0.01表明了这个文件的版本号。在之后的其他文件的讲解中(如blog.header.php),如果有些功能是会在index.php中使用的,我们会在之后的版本如1index-xiaomuweb-0.0.2.rar中加入该功能。在最后一个文件的讲解中,我们会将这些文件全部整合起来。由于有些函数在PHP中已经过期了。所以我们会加入新的函数,来完成相同的功能。(如用PDO来完成mysql的功能。)

静态页面就是html功能的页面,可以直接用谷歌或火狐浏览器打开。模拟动态页面是具有php功能的页面。我们在建好b2所用的数据库后,将数据库中的内容输出到index.php中的页面。换言之,我们用静态页面展示这个博客首页的样子,用动态页面模拟达到这个效果。

至于,如何建立数据库,我们在下一个文件(b2install)中进行讲解。

所有这个系列的文件,可以在这里进行下载:https://github.com/xiaomuweb/b2unfold.git

首先,打开0index_original.php。(也就是b2中原来的index文件。)我们会看到以下的内容。

&nbsp;

<div style="width: 650px; height: 500px; overflow: auto;">

<div id="highlighter_634988" class="syntaxhighlighter xml">

<div class="toolbar"><a class="toolbar_item command_help help" href="#">?</a></div>

<table border="0" cellspacing="0" cellpadding="0">

<tbody>

<tr>

<td class="gutter">

<div class="line number1 index0 alt2">1</div>

<div class="line number2 index1 alt1">2</div>

<div class="line number3 index2 alt2">3</div>

<div class="line number4 index3 alt1">4</div>

<div class="line number5 index4 alt2">5</div>

<div class="line number6 index5 alt1">6</div>

<div class="line number7 index6 alt2">7</div>

<div class="line number8 index7 alt1">8</div>

<div class="line number9 index8 alt2">9</div>

<div class="line number10 index9 alt1">10</div>

<div class="line number11 index10 alt2">11</div>

<div class="line number12 index11 alt1">12</div>

<div class="line number13 index12 alt2">13</div>

<div class="line number14 index13 alt1">14</div>

<div class="line number15 index14 alt2">15</div>

<div class="line number16 index15 alt1">16</div>

<div class="line number17 index16 alt2">17</div>

<div class="line number18 index17 alt1">18</div>

<div class="line number19 index18 alt2">19</div>

<div class="line number20 index19 alt1">20</div>

<div class="line number21 index20 alt2">21</div>

<div class="line number22 index21 alt1">22</div>

<div class="line number23 index22 alt2">23</div>

<div class="line number24 index23 alt1">24</div>

<div class="line number25 index24 alt2">25</div>

<div class="line number26 index25 alt1">26</div>

<div class="line number27 index26 alt2">27</div>

<div class="line number28 index27 alt1">28</div>

<div class="line number29 index28 alt2">29</div>

<div class="line number30 index29 alt1">30</div>

<div class="line number31 index30 alt2">31</div>

<div class="line number32 index31 alt1">32</div>

<div class="line number33 index32 alt2">33</div>

<div class="line number34 index33 alt1">34</div>

<div class="line number35 index34 alt2">35</div>

<div class="line number36 index35 alt1">36</div>

<div class="line number37 index36 alt2">37</div>

<div class="line number38 index37 alt1">38</div>

<div class="line number39 index38 alt2">39</div>

<div class="line number40 index39 alt1">40</div>

<div class="line number41 index40 alt2">41</div>

<div class="line number42 index41 alt1">42</div>

<div class="line number43 index42 alt2">43</div>

<div class="line number44 index43 alt1">44</div>

<div class="line number45 index44 alt2">45</div>

<div class="line number46 index45 alt1">46</div>

<div class="line number47 index46 alt2">47</div>

<div class="line number48 index47 alt1">48</div>

<div class="line number49 index48 alt2">49</div>

<div class="line number50 index49 alt1">50</div>

<div class="line number51 index50 alt2">51</div>

<div class="line number52 index51 alt1">52</div>

<div class="line number53 index52 alt2">53</div>

<div class="line number54 index53 alt1">54</div>

<div class="line number55 index54 alt2">55</div>

<div class="line number56 index55 alt1">56</div>

<div class="line number57 index56 alt2">57</div>

<div class="line number58 index57 alt1">58</div>

<div class="line number59 index58 alt2">59</div>

<div class="line number60 index59 alt1">60</div>

<div class="line number61 index60 alt2">61</div>

<div class="line number62 index61 alt1">62</div>

<div class="line number63 index62 alt2">63</div>

<div class="line number64 index63 alt1">64</div>

<div class="line number65 index64 alt2">65</div>

<div class="line number66 index65 alt1">66</div>

<div class="line number67 index66 alt2">67</div>

<div class="line number68 index67 alt1">68</div>

<div class="line number69 index68 alt2">69</div>

<div class="line number70 index69 alt1">70</div>

<div class="line number71 index70 alt2">71</div>

<div class="line number72 index71 alt1">72</div>

<div class="line number73 index72 alt2">73</div>

<div class="line number74 index73 alt1">74</div>

<div class="line number75 index74 alt2">75</div>

<div class="line number76 index75 alt1">76</div>

<div class="line number77 index76 alt2">77</div>

<div class="line number78 index77 alt1">78</div>

<div class="line number79 index78 alt2">79</div>

<div class="line number80 index79 alt1">80</div>

<div class="line number81 index80 alt2">81</div>

<div class="line number82 index81 alt1">82</div>

<div class="line number83 index82 alt2">83</div>

<div class="line number84 index83 alt1">84</div>

<div class="line number85 index84 alt2">85</div>

<div class="line number86 index85 alt1">86</div>

<div class="line number87 index86 alt2">87</div>

<div class="line number88 index87 alt1">88</div>

<div class="line number89 index88 alt2">89</div>

<div class="line number90 index89 alt1">90</div>

<div class="line number91 index90 alt2">91</div>

<div class="line number92 index91 alt1">92</div>

<div class="line number93 index92 alt2">93</div>

<div class="line number94 index93 alt1">94</div>

<div class="line number95 index94 alt2">95</div>

<div class="line number96 index95 alt1">96</div>

<div class="line number97 index96 alt2">97</div>

<div class="line number98 index97 alt1">98</div>

<div class="line number99 index98 alt2">99</div>

<div class="line number100 index99 alt1">100</div>

<div class="line number101 index100 alt2">101</div>

<div class="line number102 index101 alt1">102</div>

<div class="line number103 index102 alt2">103</div>

<div class="line number104 index103 alt1">104</div>

<div class="line number105 index104 alt2">105</div>

<div class="line number106 index105 alt1">106</div>

<div class="line number107 index106 alt2">107</div>

<div class="line number108 index107 alt1">108</div>

<div class="line number109 index108 alt2">109</div>

<div class="line number110 index109 alt1">110</div>

<div class="line number111 index110 alt2">111</div>

<div class="line number112 index111 alt1">112</div>

<div class="line number113 index112 alt2">113</div>

<div class="line number114 index113 alt1">114</div>

<div class="line number115 index114 alt2">115</div>

<div class="line number116 index115 alt1">116</div>

<div class="line number117 index116 alt2">117</div>

<div class="line number118 index117 alt1">118</div>

<div class="line number119 index118 alt2">119</div>

<div class="line number120 index119 alt1">120</div>

<div class="line number121 index120 alt2">121</div>

<div class="line number122 index121 alt1">122</div>

<div class="line number123 index122 alt2">123</div>

<div class="line number124 index123 alt1">124</div>

<div class="line number125 index124 alt2">125</div></td>

<td class="code">

<div class="container">

<div class="line number1 index0 alt2"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">/* Don't remove this line, it calls the b2 function files ! */ $</code><code class="xml color1">blog</code><code class="xml plain">=</code><code class="xml string">1</code><code class="xml plain">; include ("blog.header.php"); ?&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"</code></div>

<div class="line number2 index1 alt1"><code class="xml spaces">    </code><code class="xml plain">"<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"&gt;</code></div>

<div class="line number3 index2 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">html</code> <code class="xml color1">xmlns</code><code class="xml plain">=</code><code class="xml string">"<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"</code><code class="xml plain">&gt;</code></div>

<div class="line number4 index3 alt1"><code class="xml spaces"> </code><code class="xml plain">layout credits goto <a href="http://bluerobot.com/web/layouts/layout2.html --">http://bluerobot.com/web/layouts/layout2.html --</a>&gt;</code></div>

<div class="line number5 index4 alt2"></div>

<div class="line number6 index5 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">head</code><code class="xml plain">&gt;</code></div>

<div class="line number7 index6 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">title</code><code class="xml plain">&gt;&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">bloginfo('name') ?&gt;&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">single_post_title(' :: ') ?&gt;&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">single_cat_title(' :: ') ?&gt;&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">single_month_title(' :: ') ?&gt;&lt;/</code><code class="xml keyword">title</code><code class="xml plain">&gt;</code></div>

<div class="line number8 index7 alt1"></div>

<div class="line number9 index8 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">meta</code> <code class="xml color1">http-equiv</code><code class="xml plain">=</code><code class="xml string">"Content-Type"</code> <code class="xml color1">content</code><code class="xml plain">=</code><code class="xml string">"text/html; charset=iso-8859-1"</code> <code class="xml plain">/&gt;</code></div>

<div class="line number10 index9 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">meta</code> <code class="xml color1">http-equiv</code><code class="xml plain">=</code><code class="xml string">"reply-to"</code> <code class="xml plain">content="&lt;?php bloginfo('admin_email'); ?&gt;" /&gt;</code></div>

<div class="line number11 index10 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">meta</code> <code class="xml color1">http-equiv</code><code class="xml plain">=</code><code class="xml string">"imagetoolbar"</code> <code class="xml color1">content</code><code class="xml plain">=</code><code class="xml string">"no"</code> <code class="xml plain">/&gt;</code></div>

<div class="line number12 index11 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">meta</code> <code class="xml color1">content</code><code class="xml plain">=</code><code class="xml string">"TRUE"</code> <code class="xml color1">name</code><code class="xml plain">=</code><code class="xml string">"MSSmartTagsPreventParsing"</code> <code class="xml plain">/&gt;</code></div>

<div class="line number13 index12 alt2"></div>

<div class="line number14 index13 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">style</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"text/css"</code> <code class="xml color1">media</code><code class="xml plain">=</code><code class="xml string">"screen"</code><code class="xml plain">&gt;</code></div>

<div class="line number15 index14 alt2"><code class="xml plain">@import url( layout2b.css );</code></div>

<div class="line number16 index15 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">style</code><code class="xml plain">&gt;</code></div>

<div class="line number17 index16 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">link</code> <code class="xml color1">rel</code><code class="xml plain">=</code><code class="xml string">"stylesheet"</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"text/css"</code> <code class="xml color1">media</code><code class="xml plain">=</code><code class="xml string">"print"</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"print.css"</code> <code class="xml plain">/&gt;</code></div>

<div class="line number18 index17 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">link</code> <code class="xml color1">rel</code><code class="xml plain">=</code><code class="xml string">"alternate"</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"application/rdf+xml"</code> <code class="xml color1">title</code><code class="xml plain">=</code><code class="xml string">"RDF"</code> <code class="xml plain">href="&lt;?php bloginfo('rdf_url'); ?&gt;" /&gt;</code></div>

<div class="line number19 index18 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">link</code> <code class="xml color1">rel</code><code class="xml plain">=</code><code class="xml string">"alternate"</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"application/rss+xml"</code> <code class="xml color1">title</code><code class="xml plain">=</code><code class="xml string">"RSS"</code> <code class="xml plain">href="&lt;?php bloginfo('rss2_url'); ?&gt;" /&gt;</code></div>

<div class="line number20 index19 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">link</code> <code class="xml color1">rel</code><code class="xml plain">=</code><code class="xml string">"pingback"</code> <code class="xml plain">href="&lt;?php bloginfo('pingback_url'); ?&gt;" /&gt;</code></div>

<div class="line number21 index20 alt2"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">comments_popup_script() ?&gt;</code></div>

<div class="line number22 index21 alt1"></div>

<div class="line number23 index22 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">head</code><code class="xml plain">&gt;</code></div>

<div class="line number24 index23 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">body</code><code class="xml plain">&gt;</code></div>

<div class="line number25 index24 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">div</code> <code class="xml color1">id</code><code class="xml plain">=</code><code class="xml string">"header"</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">""</code> <code class="xml plain">title="&lt;?php bloginfo('name'); ?&gt;"&gt;&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">bloginfo('name'); ?&gt;&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;&lt;/</code><code class="xml keyword">div</code><code class="xml plain">&gt;</code></div>

<div class="line number26 index25 alt1"></div>

<div class="line number27 index26 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">div</code> <code class="xml color1">id</code><code class="xml plain">=</code><code class="xml string">"content"</code><code class="xml plain">&gt;</code></div>

<div class="line number28 index27 alt1"></div>

<div class="line number29 index28 alt2"></div>

<div class="line number30 index29 alt1"><code class="xml comments">&lt;!-- // b2 loop start --&gt;</code></div>

<div class="line number31 index30 alt2"><code class="xml spaces">    </code><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">while($row = mysql_fetch_object($result)) { start_b2(); ?&gt;</code></div>

<div class="line number32 index31 alt1"></div>

<div class="line number33 index32 alt2"></div>

<div class="line number34 index33 alt1"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">the_date("","&lt;h2&gt;","&lt;/</code><code class="xml keyword">h2</code><code class="xml plain">&gt;"); ?&gt;</code></div>

<div class="line number35 index34 alt2"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">permalink_anchor(); ?&gt;</code></div>

<div class="line number36 index35 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">div</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"storyTitle"</code><code class="xml plain">&gt;&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">the_title(); ?&gt;</code></div>

<div class="line number37 index36 alt2"><code class="xml spaces">   </code><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml plain">href="?cat=&lt;?php the_category_ID() ?&gt;" title="category: &lt;?</code><code class="xml keyword">php</code> <code class="xml plain">the_category() ?&gt;"&gt;&lt;</code><code class="xml keyword">span</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"storyCategory"</code><code class="xml plain">&gt;[&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">the_category() ?&gt;]&lt;/</code><code class="xml keyword">span</code><code class="xml plain">&gt;&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;&amp;nbsp;-&amp;nbsp;</code></div>

<div class="line number38 index37 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">span</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"storyAuthor"</code><code class="xml plain">&gt;&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">the_author() ?&gt; - &lt;?</code><code class="xml keyword">php</code> <code class="xml plain">the_author_email() ?&gt;&lt;/</code><code class="xml keyword">span</code><code class="xml plain">&gt; @ &lt;</code><code class="xml keyword">a</code> <code class="xml plain">href="&lt;?php permalink_link() ?&gt;"&gt;&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">the_time() ?&gt;&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;</code></div>

<div class="line number39 index38 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">div</code><code class="xml plain">&gt;</code></div>

<div class="line number40 index39 alt1"></div>

<div class="line number41 index40 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">div</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"storyContent"</code><code class="xml plain">&gt;</code></div>

<div class="line number42 index41 alt1"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">the_content(); ?&gt;</code></div>

<div class="line number43 index42 alt2"></div>

<div class="line number44 index43 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">div</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"rightFlush"</code><code class="xml plain">&gt;</code></div>

<div class="line number45 index44 alt2"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">link_pages("&lt;br /&gt;Pages: ","&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;","number") ?&gt; </code></div>

<div class="line number46 index45 alt1"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">comments_popup_link("Comments (0)", "Comments (1)", "Comments (%)") ?&gt; </code></div>

<div class="line number47 index46 alt2"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">trackback_popup_link("TrackBack (0)", "TrackBack (1)", "TrackBack (%)") ?&gt; </code></div>

<div class="line number48 index47 alt1"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">pingback_popup_link("PingBack (0)", "PingBack (1)", "PingBack (%)") ?&gt;</code></div>

<div class="line number49 index48 alt2"></div>

<div class="line number50 index49 alt1"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">trackback_rdf() ?&gt;</code></div>

<div class="line number51 index50 alt2"></div>

<div class="line number52 index51 alt1"><code class="xml comments">&lt;!-- this includes the comments and a form to add a new comment --&gt;</code></div>

<div class="line number53 index52 alt2"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">include ("b2comments.php"); ?&gt;</code></div>

<div class="line number54 index53 alt1"></div>

<div class="line number55 index54 alt2"><code class="xml comments">&lt;!-- this includes the trackbacks --&gt;</code></div>

<div class="line number56 index55 alt1"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">include ("b2trackback.php"); ?&gt;</code></div>

<div class="line number57 index56 alt2"></div>

<div class="line number58 index57 alt1"><code class="xml comments">&lt;!-- this includes the pingbacks --&gt;</code></div>

<div class="line number59 index58 alt2"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">include ("b2pingbacks.php"); ?&gt;</code></div>

<div class="line number60 index59 alt1"></div>

<div class="line number61 index60 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">div</code><code class="xml plain">&gt;</code></div>

<div class="line number62 index61 alt1"></div>

<div class="line number63 index62 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">div</code><code class="xml plain">&gt;</code></div>

<div class="line number64 index63 alt1"></div>

<div class="line number65 index64 alt2"></div>

<div class="line number66 index65 alt1"><code class="xml comments">&lt;!-- // this is just the end of the motor - don't touch that line either :) --&gt;</code></div>

<div class="line number67 index66 alt2"><code class="xml spaces">    </code><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">} ?&gt; </code></div>

<div class="line number68 index67 alt1"></div>

<div class="line number69 index68 alt2"></div>

<div class="line number70 index69 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">div</code><code class="xml plain">&gt;</code></div>

<div class="line number71 index70 alt2"></div>

<div class="line number72 index71 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">p</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"centerP"</code><code class="xml plain">&gt;&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">timer_stop(1); ?&gt;</code></div>

<div class="line number73 index72 alt2"><code class="xml plain">[powered by &lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"<a href="http://cafelog.com">http://cafelog.com</a>"</code> <code class="xml color1">target</code><code class="xml plain">=</code><code class="xml string">"_blank"</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">b</code><code class="xml plain">&gt;b2&lt;/</code><code class="xml keyword">b</code><code class="xml plain">&gt;&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;.]</code></div>

<div class="line number74 index73 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">p</code><code class="xml plain">&gt;</code></div>

<div class="line number75 index74 alt2"></div>

<div class="line number76 index75 alt1"></div>

<div class="line number77 index76 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">div</code> <code class="xml color1">id</code><code class="xml plain">=</code><code class="xml string">"menu"</code><code class="xml plain">&gt;</code></div>

<div class="line number78 index77 alt1"></div>

<div class="line number79 index78 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">h4</code><code class="xml plain">&gt;quick links:&lt;/</code><code class="xml keyword">h4</code><code class="xml plain">&gt;</code></div>

<div class="line number80 index79 alt1"></div>

<div class="line number81 index80 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"<a href="http://www.cafelog.com">http://www.cafelog.com</a>"</code> <code class="xml color1">title</code><code class="xml plain">=</code><code class="xml string">"b2's homepage"</code><code class="xml plain">&gt;cafelog.com&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number82 index81 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"<a href="http://some other site">http://some other site</a>"</code> <code class="xml color1">title</code><code class="xml plain">=</code><code class="xml string">"another link"</code><code class="xml plain">&gt;another link&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number83 index82 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"<a href="http://some other site">http://some other site</a>"</code> <code class="xml color1">title</code><code class="xml plain">=</code><code class="xml string">"another link"</code><code class="xml plain">&gt;another link&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number84 index83 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"<a href="http://some other site">http://some other site</a>"</code> <code class="xml color1">title</code><code class="xml plain">=</code><code class="xml string">"another link"</code><code class="xml plain">&gt;another link&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number85 index84 alt2"></div>

<div class="line number86 index85 alt1"></div>

<div class="line number87 index86 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">h4</code><code class="xml plain">&gt;categories:&lt;/</code><code class="xml keyword">h4</code><code class="xml plain">&gt;</code></div>

<div class="line number88 index87 alt1"></div>

<div class="line number89 index88 alt2"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">list_cats(0, 'All', 'name'); ?&gt;</code></div>

<div class="line number90 index89 alt1"></div>

<div class="line number91 index90 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">h4</code><code class="xml plain">&gt;search:&lt;/</code><code class="xml keyword">h4</code><code class="xml plain">&gt;</code></div>

<div class="line number92 index91 alt1"></div>

<div class="line number93 index92 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">form</code> <code class="xml color1">name</code><code class="xml plain">=</code><code class="xml string">"searchform"</code> <code class="xml color1">method</code><code class="xml plain">=</code><code class="xml string">"get"</code> <code class="xml color1">action</code><code class="xml plain">=</code><code class="xml string">"&lt;?php echo $PHP_SELF; /*$siteurl."</code><code class="xml plain">/".$blogfilename*/ ?&gt;"&gt;</code></div>

<div class="line number94 index93 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">p</code><code class="xml plain">&gt;</code></div>

<div class="line number95 index94 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">input</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"text"</code> <code class="xml color1">name</code><code class="xml plain">=</code><code class="xml string">"s"</code> <code class="xml color1">size</code><code class="xml plain">=</code><code class="xml string">"15"</code> <code class="xml plain">/&gt;&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number96 index95 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">input</code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"submit"</code> <code class="xml color1">name</code><code class="xml plain">=</code><code class="xml string">"submit"</code> <code class="xml color1">value</code><code class="xml plain">=</code><code class="xml string">"search"</code> <code class="xml plain">/&gt;</code></div>

<div class="line number97 index96 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">p</code><code class="xml plain">&gt;</code></div>

<div class="line number98 index97 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">form</code><code class="xml plain">&gt;</code></div>

<div class="line number99 index98 alt2"></div>

<div class="line number100 index99 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">h4</code><code class="xml plain">&gt;archives:&lt;/</code><code class="xml keyword">h4</code><code class="xml plain">&gt;</code></div>

<div class="line number101 index100 alt2"></div>

<div class="line number102 index101 alt1"><code class="xml plain">&lt;?</code><code class="xml keyword">php</code> <code class="xml plain">include("b2archives.php"); ?&gt;</code></div>

<div class="line number103 index102 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number104 index103 alt1"></div>

<div class="line number105 index104 alt2"></div>

<div class="line number106 index105 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">h4</code><code class="xml plain">&gt;other:&lt;/</code><code class="xml keyword">h4</code><code class="xml plain">&gt;</code></div>

<div class="line number107 index106 alt2"></div>

<div class="line number108 index107 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"b2login.php"</code><code class="xml plain">&gt;login&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number109 index108 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"b2register.php"</code><code class="xml plain">&gt;register&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number110 index109 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number111 index110 alt2"></div>

<div class="line number112 index111 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"b2rss.php"</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">img</code> <code class="xml color1">src</code><code class="xml plain">=</code><code class="xml string">"b2-img/xml.gif"</code> <code class="xml color1">alt</code><code class="xml plain">=</code><code class="xml string">"view this weblog as RSS !"</code> <code class="xml color1">width</code><code class="xml plain">=</code><code class="xml string">"36"</code> <code class="xml color1">height</code><code class="xml plain">=</code><code class="xml string">"14"</code> <code class="xml color1">border</code><code class="xml plain">=</code><code class="xml string">"0"</code>  <code class="xml plain">/&gt;&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">br</code> <code class="xml plain">/&gt;</code></div>

<div class="line number113 index112 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"<a href="http://validator.w3.org/check/referer">http://validator.w3.org/check/referer</a>"</code> <code class="xml color1">title</code><code class="xml plain">=</code><code class="xml string">"this page validates as XHTML 1.0 Transitional"</code><code class="xml plain">&gt;&lt;</code><code class="xml keyword">img</code> <code class="xml color1">src</code><code class="xml plain">=</code><code class="xml string">"<a href="http://www.w3.org/Icons/valid-xhtml10.gif">http://www.w3.org/Icons/valid-xhtml10.gif</a>"</code> <code class="xml color1">alt</code><code class="xml plain">=</code><code class="xml string">"Valid XHTML 1.0!"</code> <code class="xml color1">height</code><code class="xml plain">=</code><code class="xml string">"31"</code> <code class="xml color1">width</code><code class="xml plain">=</code><code class="xml string">"88"</code> <code class="xml color1">border</code><code class="xml plain">=</code><code class="xml string">"0"</code> <code class="xml plain">/&gt;&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;</code></div>

<div class="line number114 index113 alt1"></div>

<div class="line number115 index114 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">div</code><code class="xml plain">&gt;</code></div>

<div class="line number116 index115 alt1"></div>

<div class="line number117 index116 alt2"><code class="xml plain">&lt;</code><code class="xml keyword">div</code> <code class="xml color1">id</code><code class="xml plain">=</code><code class="xml string">"chaff"</code><code class="xml plain">&gt;</code></div>

<div class="line number118 index117 alt1"><code class="xml plain">&lt;</code><code class="xml keyword">a</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"mailto:[email protected][127.0.0.1]"</code> <code class="xml color1">title</code><code class="xml plain">=</code><code class="xml string">"anti [email protected] addrss"</code><code class="xml plain">&gt;4 [email protected] e-mail me&lt;/</code><code class="xml keyword">a</code><code class="xml plain">&gt;</code></div>

<div class="line number119 index118 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">div</code><code class="xml plain">&gt;</code></div>

<div class="line number120 index119 alt1"><code class="xml comments">&lt;!-- BlueRobot was here. --&gt;</code></div>

<div class="line number121 index120 alt2"><code class="xml plain">&lt;/</code><code class="xml keyword">body</code><code class="xml plain">&gt;</code></div>

<div class="line number122 index121 alt1"><code class="xml plain">&lt;/</code><code class="xml keyword">html</code><code class="xml plain">&gt;</code></div>

<div class="line number123 index122 alt2"></div>

<div class="line number124 index123 alt1"></div>

<div class="line number125 index124 alt2"><code class="xml spaces">   </code></div>

</div></td>

</tr>

</tbody>

</table>

</div>

</div>

&nbsp;

我们可以看到,这个文件中主要是html与php的一个混排。html主要完成界面展示,而php主要完成向这个界面中填充实体数据。

我们对这个文件进行了注释。

打开1index_annotate.php可以看到我们的注释。

&nbsp;

<div style="width: 650px; height: 500px; overflow: auto;">

<div id="highlighter_598853" class="syntaxhighlighter xml">

<div class="toolbar"><a class="toolbar_item command_help help" href="#">?</a></div>

<table border="0" cellspacing="0" cellpadding="0">

<tbody>

<tr>

<td class="gutter">

<div class="line number1 index0 alt2">1</div>

<div class="line number2 index1 alt1">2</div>

<div class="line number3 index2 alt2">3</div>

<div class="line number4 index3 alt1">4</div>

<div class="line number5 index4 alt2">5</div>

<div class="line number6 index5 alt1">6</div>

<div class="line number7 index6 alt2">7</div>

<div class="line number8 index7 alt1">8</div>

<div class="line number9 index8 alt2">9</div>

<div class="line number10 index9 alt1">10</div>

<div class="line number11 index10 alt2">11</div>

<div class="line number12 index11 alt1">12</div>

<div class="line number13 index12 alt2">13</div>

<div class="line number14 index13 alt1">14</div>

<div class="line number15 index14 alt2">15</div>

<div class="line number16 index15 alt1">16</div>

<div class="line number17 index16 alt2">17</div>

<div class="line number18 index17 alt1">18</div>

<div class="line number19 index18 alt2">19</div>

<div class="line number20 index19 alt1">20</div>

<div class="line number21 index20 alt2">21</div>

<div class="line number22 index21 alt1">22</div>

<div class="line number23 index22 alt2">23</div>

<div class="line number24 index23 alt1">24</div>

<div class="line number25 index24 alt2">25</div>

<div class="line number26 index25 alt1">26</div>

<div class="line number27 index26 alt2">27</div>

<div class="line number28 index27 alt1">28</div>

<div class="line number29 index28 alt2">29</div>

<div class="line number30 index29 alt1">30</div>

<div class="line number31 index30 alt2">31</div>

<div class="line number32 index31 alt1">32</div>

<div class="line number33 index32 alt2">33</div>

<div class="line number34 index33 alt1">34</div>

<div class="line number35 index34 alt2">35</div>

<div class="line number36 index35 alt1">36</div>

<div class="line number37 index36 alt2">37</div>

<div class="line number38 index37 alt1">38</div>

<div class="line number39 index38 alt2">39</div>

<div class="line number40 index39 alt1">40</div>

<div class="line number41 index40 alt2">41</div>

<div class="line number42 index41 alt1">42</div>

<div class="line number43 index42 alt2">43</div>

<div class="line number44 index43 alt1">44</div>

<div class="line number45 index44 alt2">45</div>

<div class="line number46 index45 alt1">46</div>

<div class="line number47 index46 alt2">47</div>

<div class="line number48 index47 alt1">48</div>

<div class="line number49 index48 alt2">49</div>

<div class="line number50 index49 alt1">50</div>

<div class="line number51 index50 alt2">51</div>

<div class="line number52 index51 alt1">52</div>

<div class="line number53 index52 alt2">53</div>

<div class="line number54 index53 alt1">54</div>

<div class="line number55 index54 alt2">55</div>

<div class="line number56 index55 alt1">56</div>

<div class="line number57 index56 alt2">57</div>

<div class="line number58 index57 alt1">58</div>

<div class="line number59 index58 alt2">59</div>

<div class="line number60 index59 alt1">60</div>

<div class="line number61 index60 alt2">61</div>

<div class="line number62 index61 alt1">62</div>

<div class="line number63 index62 alt2">63</div>

<div class="line number64 index63 alt1">64</div>

<div class="line number65 index64 alt2">65</div>

<div class="line number66 index65 alt1">66</div>

<div class="line number67 index66 alt2">67</div>

<div class="line number68 index67 alt1">68</div>

<div class="line number69 index68 alt2">69</div>

<div class="line number70 index69 alt1">70</div>

<div class="line number71 index70 alt2">71</div>

<div class="line number72 index71 alt1">72</div>

<div class="line number73 index72 alt2">73</div>

<div class="line number74 index73 alt1">74</div>

<div class="line number75 index74 alt2">75</div>

<div class="line number76 index75 alt1">76</div>

<div class="line number77 index76 alt2">77</div>

<div class="line number78 index77 alt1">78</div>

<div class="line number79 index78 alt2">79</div>

<div class="line number80 index79 alt1">80</div>

<div class="line number81 index80 alt2">81</div>

<div class="line number82 index81 alt1">82</div>

<div class="line number83 index82 alt2">83</div>

<div class="line number84 index83 alt1">84</div>

<div class="line number85 index84 alt2">85</div>

<div class="line number86 index85 alt1">86</div>

<div class="line number87 index86 alt2">87</div>

<div class="line number88 index87 alt1">88</div>

<div class="line number89 index88 alt2">89</div>

<div class="line number90 index89 alt1">90</div>

<div class="line number91 index90 alt2">91</div>

<div class="line number92 index91 alt1">92</div>

<div class="line number93 index92 alt2">93</div>

<div class="line number94 index93 alt1">94</div>

<div class="line number95 index94 alt2">95</div>

<div class="line number96 index95 alt1">96</div>

<div class="line number97 index96 alt2">97</div>

<div class="line number98 index97 alt1">98</div>

<div class="line number99 index98 alt2">99</div>

<div class="line number100 index99 alt1">100</div>

<div class="line number101 index100 alt2">101</div>

<div class="line number102 index101 alt1">102</div>

<div class="line number103 index102 alt2">103</div>

<div class="line number104 index103 alt1">104</div>

<div class="line number105 index104 alt2">105</div>

<div class="line number106 index105 alt1">106</div>

<div class="line number107 index106 alt2">107</div>

<div class="line number108 index107 alt1">108</div>

<div class="line number109 index108 alt2">109</div>

<div class="line number110 index109 alt1">110</div>

<div class="line number111 index110 alt2">111</div>

<div class="line number112 index111 alt1">112</div>

<div class="line number113 index112 alt2">113</div>

<div class="line number114 index113 alt1">114</div>

<div class="line number115 index114 alt2">115</div>

<div class="line number116 index115 alt1">116</div>

<div class="line number117 index116 alt2">117</div>

<div class="line number118 index117 alt1">118</div>

<div class="line number119 index118 alt2">119</div>

<div class="line number120 index119 alt1">120</div>

<div class="line number121 index120 alt2">121</div>

<div class="line number122 index121 alt1">122</div>

<div class="line number123 index122 alt2">123</div>

<div class="line number124 index123 alt1">124</div>

<div class="line number125 index124 alt2">125</div>

<div class="line number126 index125 alt1">126</div>

<div class="line number127 index126 alt2">127</div>

<div class="line number128 index127 alt1">128</div>

<div class="line number129 index128 alt2">129</div>

<div cla