<?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:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Anthology of Ideas &#187; PHP</title>
	<atom:link href="http://anthologyoi.com/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://anthologyoi.com</link>
	<description>Anthology of Ideas is an archive of thoughts and form.</description>
	<lastBuildDate>Sat, 03 Mar 2012 11:16:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Insert an image into a WordPress Post with a plugin.</title>
		<link>http://anthologyoi.com/dev/insert-an-image-into-a-wordpress-post-with-a-plugin.html</link>
		<comments>http://anthologyoi.com/dev/insert-an-image-into-a-wordpress-post-with-a-plugin.html#comments</comments>
		<pubDate>Thu, 15 Oct 2009 20:15:42 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Web Developing]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[wordress]]></category>

		<guid isPermaLink="false">http://anthologyoi.com/blogish/asides/insert-an-image-into-a-wordpress-post-with-a-plugin.html</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>So in a project I&#8217;m working on I need to use a normal form to insert a post into the database. My client wanted the form to also add an image to the post. Furthermore, the image must be inserted using normal WordPress methods. The code below is the minimum required to insert an image into the database and attach it to a specific post.</p>
<p><pre class="brush: php">include_once(ABSPATH.&#039;/wp-admin/includes/media.php&#039;);
	include_once(ABSPATH.&#039;/wp-admin/includes/file.php&#039;);
	include_once(ABSPATH.&#039;/wp-admin/includes/image.php&#039;);
	
//	$id is the id of the post being inserted
//	$name is actually the name of the form input that uploaded the file so WP can access it using $_FILE[$name]
	media_handle_upload($name,$id);</pre></p>
<p>If you are inserting a new post, it makes sense to have the line <span class="inline-code">$id = wp_insert_post($post_data);</span> before this.</p>
]]></content:encoded>
			<wfw:commentRss>http://anthologyoi.com/dev/insert-an-image-into-a-wordpress-post-with-a-plugin.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP include ladder to find include path.</title>
		<link>http://anthologyoi.com/dev/php-include-ladder-to-find-include-path.html</link>
		<comments>http://anthologyoi.com/dev/php-include-ladder-to-find-include-path.html#comments</comments>
		<pubDate>Mon, 10 Sep 2007 20:24:04 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[Web Developing]]></category>
		<category><![CDATA[code snippet]]></category>
		<category><![CDATA[ladder]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[relative path]]></category>

		<guid isPermaLink="false">http://anthologyoi.com/blogish/asides/php-include-ladder-to-find-include-path.html</guid>
		<description><![CDATA[I needed a way to be able to include particular files from files that are themselves included. because the working directory was not necessarily the same, so I needed a way to find what the actual include path should be. &#8230; <a href="http://anthologyoi.com/dev/php-include-ladder-to-find-include-path.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I needed a way to be able to include particular files from files that are themselves included. because the working directory was not necessarily the same, so I needed a way to find what the actual include path should be. The following code snippet finds a specific folder or file and returns the ladder (relative path) to get to it. </p>
<p><pre class="brush: php">function find_path($loc,$dir=0){
	for($i = 0; $i &lt; 10; $i++){
		if($dir){
			if(is_dir($ladder.$loc)){
				return $ladder;
				break;
			}
		}elseif(is_file($ladder.$loc)){
			return $ladder;
			break;
		}
		$ladder .=&#039;../&#039;;
	}
}</pre></p>
<p>This code is NOT user-input safe: any checks you do should be hard coded otherwise you might as well just give out your passwords.</p>
]]></content:encoded>
			<wfw:commentRss>http://anthologyoi.com/dev/php-include-ladder-to-find-include-path.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Super Category (multi-blog) plugin with no hacks</title>
		<link>http://anthologyoi.com/wordpress/plugins/super-category-multi-blog-plugin-with-no-hacks.html</link>
		<comments>http://anthologyoi.com/wordpress/plugins/super-category-multi-blog-plugin-with-no-hacks.html#comments</comments>
		<pubDate>Thu, 02 Nov 2006 19:03:49 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://anthologyoi.com/wordpress/plugins/super-category-multi-blog-plugin-with-no-hacks.html</guid>
		<description><![CDATA[This is an old buggy version. Please use the newest. NOTE: I believe the only part that is missing is where it says to follow the instructions in the Up and Running section. In this section it basically said to &#8230; <a href="http://anthologyoi.com/wordpress/plugins/super-category-multi-blog-plugin-with-no-hacks.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://anthologyoi.com/wordpress/plugins/super-category-multi-blog-plugin-v-08.html"><strong>This is an old buggy version. Please use the newest.</strong></a></p>
<p>NOTE:<br />
I believe the only part that is missing is where it says to follow the instructions in the Up and Running section. In this section it basically said to make a group of links or categories belong to only one site add them to a category with the same name as the url (eg site: http://anthologyoi.com would have all its links under  the anthologyoi.com category).</p>
<p>Don&#8217;t worry I will rewrite the detailed section as soon as I get time (read: over the weekend)<br />
<a id="p122" href="http://anthologyoi.com/wp-content/uploads/2006/11/super_cat-php.zip">Download the Super Category Plugin here</a><br />
      About a month and a half ago I released a first version of this plugin. In it I had to use a combination of hacks along with a plugin to have the same functionality that this version has with no hacks what-so-ever. In fact, aside from activating the plugin, the only thing you need to to do to install this plugin is make a couple edits for your theme files. Please read the entire setup and installation file because while there are only a few things you need to do, not doing them will lead to doom.</p>
<p><em>Installation</em>:</p>
<ul>
<li>Read section entitled &#8220;Parking Domains&#8221; &#8212; if you know what a parked domain is AND can park them, you can skip this part.</li>
<li>Download Plugin</li>
<li>Read section entitled &#8220;I assume that&#8230;&#8221; and make sure you understand each item.</li>
<li>Edit themes as shown in the section entitled &#8220;A Few Little Edits&#8221;</li>
<li>Upload super_cat.php to <i>wp-content/plugins/</i></li>
<li>Activate Plugin</li>
<li>Follow instructions in the section entitled &#8220;Up and Running&#8221;</li>
<li>Bask in the glory of the easiest and most convienent multiblog in history.</li>
<li>Send a donation with a number greator than 0 followed by lots of zeros to the right of the decimal place to me or rabid monkeys will eat your blog and slippers.</li>
<p><em>I Assume That&#8230;</em>
</ul>
<ul>
<li>You have at least a mid-level working knowledge of how wordpress displays information. If you don&#8217;t understand what a certain function does that I mention just run a search for it on the wordpress site.</li>
<li>You are using a clean install, or that any preexisting categories you want part of one site. If this is not true it is not difficult to change it later. </li>
<li>You want all the same options and activated plugins on all sites. Currently the only things that you can have on one site and not others is: blog title, blog description, theme, post categories, pages, posts, external links. </li>
<li>You want any preexisting links and pages on your blog to be availible to all blogs. Again if this is not true it is easy to change.</li>
<li>Your website urls are fairly permanent. Although there are built-in mechanisms for editing options for a single url/blog it is not possible as of yet to change a blog from on url to another automatically. However, if you know how the database works this can be done easily in phpmyadmin with only a few quick edits. </li>
<li>You use themes that use fairly normal methods to display categories,links and posts. I have not tested this plugin with themes other than default or classic. While for most themes it should be the same it is possible that more unique ones require extra work.</li>
<li>The themes you use are hard-coded. That is that you don&#8217;t use sidebar widgets. However, igf you do most widgets should still work, but for ones that use commands that I we need modified versions of may not work immediately. </li>
<li>
</li>
<li>That when I suggest you do things a certain way, you do it.</li>
<li>You will read all of the instructions.</li>
</ul>
<p><em>A Few Little Edits</em><br />
Please note that when I say replace one function with something else, if there any arguments in that function you need to copy them to the new functions.</p>
<p>You will need to preform the following steps on each of the templates you want to use this plugin with. it may seem like alot but there are only 4 things you need to change which may be in only two files depending on your theme. After the first one it will seem a lot easier (changing new templates I have never seen takes about a minute).</p>
<ul>
<li>You will need to look for the following functions in your sidebar files and/or your header file depending on your theme. You are looking for the following function: <b>wp_list_pages</b> they may or may not be in your theme and they may or may not be in the same file. For example, it is in <b>sidebar.php</b> in the classic and kubrick theme, but may not be in your theme.<br />
FIND: <b>wp_list_pages</b><br />
REPLACE WITH:<br />
<textarea style="width:100%; height:100px;"><br />
< ?php if (function_exists('sprcat_install')){?><br />
	< ?php global $cur_page;?><br />
	< ?php wp_list_pages("child_of=$cur_page[ID]");?><br />
< ?php }else{?><br />
	< ?php wp_list_pages(); ?><br />
< ?php }?><br />
</textarea><br />
If there are arguments inside of the parenthesis, you should add them to both commands.
 </li>
<li>You will need to look for the following functions in your sidebar files and/or your header file depending on your theme. You are looking for the following function: <b>wp_list_cats</b> they may or may not be in your theme and they may or may not be in the same file. For example, it is in <b>sidebar.php</b> in the classic and kubrick theme, but may not be in your theme.<br />
FIND: <b>wp_list_pages</b><br />
REPLACE WITH:<br />
<textarea style="width:100%; height:100px;"><br />
< ?php if (function_exists('sprcat_install')){?><br />
	< ?php global $cur_sprcat;?><br />
	< ?php wp_list_cats("child_of=$cur_sprcat[cat_ID]");?><br />
< ?php }else{?><br />
	< ?php wp_list_cats(); ?><br />
< ?php }?><br />
</textarea><br />
If there are arguments inside of the parenthesis, you should add them to both commands.
 </li>
<li>The following is most likely in your <b>sidebar</b> file.<br />
FIND: <b>get_links_list</b><br />
REPLACE WITH:<br />
<textarea style="width:100%; height:100px;"><br />
< ?php if (function_exists('sprcat_install')){?><br />
	< ?php sprcat_get_links_list();?><br />
< ?php }else{?><br />
	< ?php get_links_list(); ?><br />
< ?php }?><br />
</textarea><br />
If there are arguments inside of the parenthesis, you should add them to both commands.
</li>
<li>In your <b>archive.php</b>, <b>index.php</b>, <b>search.php</b> and <b>category.php</b><br />
FIND:<b>the_category</b><br />
REPLACE WITH:<br />
<textarea style="width:100%; height:100px;"><br />
< ?php if (function_exists('sprcat_install')){?><br />
	< ?php sprcat_the_category();?><br />
< ?php }else{?><br />
	< ?php the_category(); ?><br />
< ?php }?><br />
</textarea><br />
If there are arguments inside of the parenthesis, you should add them to both commands.</p>
</li>
<li>Thats it everything else should work on its own.</li>
</ul>
<p><em>Parking Domains</em><br />
     This is not a How-To guide for parking domains; instead it is meant to be just a brief introduction and explanation of what you will need to be able to do to use this plugin. Without parked domains this plugin is almost worthless (although there are some useful traits) so make sure you can use them before you install the plugin.<br />
     First of all to park a domain you need a minimum of two domains. A parked domain is a domain that points to the EXACT same place as another domain without using frames or redirections. It is not an addon domain which points to a subfolder. You may not be able to park domains depending on your hosting company if you can&#8217;t you must either switch companies or convince your companies to allow you to park domains. Occasionally a hosting company may refer to parked domains as aliased domains or one of several other names. If the domain name can point to the same folder as another domain name it will work no matter what the name is.<br />
     Secondly you must make sure that the parked domains are registered with valid name servers and have propagated through the DNS before adding them to this plugin. While there will be no obvious errors if you try to do it before hand, none of the options will work until the domain is fully propagated.</p>
]]></content:encoded>
			<wfw:commentRss>http://anthologyoi.com/wordpress/plugins/super-category-multi-blog-plugin-with-no-hacks.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

