<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>Softinquiry &#187; php</title>
	<atom:link href="http://softinquiry.com/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://softinquiry.com</link>
	<description>A blog where I share my knowledge about software</description>
	<lastBuildDate>Wed, 11 Aug 2010 11:51:45 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
		<item>
		<title>Save your code snippets with Snippely</title>
		<link>http://softinquiry.com/save-your-code-snippets-with-snippely.html</link>
		<comments>http://softinquiry.com/save-your-code-snippets-with-snippely.html#comments</comments>
		<pubDate>Fri, 24 Jul 2009 12:16:36 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programs]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://softinquiry.com/save-your-code-snippets-with-snippely.html</guid>
		<description><![CDATA[I am currently waiting for FeedReader to finish downloading some enclosures from a feed I am subscribed to. In the meanwhile I though it would be nice letting you know what a great tool Snippely is. Though it is in its developing stage it comes handy for all developers, designers, etc. out there that have [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently waiting for FeedReader to finish downloading some enclosures from a feed I am subscribed to. In the meanwhile I though it would be nice letting you know what a great tool Snippely is. Though it is in its developing stage it comes handy for all developers, designers, etc. out there that have a piece of code and want to store it somewhere so that it will be accessible later when needed. It is incredibly simple and straight forward: it lets you create some groups and in those groups you can add snippets. A snippet will have two main parts: the actual code and the note. It has a built in feature for applying different syntax highlighting for PHP, CSS, Ruby and JavaScript. So, as I said it is pretty straight forward and due to its minimalistic interface looks quite nice.</p>
<p>However, it misses a search function, as well as a import/export option. Of course it would have been awesome for it to be able to store the snippets on the web so that they would be accessible for you by using an account or such. Unfortunately it lacks the HTML syntax coloring. Of course there is a lot of work on it still but thankfully it is out there for us to enjoy so let’s be patient with the developers.</p>
<p>Oh, and by the way, to make up for that import/export thing you could do it manually by following the path to the SQLite database file:</p>
<p><em>&#8220;C:\Users\Username\AppData\Roaming\com.snippely.xxx\Local Store\application.db&#8221;</em>. And there you have it; you can now be assured that your precious snippets won’t be lost if you decide to work on another computer or any other scenario.</p>
<p>Here are some screenshots to help you make an impression:</p>
<p><a href="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932800pmbmp.jpg" target="_blank"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="Fullscreen capture 7242009 32800 PM.bmp" src="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932800pmbmp-thumb.jpg" border="0" alt="Fullscreen capture 7242009 32800 PM.bmp" width="244" height="187" /></a> <a href="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932817pmbmp.jpg" target="_blank"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="Fullscreen capture 7242009 32817 PM.bmp" src="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932817pmbmp-thumb.jpg" border="0" alt="Fullscreen capture 7242009 32817 PM.bmp" width="244" height="187" /></a> <a href="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932828pmbmp.jpg" target="_blank"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="Fullscreen capture 7242009 32828 PM.bmp" src="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932828pmbmp-thumb.jpg" border="0" alt="Fullscreen capture 7242009 32828 PM.bmp" width="244" height="186" /></a> <a href="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932839pmbmp.jpg" target="_blank"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="Fullscreen capture 7242009 32839 PM.bmp" src="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932839pmbmp-thumb.jpg" border="0" alt="Fullscreen capture 7242009 32839 PM.bmp" width="244" height="185" /></a> <a href="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932916pmbmp.jpg" target="_blank"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="Fullscreen capture 7242009 32916 PM.bmp" src="http://softinquiry.com/wp-content/uploads/2009/07/fullscreencapture724200932916pmbmp-thumb.jpg" border="0" alt="Fullscreen capture 7242009 32916 PM.bmp" width="244" height="190" /></a></p>
<p>Download: <a title="http://code.google.com/p/snippely/downloads/list" href="http://code.google.com/p/snippely/downloads/list">http://code.google.com/p/snippely/downloads/list</a></p>
<img src="http://softinquiry.com/?ak_action=api_record_view&id=302&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://softinquiry.com/save-your-code-snippets-with-snippely.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Best way to inspect dead links using your 404 page</title>
		<link>http://softinquiry.com/best-way-to-inspect-dead-links-using-your-404-page.html</link>
		<comments>http://softinquiry.com/best-way-to-inspect-dead-links-using-your-404-page.html#comments</comments>
		<pubDate>Sat, 18 Apr 2009 07:43:08 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[dead links]]></category>
		<category><![CDATA[error]]></category>

		<guid isPermaLink="false">http://softinquiry.com/?p=271</guid>
		<description><![CDATA[I searched for some instructions on how to easily find dead links on my blog. I found some plugins that do just that but instead of using a plugin to do it why not use this cool method that can also provide you with a custom 404 page ?
The WordPress Codex directory is way cool [...]]]></description>
			<content:encoded><![CDATA[<p><center><img class="aligncenter size-medium wp-image-272" title="404" src="http://softinquiry.com/wp-content/uploads/2009/04/404-300x123.jpg" alt="404" width="300" height="123" /></center><br />I searched for some instructions on how to easily find dead links on my blog. I found some plugins that do just that but instead of using a plugin to do it why not use this cool method that can also provide you with a custom 404 page ?</p>
<p>The WordPress Codex directory is way cool and it is maybe one of the best wordpress resources out there. Here&#8217;s the link that interests us in particular: <a title="Creating an error 404 page" href="http://codex.wordpress.org/Creating_an_Error_404_Page" target="_blank">Creating an Error 404 Page</a>. You just need to create a 404.php file in your theme directory (in case you don&#8217;t already have one). Put the following code in it and customize aiding yourself with the comments:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
   &lt;div id=&quot;post-entry&quot;&gt;
     &lt;h1&gt;Whoops !&lt;/h1&gt;
	     &lt;div class=&quot;post-content&quot;&gt;
	     	&lt;p&gt;You 
				<span style="color: #000000; font-weight: bold;">&lt;?php</span>
				<span style="color: #666666; font-style: italic;">#some variables for the script to use
</span>				<span style="color: #666666; font-style: italic;">#if you have some reason to change these, do.  but wordpress can handle it
</span>				<span style="color: #000088;">$adminemail</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_email'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">#the administrator email address, according to wordpress
</span>				<span style="color: #000088;">$website</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">#gets your blog's url from wordpress
</span>				<span style="color: #000088;">$websitename</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">#sets the blog's name, according to wordpress
</span>				
				  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_REFERER'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				    <span style="color: #666666; font-style: italic;">#politely blames the user for all the problems they caused
</span>				        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;tried going to &quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">#starts assembling an output paragraph
</span>					<span style="color: #000088;">$casemessage</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;All is not lost!&quot;</span><span style="color: #339933;">;</span>
				  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_REFERER'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				    <span style="color: #666666; font-style: italic;">#this will help the user find what they want, and email me of a bad link
</span>					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;clicked a link to&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">#now the message says You clicked a link to...
</span>				        <span style="color: #666666; font-style: italic;">#setup a message to be sent to me
</span>					<span style="color: #000088;">$failuremess</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;A user tried to go to <span style="color: #006699; font-weight: bold;">$website</span>&quot;</span>
				        <span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; and received a 404 (page not found) error. &quot;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$failuremess</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;It wasn't their fault, so try fixing it.  
				        They came from &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_REFERER'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
					<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$adminemail</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Bad Link To &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
				        <span style="color: #000088;">$failuremess</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;From: <span style="color: #006699; font-weight: bold;">$websitename</span> &lt;noreply@<span style="color: #006699; font-weight: bold;">$website</span>&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">#email you about problem
</span>					<span style="color: #000088;">$casemessage</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;An administrator has been emailed 
				        about this problem, too.&quot;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">#set a friendly message
</span>				  <span style="color: #009900;">&#125;</span>
				  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$website</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> 
				and it doesn't exist. <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$casemessage</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>  You can click back 
				and try again or try using the search box in the sidebar.
			&lt;/p&gt;
	     &lt;/div&gt;
	&lt;/div&gt;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Easy enough ? I think it is an awesome method. At least for testing if not for permanent use. Hope this helps. Oh, and by the way, if you have a large blog be ready to be bombarded with emails generated from this 404 page.</p>
<img src="http://softinquiry.com/?ak_action=api_record_view&id=271&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://softinquiry.com/best-way-to-inspect-dead-links-using-your-404-page.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Speed up your WordPress blog with PHP Speedy !</title>
		<link>http://softinquiry.com/speed-up-your-wordpress-blog-with-php-speedy.html</link>
		<comments>http://softinquiry.com/speed-up-your-wordpress-blog-with-php-speedy.html#comments</comments>
		<pubDate>Fri, 21 Mar 2008 13:59:26 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[load time]]></category>
		<category><![CDATA[minify css and js]]></category>
		<category><![CDATA[seed up]]></category>

		<guid isPermaLink="false">http://softinquiry.com/speed-up-you-wordpress-blog-with-php-speedy.html</guid>
		<description><![CDATA[


PHP Speedy is a script that minimizes your js and css files in order to reduce your blog&#8217;s load time. If you don&#8217;t believe it check out the links below:

Test page without compression
Test page with compression

As you can see (you might want to check your Net Firebug stats) the page on which PHP Speeedy is [...]]]></description>
			<content:encoded><![CDATA[<p>PHP Speedy is a script that minimizes your js and css files in order to reduce your blog&#8217;s load time. If you don&#8217;t believe it check out the links below:</p>
<ul>
<li><a href="http://aciddrop.com/aciddrop/php_speedy/test_page/compress_me.php?no_images=true&amp;compress=no" title="test page without compression" target="_blank">Test page without compression</a></li>
<li><a href="http://aciddrop.com/aciddrop/php_speedy/test_page/compress_me.php?no_images=true" title="test page with compression" target="_blank">Test page with compression</a></li>
</ul>
<p>As you can see (you might want to check your Net Firebug stats) the page on which PHP Speeedy is activated is displayed a lot more faster ! The same thing applies for a WordPress installation. However if you encounter different problems be sure to refer to the <a href="http://aciddrop.com/2008/03/22/php-speedy-wordpress-plugin-version-04/" title="author's page" target="_blank">author&#8217;s page</a> and have a quick look-up on what&#8217;s to be done if something goes wrong. Leon (the author) seems to be a nice guy and quickly replies to the ones who ask for help or guidance. Keep up the good work Leon !</p>
<p>I recommend setting up a filter and excluding the external javascripts (such as ads, etc) because of the risk that they won&#8217;t show and/or behave normally. A part of feel free to minify your internal css and js files and see how thing work out.</p>
<p class="greybox"><a href="http://aciddrop.com/aciddrop/download/" title="download" target="_blank">Download PHP Speedy for Wordpress or download PHP Speedy standalone version</a><a href="http://aciddrop.com/php-speedy/" title="download standalone php speedy" target="_blank"> </a></p>
<img src="http://softinquiry.com/?ak_action=api_record_view&id=65&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://softinquiry.com/speed-up-your-wordpress-blog-with-php-speedy.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Standalone PHP script for displaying random images</title>
		<link>http://softinquiry.com/standalone-php-script-for-displaying-random-images.html</link>
		<comments>http://softinquiry.com/standalone-php-script-for-displaying-random-images.html#comments</comments>
		<pubDate>Wed, 19 Mar 2008 18:37:16 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[ads rotator]]></category>
		<category><![CDATA[banner rotator]]></category>
		<category><![CDATA[random images]]></category>

		<guid isPermaLink="false">http://softinquiry.com/standalone-php-script-for-displaying-random-images.html</guid>
		<description><![CDATA[What this script basically does is to display random images from a given folder. You can use this script to display some rotating affiliates banners, ads, sponsors banners, or even display a random header for your WordPress blog. Here you have three examples of scripts. The first one displays random pictures, without links, just for [...]]]></description>
			<content:encoded><![CDATA[<p>What this script basically does is to display random images from a given folder. You can use this script to display some rotating affiliates banners, ads, sponsors banners, or even display a random header for your WordPress blog. Here you have three examples of scripts. The first one displays random pictures, without links, just for a given image extension, the second one displays random images with links, also just for a given image extension and the third one displays images with links with all kinds of image extensions.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$images</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$nr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_rand</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$nr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;img src=&quot;http://images_path/imagename_<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>.png&quot; width='image_width' height='image_height' alt='image_alt_text' /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>The above code displays 3 (out of 5) non-duplicate, randomly selected pictures. Unfortunately a disadvantage of this script is that it can only display images of a given extension; in the above case png. Also the images must be named like in the following example: imagename_1, imagename_2, imagename_3 and so on. And of course, you don&#8217;t have the possibility of adding some links to your images.</p>
<p>The next code is pretty much like the above one but this one let&#8217;s you specify some links to your images. &#8220;link1&#8243; is associated to imagename_1.png, &#8220;link2&#8243; to imagename_2.png, etc.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$images</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;link1&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;link2&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;link3&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;link4&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;link5&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$nr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_rand</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$link</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$images</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$nr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$nr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$link</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
&lt;img src=&quot;http://images_path/imagename_<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>.png&quot; width='image_width' height='image_height' alt='image_alt_text' /&gt;
&lt;/a&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>The following script however is more practical. It allows you to display images with different extensions (png, gif, jpg, bmp, etc.) You will need one file to define your images names and their corresponding links.<br />
For example let&#8217;s say we have 7 images, each image having its link.</p>
<pre lang="">
imagename_1.gif:http://linkforimage1.com/
imagename_2.bmp:http://linkforimage2.com/
imagename_3.png:http://linkforimage3.com/
imagename_4.jpg:http://linkforimage4.com/
imagename_5.jpg:http://linkforimage5.com/
</pre>
<p>Name the file somethink like 19832asdfasfd.qu132u1; purely random.<br />
Here comes the actual script.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'19832asdfasfd.qu132u1'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'r+'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$counter</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$images</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$counter</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> get_name<span style="color: #009900;">&#40;</span><span style="color: #000088;">$object</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$object</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$x</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'0'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> get_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$object</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$object</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$total</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$x</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #000088;">$total</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$url</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$url</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> show_banner<span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nr</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> get_name<span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$nr</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> get_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$nr</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; target=&quot;_blank&quot; &gt;&lt;img src=&quot;linktoimagesdir'</span><span style="color: #339933;">.</span><span style="color: #000088;">$img</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; border=&quot;0&quot;/&gt;&lt;/a&gt;&lt;br/&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$nr</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$bn</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_rand</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	show_banner<span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #339933;">,</span><span style="color: #000088;">$bn</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$images</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$bn</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$i</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Save this to index.php and place the file with the script in a directory located on your server. To show the rotating images on a certain page you need to call index.php</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">include</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' pathtofile / index.php '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>You can also call the file with the <i>require_once</i> function or an HTML iFrame.<br />
If you need any assistance feel free to leave me a comment and i will get back to you.</p>
<img src="http://softinquiry.com/?ak_action=api_record_view&id=63&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://softinquiry.com/standalone-php-script-for-displaying-random-images.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Latest posts standalone script for phpbb3 and phpbb2</title>
		<link>http://softinquiry.com/latest-posts-standalone-script-for-phpbb3-and-phpbb2.html</link>
		<comments>http://softinquiry.com/latest-posts-standalone-script-for-phpbb3-and-phpbb2.html#comments</comments>
		<pubDate>Fri, 14 Mar 2008 21:54:12 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[phpbb3]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[phpbb2]]></category>

		<guid isPermaLink="false">http://softinquiry.com/latest-posts-standalone-script-for-phpbb3-and-phpbb2.html</guid>
		<description><![CDATA[I have tested this script on phpbb2 and phpbb3 and it works like a charm. If you have one, make sure you exclude your private section (for example t.forum_id != 4, where 4 is your private forum&#8217;s number). You can include this in your blog&#8217;s sidebar, a portal or a website. You can apply different [...]]]></description>
			<content:encoded><![CDATA[<p>I have tested this script on phpbb2 and phpbb3 and it works like a charm. If you have one, make sure you exclude your private section (for example <em>t.forum_id != 4</em>, where <em>4</em> is your private forum&#8217;s number). You can include this in your blog&#8217;s sidebar, a portal or a website. You can apply different filters by playing with the <em>WHERE</em> condition. Basically this script generates a table which is populated from the phpbb&#8217;s database according to the conditions which are imposed.</p>
<p>Of course you can customize it&#8217;s output by modifying the $query variable. If you are a newbie and need a quick php <em>Where</em> clause reference as you want to get a hang of the operators, check this one out: <a href="http://www.w3schools.com/php/php_mysql_where.asp" title="PHP MySQL Where Clause" target="_blank">PHP MySQL Where Clause</a></p>
<p>Finally here&#8217;s the script:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #666666; font-style: italic;">// How Many Topics you want to display?</span>
    <span style="color: #000088;">$topicnumber</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// Scrolling towards up or down?</span>
    <span style="color: #000088;">$scroll</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;up&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// Change this to your phpBB path</span>
    <span style="color: #000088;">$urlPath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/forum&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Database Configuration (Where your phpBB config.php file is located)</span>
    <span style="color: #b1b100;">include</span> <span style="color: #0000ff;">'forum/config.php'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$table_topics</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table_prefix</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;topics&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$table_forums</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table_prefix</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;forums&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$table_posts</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table_prefix</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;posts&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$table_users</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table_prefix</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;users&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$dbhost</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$dbuser</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$dbpasswd</span>&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Could not connect&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$dbname</span>&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Could not select database&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
    FROM <span style="color: #006699; font-weight: bold;">$table_topics</span> t, <span style="color: #006699; font-weight: bold;">$table_forums</span> f, <span style="color: #006699; font-weight: bold;">$table_posts</span> p, <span style="color: #006699; font-weight: bold;">$table_users</span> u
    WHERE t.topic_id = p.topic_id AND
    f.forum_id = t.forum_id AND
    t.forum_id != 4 AND
    t.topic_status &lt;&gt; 2 AND
    p.post_id = t.topic_last_post_id AND
    p.poster_id = u.user_id
    ORDER BY p.post_id DESC LIMIT <span style="color: #006699; font-weight: bold;">$topicnumber</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Query failed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>									
&nbsp;
    <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;marquee id=<span style="color: #000099; font-weight: bold;">\&quot;</span>recent_topics<span style="color: #000099; font-weight: bold;">\&quot;</span> behavior=<span style="color: #000099; font-weight: bold;">\&quot;</span>scroll<span style="color: #000099; font-weight: bold;">\&quot;</span> direction=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$scroll</span><span style="color: #000099; font-weight: bold;">\&quot;</span> height=<span style="color: #000099; font-weight: bold;">\&quot;</span>170<span style="color: #000099; font-weight: bold;">\&quot;</span> scrolldelay=<span style="color: #000099; font-weight: bold;">\&quot;</span>100<span style="color: #000099; font-weight: bold;">\&quot;</span> scrollamount=<span style="color: #000099; font-weight: bold;">\&quot;</span>2<span style="color: #000099; font-weight: bold;">\&quot;</span> onMouseOver=<span style="color: #000099; font-weight: bold;">\&quot;</span>document.all.recent_topics.stop()<span style="color: #000099; font-weight: bold;">\&quot;</span> onMouseOut=<span style="color: #000099; font-weight: bold;">\&quot;</span>document.all.recent_topics.start()<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;
    &lt;table cellpadding='3' cellSpacing='2' width='350'&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> MYSQL_ASSOC<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #b1b100;">echo</span>  <span style="color: #0000ff;">&quot;&lt;tr valign='top'&gt;&lt;td&gt;&lt;font face=<span style="color: #000099; font-weight: bold;">\&quot;</span>Verdana, Arial, Helvetica, sans-serif<span style="color: #000099; font-weight: bold;">\&quot;</span> size=<span style="color: #000099; font-weight: bold;">\&quot;</span>1<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;font color=<span style="color: #000099; font-weight: bold;">\&quot;</span>#FFCC00<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;b&gt;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$urlPath</span>/viewtopic.php?f=<span style="color: #006699; font-weight: bold;">$row[forum_id]</span>&amp;t=<span style="color: #006699; font-weight: bold;">$row[topic_id]</span>&amp;p=<span style="color: #006699; font-weight: bold;">$row[post_id]</span>#p<span style="color: #006699; font-weight: bold;">$row[post_id]</span><span style="color: #000099; font-weight: bold;">\&quot;</span> TARGET=<span style="color: #000099; font-weight: bold;">\&quot;</span>_blank<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">.</span>
    <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;topic_title&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span>
    <span style="color: #0000ff;">&quot;&lt;/a&gt;&lt;/td&gt;&lt;/font&gt;&lt;/b&gt;&lt;td&gt;&lt;font face=<span style="color: #000099; font-weight: bold;">\&quot;</span>Verdana, Arial, Helvetica, sans-serif<span style="color: #000099; font-weight: bold;">\&quot;</span> size=<span style="color: #000099; font-weight: bold;">\&quot;</span>1<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;font color=<span style="color: #000099; font-weight: bold;">\&quot;</span>#C0C0C0<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt; by: &lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$urlPath</span>/memberlist.php?mode=viewprofile&amp;u=<span style="color: #006699; font-weight: bold;">$row[user_id]</span><span style="color: #000099; font-weight: bold;">\&quot;</span> TARGET=<span style="color: #000099; font-weight: bold;">\&quot;</span>_blank<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">.</span>
    <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;username&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span>
    <span style="color: #0000ff;">&quot;&lt;/td&gt;&lt;td&gt;&lt;font face=<span style="color: #000099; font-weight: bold;">\&quot;</span>Verdana, Arial, Helvetica, sans-serif<span style="color: #000099; font-weight: bold;">\&quot;</span> size=<span style="color: #000099; font-weight: bold;">\&quot;</span>1<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;font color=<span style="color: #000099; font-weight: bold;">\&quot;</span>#C0C0C0<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">.</span>
    <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F j, Y, g:i a'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;post_time&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span>
    <span style="color: #0000ff;">&quot;&lt;/td&gt;&lt;/tr&gt;&lt;/font&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;/table&gt;&lt;/marquee&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">mysql_free_result</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Feel free to use it as you want. If you have any questions just drop a comment.</p>
<img src="http://softinquiry.com/?ak_action=api_record_view&id=58&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://softinquiry.com/latest-posts-standalone-script-for-phpbb3-and-phpbb2.html/feed</wfw:commentRss>
		<slash:comments>74</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Tips on how to integrate ads between and into your Wordpress posts</title>
		<link>http://softinquiry.com/tips-on-how-to-integrate-ads-between-and-into-your-wordpress-posts.html</link>
		<comments>http://softinquiry.com/tips-on-how-to-integrate-ads-between-and-into-your-wordpress-posts.html#comments</comments>
		<pubDate>Sun, 02 Mar 2008 14:57:11 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[adbrite]]></category>
		<category><![CDATA[ads]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[bidvertiser]]></category>
		<category><![CDATA[chitika]]></category>
		<category><![CDATA[widgetbucks]]></category>

		<guid isPermaLink="false">http://softinquiry.com/tips-on-how-to-integrate-ads-between-and-into-your-wordpress-posts.html</guid>
		<description><![CDATA[Have you ever wondered how is it possible to integrate AdSense or any other ads into or between your Wordpress posts ? Of course you have. This method does not require any third-party plugins whatsoever. For example, we all know that on a single page only three AdSense ads will appear. I&#8217;ve seen people that [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wondered how is it possible to integrate AdSense or any other ads into or between your Wordpress posts ? Of course you have. This method does not require any third-party plugins whatsoever. For example, we all know that on a single page only three AdSense ads will appear. I&#8217;ve seen people that added the ad code between their posts on the index page. Guess what ? The first ads showed up alright but the other ones not and this resulted in the loss of precious space as the spots where the ads should have been were left blank. You can implement this method very fast as it&#8217;s very simple and you don&#8217;t need to be an advanced coder to get it done !</p>
<p>If you want to integrate ads into your posts here&#8217;s what you need to do. First of all let&#8217;s begin with defining the CSS class we&#8217;ll be using.<br />
The following code is for right-orientated ads (like the ones i use on my blog).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.ad-right</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span> <span style="color: #933;">5px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>The next code is for left-orientated ads.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.ad-left</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span> <span style="color: #933;">10px</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>As you can see, the differences between the two classes are not so big. Feel free to play with them until you get the desired effect or if you don&#8217;t have any CSS knowledge at all you can use them as given. After you decide which class you will use, copy the code into your <strong>style.css</strong>. Thats it for the CSS part.</p>
<p>Let&#8217;s move along and edit our theme files. Whether you want to show your ads on the index page or the page containing just the article you will need to look for the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #339933;">...</span></pre></div></div>

<p>By default any wordpress theme will have that code in it&#8217;s template file and it doesn&#8217;t matter what&#8217;s after it because many themes use custom and different code. After you located the code be sure to add the following lines exactly before it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;ad-right&quot;&gt;
////Replace me with your ad code////
&lt;/div&gt;</pre></td></tr></table></div>

<p>Replace the line that says so with your ad code. Notice the class that is used. You might want to change that with <strong>ad-left</strong> as i told you before.<br />
Ok, so now you have in-content ads.</p>
<p>Now lets move forward and add some ads between your posts on the index page.<br />
In your index page template find the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Again bare in mind that you may not find the exact code. If you don&#8217;t have that exact code just make sure you find the <strong>have_posts()</strong> function. Add the following code exactly before it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ad1</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ad2</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ad3</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>The above code uses the $ad1, $ad2, $ad3 variables to define after which posts the ads will be shown. The variable $post stores the post number and will be incremented later.<br />
Now before the closing of the div that marks the ending of the post content (something like this <strong>< / div > < ! -- End of Post -- ></strong>) add the following lines:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$ad1</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$post</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$ad2</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$post</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$ad3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;p&gt;&lt;center&gt;
////Replace me with your ad code////
&lt;/center&gt;&lt;/p&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$post</span><span style="color: #339933;">++;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>As you can see at the end of the code we incremented the <strong>post</strong> variable.</p>
<p>If you want to know how to display ads from multiple advertising companies using the same code just drop me a comment and i will explain how to achieve that.</p>
<p>I&#8217;ve tested this method with ads from AdSense, BidVertiser, WidgetBucks, BlgAds, Chitika and AdBrite. The reason i&#8217;m not writing a tutorial for each of them is because all you need to do is to paste your ad code in the upper mentioned spot.</p>
<img src="http://softinquiry.com/?ak_action=api_record_view&id=47&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://softinquiry.com/tips-on-how-to-integrate-ads-between-and-into-your-wordpress-posts.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
	</item>
	</channel>
</rss>
