<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>发现网络 &#187; code</title>
	<atom:link href="http://www.refindweb.com/tag/code/feed" rel="self" type="application/rss+xml" />
	<link>http://www.refindweb.com</link>
	<description>发现网络价值 推广网络应用 网络改变生活</description>
	<lastBuildDate>Wed, 14 Apr 2010 07:13:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>教程：轻松为你的博客添加slideshow</title>
		<link>http://www.refindweb.com/2008/08/add-slideshow-for-your-blog.html</link>
		<comments>http://www.refindweb.com/2008/08/add-slideshow-for-your-blog.html#comments</comments>
		<pubDate>Mon, 25 Aug 2008 17:37:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[featured]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://www.refindweb.com/?p=221</guid>
		<description><![CDATA[想为自己的博客也添加一个向本站首页上的一样的slideshow展示模块吗？ <a href="http://www.refindweb.com/2008/08/add-slideshow-for-your-blog.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>想为自己的博客也添加一个向本站首页上的一样的slideshow展示模块吗？其实很简单，只需几步就可以轻松搞定。翻译一篇教程，我就是按照这个教程制作的。</p>
<p>原文链接：<a href="http://www.catswhocode.com/blog/featured/how-to-integrate-a-slideshow-in-your-wordpress-theme-120" target="_blank">How to : Integrate a slideshow in your wordpress theme</a></p>
<div id="attachment_219" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.refindweb.com/wp-content/uploads/2008/08/clip-image00211.jpg"><img class="size-medium wp-image-219" title="clip-image00211" src="http://www.refindweb.com/wp-content/uploads/2008/08/clip-image00211-300x125.jpg" alt="slideshow" width="300" height="125" /></a><p class="wp-caption-text">slideshow</p></div>
<p>你可以在本站首页上看到slideshow的实际效果。</p>
<p><strong>需要什么？</strong></p>
<p>在开始之前我们需要先下载 <a href="http://smoothgallery.jondesign.net/files/SmoothGallery-2.0.zip">SmoothGallery 2.0</a></p>
<p><strong>第一步，将所需文件放到合适的地方。</strong></p>
<p>解压下载到的smoothgallery</p>
<p>将解压得到的css文件夹复制到wordpress目录wp-content/themes/your_theme_name</p>
<p>将scripts文件夹复制到wp-content/themes/your_theme_name</p>
<p>一旦我们完成这一步，我们就有了在博客上运行SmoothGallery的所需效果代码文件</p>
<p>第二步：在博客主模板代码的Header部分添加CSS和script文件的连接，以便在博客页面进行调用</p>
<p>将以下几行代码添加到主模板代码的Header部分</p>
<blockquote><p>&lt;!&#8211;Css SmoothGallery&#8211;&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;&lt;?php bloginfo(&#8216;template_url&#8217;); ?&gt;/css/jd.gallery.css&#8221; type=&#8221;text/css&#8221; media=&#8221;screen&#8221;/&gt;<br />
&lt;!&#8211;JS Mootools&#8211;&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;&lt;?php bloginfo(&#8216;template_url&#8217;); ?&gt;/scripts/mootools.v1.11.js&#8221;&gt;&lt;/script&gt;<br />
&lt;!&#8211;JS SmoothGallery&#8211;&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;&lt;?php bloginfo(&#8216;template_url&#8217;); ?&gt;/scripts/jd.gallery.js&#8221;&gt;&lt;/script&gt;</p></blockquote>
<p>当这一步完成时，你就已经可以在博客主题中使用SmoothGallery了</p>
<p>第三步：在你的主题目录中新建一个文件<strong>gallery.php，这个文件会帮你生成展示</strong><strong>gallery的html代码。</strong></p>
<p>在开始这一步之前，应该认识到<strong>smoothgallery模块的结构</strong></p>
<p><a href="http://www.refindweb.com/wp-content/uploads/2008/08/slideshow.jpg"><img class="aligncenter size-medium wp-image-220" title="slideshow" src="http://www.refindweb.com/wp-content/uploads/2008/08/slideshow-300x185.jpg" alt="" width="300" height="185" /></a></p>
<blockquote><p>&lt;div class=&#8221;imageElement&#8221;&gt;<br />
&lt;h3&gt;Item Title&lt;/h3&gt;<br />
&lt;p&gt;Item Description&lt;/p&gt;<br />
&lt;a href=&#8221;Link to Item &#8221; title=&#8221;open image&#8221; class=&#8221;open&#8221;&gt;&lt;/a&gt;<br />
&lt;img src=&#8221;Image of item&#8221; class=&#8221;full&#8221; alt=&#8221;Item Title&#8221; /&gt;<br />
&lt;img src=&#8221;Thumbmail of item&#8221; class=&#8221;thumbnail&#8221; alt=&#8221;thumbnail of Item Title&#8221; /&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>gallery.php文件包括两部分：<br />
初始化SmoothGallery Script (JS)</p>
<p>为gally生成html/php代码</p>
<p>你可以在这里<a href="http://www.catswhocode.com/blog/wp-content/uploads/gallery.txt">here</a>下载到gallery.php需要这段代码，将代码全部保存到一个新建txt文档中，再保存为gallery.php就可以了。</p>
<blockquote><p>&lt;!&#8211; Initialization of SmoothGallery&#8211;&gt;<br />
&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
function startGallery() {<br />
var myGallery = new gallery($(&#8216;myGallery&#8217;),<br />
{timed: true});}<br />
window.addEvent(&#8216;domready&#8217;,startGallery);<br />
&lt;/script&gt;<br />
&lt;!&#8211; Creation of the html for the gallery &#8211;&gt;<br />
&lt;div class=&#8221;content&#8221;&gt;<br />
&lt;div id=&#8221;myGallery&#8221;&gt;<br />
&lt;!&#8211;<br />
Get the 5 lasts posts of category which ID is 3<br />
(to show the recent post use query_posts(&#8216;showposts=5&#8242;);)<br />
&#8211;&gt;<br />
&lt;?php query_posts(&#8216;showposts=5&amp;cat=3&#8242;);?<br />
&lt;?php while (have_posts()) : the_post(); ?&gt;<br />
&lt;!&#8211;get the custom fields gallery_image<br />
(fields which contains the link to the image to show in the gallery)<br />
&#8211;&gt;<br />
&lt;?php $values = get_post_custom_values(&#8220;gallery_image&#8221;);?&gt;<br />
&lt;!&#8211; Verify if you set the custom field gallery_image for the post &#8211;&gt;<br />
&lt;?php if(isset($values[0]))<br />
{?&gt;<br />
&lt;!–define a gallery element–&gt;<br />
&lt;div class=&#8221;imageElement&#8221;&gt;<br />
&lt;!–post’s title to show for this element–&gt;<br />
&lt;h3&gt;&lt;?php the_title(); ?&gt;&lt;/h3&gt;<br />
&lt;!–post’s excerpt to show for this element–&gt;<br />
&lt;?php the_excerpt(); ?&gt;<br />
&lt;!–Link to the full post–&gt;<br />
&lt;a href=&#8221;&lt;?php the_permalink() ?&gt;&#8221; title=&#8221;Read more&#8221; class=&#8221;open&#8221;&gt;&lt;/a&gt;<br />
&lt;!– Define the image for the gallery –&gt;<br />
&lt;img src=&#8221;&lt;?php echo $values[0]; ?&gt;&#8221; class=&#8221;full&#8221; alt=&#8221;&lt;?php the_title(); ?&gt;&#8221;/&gt;<br />
&lt;!– Define the thumbnail for the gallery –&gt;<br />
&lt;img src=&#8221;&lt;?php echo $values[0]; ?&gt;&#8221; class=&#8221;thumbnail&#8221; alt=&#8221;&lt;?php the_title(); ?&gt;&#8221;/&gt;<br />
&lt;/div&gt;<br />
&lt;?php }?&gt;<br />
&lt;?php endwhile; ?&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;</p>
<p><strong>Fourth step : include the gallery in your theme</strong></p>
<p>第四步：将<strong>gallery放到你的主题中</strong></p>
<p>不如在 mimbo 主题中, 你只需要用&lt;?php include (&#8216;gallery.php&#8217;); ?&gt;替换<br />
&lt;div class=&#8221;feature clearfloat&#8221; id=&#8221;lead&#8221;&gt;<br />
&lt;/div&gt;&lt;!&#8211;END FEATURE&#8211;&gt;<br />
之间的内容</p></blockquote>
<blockquote><p>当你完成这一步时，你的gallery就已经可以工作了。</p>
<p>要使你的gally运转起来，你需要在新建一个名为 gallery_image的自定义字段，字段值即为需要展示的图片链接，在wordpress中推荐用相对地址，比如你的图片地址为 http://www.yoursite.com/wp-content/uploads/2008/08/artile，只需要填wp-content /uploads/2008/08/artile就可以了。</p>
<p>最后一步（不是必须）：自定义gallery的具体显示效果。</p>
<p>打开文件wp-content/themes/your_theme_name/css/jd.gallery.css，在这里修改gallery的宽和高。（通过修改jd.gallery.css完全对这个slideshow根据自己的主题进行个性化。^_^）</p>
<blockquote><p>#myGallery, #myGallerySet, #flickrGallery<br />
{<br />
width: 590px;<br />
height: 250px;<br />
z-index:5;<br />
border: 1px solid #000;<br />
}</p></blockquote>
<p>默认的字号对于中文太小了，可以调整slideshow下方信息栏的高度及文字的字号，只需要修改</p>
<p>.jdGallery .slideInfoZone（滑动信息栏高度、颜色等参数）.jdGallery .slideInfoZone h2（信息栏内标题样式）</p>
<p>.jdGallery .slideInfoZone p（信息栏文本样式）</p>
<p>你还可以修改wp-content/themes/your_theme_name/scripts/jd.gallery.js来改变gallery的展示效果（<a href="http://smoothgallery.jondesign.net/">Smooth Gallery</a>提供了多种不同的显示效果，你可以根据需要进行修改）</p>
<p>更多定制信息请看<a href="http://smoothgallery.jondesign.net/">Smooth Gallery Website</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.refindweb.com/2008/08/add-slideshow-for-your-blog.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
