<?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>RubberNeck Designs &#187; PHP</title>
	<atom:link href="http://www.rubberneckdesigns.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubberneckdesigns.com</link>
	<description>Drupal Web Developer Notes &#38; Sharing</description>
	<lastBuildDate>Tue, 31 Jan 2012 00:28:02 +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>Secure URL Handling with Drupal</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/secure-url-handling-with-drupal/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/secure-url-handling-with-drupal/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 14:29:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Security]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=496</guid>
		<description><![CDATA[In most cases dynamic data in forms is handled by the forms API which does a pretty good job of keeping it clean. Since the variables in hook_menu() for example are picked up as a % sign and then translated into a callback array, they are &#8220;cleansed&#8221; as they are passed through the Drupal Core [...]]]></description>
			<content:encoded><![CDATA[<p>In most cases dynamic data in forms is handled by the forms API which does a pretty good job of keeping it clean. Since the variables in hook_menu() for example are picked up as a % sign and then translated into a callback array, they are &#8220;cleansed&#8221; as they are passed through the Drupal Core code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>345
346
347
348
349
350
351
352
353
354
355
356
357
358
</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: #000000; font-weight: bold;">function</span> hook_menu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #339933;">...</span> some code
&nbsp;
  <span style="color: #000088;">$items</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'my-module/%/edit'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'page callback'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'mymodule_abc_edit'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'page arguments'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
more code <span style="color: #339933;">...</span>
&nbsp;
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$items</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>On the other hand, there may be times when you you really need to pass dynamic data as a $_GET variable that is tacked onto an URL. In this case you need to pass the code through the <a href="http://co.php.net/manual/en/function.urlencode.php" title="urlencode()">urlencode()</a> function.</p>
<p>When you are passing a user submitted URL in a hyperlink, rather than using <a href="http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/check_plain/7" title="check_plain()">check_plain()</a>, the Drupal documentation says to use <a href="http://co.php.net/manual/en/function.urlencode.php" title="urlencode()">urlencode()</a> instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/secure-url-handling-with-drupal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get The Calling Function</title>
		<link>http://www.rubberneckdesigns.com/ajax-web-design/get-the-calling-function/</link>
		<comments>http://www.rubberneckdesigns.com/ajax-web-design/get-the-calling-function/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 13:44:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[MAMP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=481</guid>
		<description><![CDATA[Knowing which PHP function call the code we are working on can give us the clues we need for de-bugging a script. Getting the calling function is easy in PHP, thanks to the debug_backtrace() function. Just put the following code wherever in your script you need to know what function is calling the part you [...]]]></description>
			<content:encoded><![CDATA[<p>Knowing which PHP function call the code we are working on can give us the clues we need for de-bugging a script.<br />
 Getting the calling function is easy in PHP, thanks to the <a href="http://php.net/manual/en/function.debug-backtrace.php">debug_backtrace() function</a>. </p>
<p>Just put the following code wherever in your script you need to know what function is calling the part you are working on.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>45
46
47
48
49
50
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>php<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000088;">$backtrace</span> <span style="color: #339933;">=</span> <span style="color: #990000;">debug_backtrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;The function that just called this code is &lt;strong&gt;&quot;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$backtrace</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'function'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;strong&gt;.&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>php<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>This will output something like this:</p>
<blockquote><p>The function that just called this code is <strong>DrawWidget</strong>.</p></blockquote>
<p>Where <strong>DrawWidget</strong> is the name of the function.</p>
<p>I hope this comes in handy for someone. Thanks for visiting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/ajax-web-design/get-the-calling-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP and MySQL command line with MAMP on OSX</title>
		<link>http://www.rubberneckdesigns.com/mamp/php-and-mysql-command-line-with-mamp-on-osx/</link>
		<comments>http://www.rubberneckdesigns.com/mamp/php-and-mysql-command-line-with-mamp-on-osx/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 14:31:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MAMP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[UNIX / LINIX]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=434</guid>
		<description><![CDATA[I found a handy article named &#8220;Getting command line access to PHP and MySQL running MAMP on OSX&#8221; by  Joaquin Lippincott . It was very helpful for getting PHP and MySQL acces from the terminal on a mac. In addition, one of the comments by Matthew Bacon was about getting the ZEND FRAMWORK up and running [...]]]></description>
			<content:encoded><![CDATA[<p>I found a handy article named</p>
<p>&#8220;<a title="PHP and MySQL command line with MAMP on OSX" href="http://www.metaltoad.com/blog/getting-command-line-access-php-and-mysql-running-mamp-osx">Getting command line access to PHP and MySQL running MAMP on OSX</a>&#8221;</p>
<p>by  <a href="http://www.metaltoad.com/people/joaquin">Joaquin Lippincott .</a></p>
<p>It was very helpful for getting PHP and MySQL acces from the terminal on a mac.</p>
<p>In addition, one of the comments by Matthew Bacon was about getting the ZEND FRAMWORK up and running with the command line. I have copied it here for your convenience. I hope this helps someone.</p>
<p><span style="color: #666699;"><small> Posted by Matthew Bacon on <time datetime="2010-01-07T10:38:16-08:00" pubdate="pubdate">January 7, 2010. [<a href="http://www.metaltoad.com/comment/reply/71/457"><span style="color: #666699;">Reply</span></a>] </time></small></span></p>
<div>
<div>
<div>
<div>
<p><span style="color: #666699;">To anyone who is having problems getting Zend_Tool working on their MAC OS X (10.6) in Terminal, this is how to solve the problem.</span></p>
<p><span style="color: #666699;">Step 1</span><br />
<span style="color: #666699;"> &#8212;</span><br />
<span style="color: #666699;"> Download the Zend Framework to your downloads folder. Once downloaded, rename the folder ZendFramework</span></p>
<p><span style="color: #666699;">Step 2</span><br />
<span style="color: #666699;"> &#8212;</span><br />
<span style="color: #666699;"> Open Terminal and type: sudo cp -r ~/Downloads/ZendFramework /usr/local/ZendFrameworkCli</span></p>
<p><span style="color: #666699;">Step 3</span><br />
<span style="color: #666699;"> &#8212;</span><br />
<span style="color: #666699;"> In Terminal, type: open ~/.bash_profile</span></p>
<p><span style="color: #666699;">Note: If file is not found&#8230;</span><br />
<span style="color: #666699;"> &#8212;</span><br />
<span style="color: #666699;"> Open the application TextEdit. Create a new file and make sure you are typing in plain text only. Type the following: alias zf=/usr/local/ZendFrameworkCli/bin/zf.sh</span></p>
<p><span style="color: #666699;">Save and exit TextEdit</span></p>
<p><span style="color: #666699;">Step 4</span><br />
<span style="color: #666699;"> &#8212;</span><br />
<span style="color: #666699;"> In Terminal, type: zf show version</span></p>
<p><span style="color: #666699;">Done!</span></p>
</div>
</div>
</div>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/mamp/php-and-mysql-command-line-with-mamp-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Get the Path ID (pid) for a Node&#8217;s Path Alias in Drupal 7</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/how-to-get-the-path-id-pid-for-a-nodes-path-alias-in-drupal-7/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/how-to-get-the-path-id-pid-for-a-nodes-path-alias-in-drupal-7/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 20:14:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=415</guid>
		<description><![CDATA[After searching the internet I found nothing satisfactory for simply finding the Path ID for a node&#8217;s alias. I need this this so that I could programmatic update a node alias in a way that keeps the Drupal site installation updated system wide without conflicts. So, anyway here is a simple function to find the [...]]]></description>
			<content:encoded><![CDATA[<p>After searching the internet I found nothing satisfactory for simply finding the Path ID for a node&#8217;s alias.</p>
<p>I need this this so that I could programmatic update a node alias in a way that keeps the Drupal site installation updated system wide without conflicts. So, anyway here is a simple function to find the alias path id for a given node.</p>
<p>By the way, if you got to   Home » Administration » Configuration » Search and metadata  and then hover over the edit link on the row of the alias in question, you will see the path is in the url.</p>
<blockquote><p><span style="color: #000080;">&lt;?php</span></p>
<p><span style="color: #000080;">/**</span><br />
<span style="color: #000080;"> *</span><br />
<span style="color: #000080;"> * Returns the path alias id for a given alias.</span><br />
<span style="color: #000080;"> *</span><br />
<span style="color: #000080;"> * $nid</span><br />
<span style="color: #000080;"> * int    The node id</span><br />
<span style="color: #000080;"> *</span><br />
<span style="color: #000080;"> */</span><br />
<span style="color: #000080;"> function pathdata_get_pid( $nid ) {</span><br />
<span style="color: #000080;"> if ( isset($nid)  &amp;&amp; is_numeric($nid) ) {</span></p>
<p><span style="color: #000080;">    $source  = &#8216;node/&#8217;. $nid ;</span><br />
<span style="color: #000080;"> $query = db_select(&#8216;url_alias&#8217;, &#8216;ua&#8217;);</span><br />
<span style="color: #000080;"> $result = $query-&gt;fields(&#8216;ua&#8217; )</span><br />
<span style="color: #000080;"> -&gt;condition( &#8216;source&#8217;, $source , &#8216;=&#8217;)</span><br />
<span style="color: #000080;"> -&gt;execute();</span><br />
<span style="color: #000080;"> $data = $result-&gt;fetchAssoc();</span><br />
<span style="color: #000080;"> return $data['pid'];</span><br />
<span style="color: #000080;"> }</span><br />
<span style="color: #000080;"> else {</span><br />
<span style="color: #000080;"> return 0;</span><br />
<span style="color: #000080;"> }</span><br />
<span style="color: #000080;"> }</span></p>
<p><span style="color: #000080;">?&gt;</span></p></blockquote>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/how-to-get-the-path-id-pid-for-a-nodes-path-alias-in-drupal-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DRUPAL: Broken Teaser (or body) Text Showing Up at the Top of Page.</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-broken-teaser-or-body-text-showing-up-at-the-top-of-page/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-broken-teaser-or-body-text-showing-up-at-the-top-of-page/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 15:51:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=341</guid>
		<description><![CDATA[The output of some of the webpages was spilling out at the top of the page as broken HTML. I knew that the body or teaser was somehow getting printed out prior to the body loading. At first, a friend suggested that the problem was unfiltered use of the $vars['node']-&#62;body in the Organic Groups module. [...]]]></description>
			<content:encoded><![CDATA[<p>The output of some of the webpages was spilling out at the top of the page as broken HTML. I knew that the body or teaser was somehow getting printed out prior to the body loading. At first, a friend suggested that the problem was unfiltered use of the $vars['node']-&gt;body in the Organic Groups module. It turned out to be unfiltered output of the $vars['node']-&gt;teaser (could just as well been the body) was being used by some meta tag creating logic for a facebook comment button. The broken code was in the template.php file.</p>
<p>The fix was simple. All I had to do was add PHP’s strip_tags() function to filter out the HTML that was finding its way into the META tag like this:</p>
<p><img class="alignnone size-full wp-image-344" title="strip-tags-fix-node-teaser" src="http://www.rubberneckdesigns.com/wp-content/uploads/2011/04/strip-tags-fix-node-teaser2.jpg" alt="strip-tags-fix-node-teaser" width="454" height="177" /></p>
<p>Problem solved! I hope this was helpful for someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-broken-teaser-or-body-text-showing-up-at-the-top-of-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When using hook_form_alter on the user.module’s form</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/when-using-hook_form_alter-on-the-user-module%e2%80%99s-form/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/when-using-hook_form_alter-on-the-user-module%e2%80%99s-form/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 02:15:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=323</guid>
		<description><![CDATA[I recently spent some time scratching my head and trying to troubleshoot some very odd behavior when using hook_form-alter() on the user_form. The checkbox for the “agree” to the legal ease stopped working for one thing. In addition to that, the form refused to redirect even though I was doing everything right. I quadruple checked [...]]]></description>
			<content:encoded><![CDATA[<p>I recently spent some time scratching my head and trying to troubleshoot some very odd behavior when using hook_form-alter() on the user_form. The checkbox for the “agree” to the legal ease stopped working for one thing. In addition to that, the form refused to redirect even though I was doing everything right. I quadruple checked my syntax and methods over and over. What could it be?!</p>
<p>As it turns out, it was a permissions problem. Dugh! I had set the access to be true if the user was logged in as a certain role. However, as we all know the user form only work for anonymous user so that they can log in. If the user is logged in, it does not allow access. By trying to use hook_form_alter() with a permissions conflict the resulting form was understandably misbehaving.</p>
<p>So there you have it. Another honest admission of a lesson learned by trial and error. I hope this will save someone a few hours in their efforts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/when-using-hook_form_alter-on-the-user-module%e2%80%99s-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Comments In A Block</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-comments-in-a-block/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-comments-in-a-block/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 15:22:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[User Iterface Design]]></category>
		<category><![CDATA[Web Security]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=298</guid>
		<description><![CDATA[Why would you need to put Drupal comments into a block?  Well, recently I was working with another developer that decided to use Quick Tabs to create a menu that would show the current content type&#8217;s comments. Quick Tabs uses blocks, so there is one reason I can think of. Ok, so getting the content [...]]]></description>
			<content:encoded><![CDATA[<p>Why would you need to put Drupal comments into a block?  Well, recently I was working with another developer that decided to use Quick Tabs to create a menu that would show the current content type&#8217;s comments. Quick Tabs uses blocks, so there is one reason I can think of.</p>
<p>Ok, so getting the content type&#8217;s comments into a block is pretty easy once you know how.</p>
<p>This method will require you to use PHP code from within the block you will create to show the comments. So the first thing is to make sure that this is possible by going to site building and then modules and turning on the <strong>PHP Filter</strong> under the category of Core Optional (if it is not already on that is).</p>
<p><strong>NOTE: </strong>Check at <code>admin/settings/filters</code> to be sure that only trusted roles can use the PHP filter, otherwise your web site could be vulnerable to attack. By default, only the administrator can use this filter.</p>
<p>Create a new block and select a region for it. Put the following code on the <strong>body</strong> textarea:</p>
<p><img class="alignnone size-medium wp-image-308" title="comments in block php code for drupal" src="http://www.rubberneckdesigns.com/wp-content/uploads/2010/04/Screen-shot-2010-04-10-at-11.04.14-AM-300x186.jpg" alt="comments in block php code for drupal" width="300" height="186" /></p>
<p>Do not forget to select the <strong>PHP filter</strong> from the list of the <em>input filters</em>. After entering the rest of the settings for your block click save.</p>
<p>Now your new block should be ready to assign to whatever region you want. If the page you load has comments related to it. They should now appear via the block.</p>
<p>The arg() funtion may seem a bit cryptic if you&#8217;re new to Drupal. Here is a quick explanation from <a href="http://www.g-loaded.eu/2009/05/07/drupal-tip-list-a-nodes-taxonomy-terms-inside-a-block/#comment-12266">George Notaras</a> in his post: <a title="Drupal Tip: List a node’s taxonomy terms inside a Block" rel="bookmark" href="http://www.g-loaded.eu/2009/05/07/drupal-tip-list-a-nodes-taxonomy-terms-inside-a-block/">Drupal Tip: List a node’s taxonomy terms inside a Block</a> which I found helpful in compiling this information.</p>
<blockquote><p><span style="color: #0000ff;"><em>&#8220;Now to some technical details about <strong>arg(0)</strong> and <strong>arg(1)</strong>, which probably seem a bit cryptic to a user that is not experienced with Drupal (like me). Assume we have the following <strong>URL</strong> to a node: <code>www.example.org/node/23</code>, which means that the <strong>path</strong> to the page is <code>/node/23</code>. Well, </em><em>arg(0) is the <code>node</code> part and </em><em>arg(1) is the second part; <code>23</code> that is. Read about the <a href="http://api.drupal.org/api/function/arg">arg()</a> function.&#8221;</em></span></p></blockquote>
<p>I hope this was helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-comments-in-a-block/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX  Shopping Cart Design Using PayJuntion as the Gateway</title>
		<link>http://www.rubberneckdesigns.com/php/ajax-shopping-cart-design-using-payjuntion-as-the-gateway/</link>
		<comments>http://www.rubberneckdesigns.com/php/ajax-shopping-cart-design-using-payjuntion-as-the-gateway/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 14:22:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Search Engine Optimization]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=279</guid>
		<description><![CDATA[I am working on a new shopping cart where all the action happens on one page in a simple non-distracted environment. PayJunction inc. will be the gateway I am using. I&#8217;ll keep you posted once I have made significant progress. If you have any specific question or issues you need addressed or even suggestions feel [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a new shopping cart where all the action happens on one page in a simple non-distracted environment. PayJunction inc. will be the gateway I am using. I&#8217;ll keep you posted once I have made significant progress. If you have any specific question or issues you need addressed or even suggestions feel free to post your comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/php/ajax-shopping-cart-design-using-payjuntion-as-the-gateway/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Schema Data Structure Documentation in Drupal</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/schema-data-structure-documentation-in-drupal/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/schema-data-structure-documentation-in-drupal/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 23:06:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Drupal database scheme]]></category>
		<category><![CDATA[Drupal install file]]></category>
		<category><![CDATA[Drupal module install]]></category>

		<guid isPermaLink="false">http://rubberneckdesigns.com/?p=210</guid>
		<description><![CDATA[I have been working on a project on the Drupal 6 platform that requires the web application to recognize dynamically created sub-domains so the functionality of the database can be adjusted according to what sub-domain is in the current URL. To get Drupal 6 to do this, I am creating a custom module. One of [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on a project on the Drupal 6 platform that requires the web application to recognize dynamically created sub-domains so the functionality of the database can be adjusted according to what sub-domain is in the current URL.</p>
<p>To get Drupal 6 to do this, I am creating a custom module. One of the things I have learned about creating a custom module in Drupal 6 is the implementation of the module&#8217;s “install” file.</p>
<p>If you create a module named say,  my_module.module then the module&#8217;s install file name would be  my_module.install and will reside in the directory named my_module located at&#8230;.</p>
<p>my_site/sites/all/modules/my_module</p>
<p><a href="http://http://drupal.org/node/323314">Drupal 6 Module Install File Documentation</a></p>
<p>The  .install file will be run by Drupal 6 the 1st time my_module has been enabled. The my_module.install file will then be used to run setup procedures as stipulated by your module. The most common task for the my_module.install file to perform is creating database tables and fields. There is no special syntax for the install file. It is simply a PHP file with a .install extension to properly identify it to the Drupal 6 platform.</p>
<p>There is special function used in the .install file called hook_schema(). Where hook would be replaced by the name of your module. For example, if  the module you create is named my_module, then you would create a PHP file and name it my_module.install. Inside that file you will create a function named  my_module_schema(). The my_module_schema() function is used to create arrays representingthe database tables you wish the module to create in the Drupal database. You can see how this works here.</p>
<h3>Why do it this way?</h3>
<p>Once you build the Drupal API Schema there is no more need for  separate CREATE TABLE or ALTER TABLE statements on each database. As a module developer, you only need to create a schema structure and/or use the Drupal Schema API functions, and Drupal takes care of the rest. This greatly simplifies  writing install and update functions.</p>
<p>This way of creating the module install files also allows for support in multiple database platforms.</p>
<p>According to Drupal&#8217;s Blog this also allows for “Several advanced capabilities, such as incremental database updates, a simple and consistent CRUD API, form scaffolding, simpler CCK and Views, schema and data validation, become much easier to implement in future enhancements.”</p>
<p><a href="http://http://drupal.org/node/146866">Schema Data Structure Documentation by Drupal</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/schema-data-structure-documentation-in-drupal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wild Card Sub Domains</title>
		<link>http://www.rubberneckdesigns.com/apache/wild-card-sub-domains/</link>
		<comments>http://www.rubberneckdesigns.com/apache/wild-card-sub-domains/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 23:04:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[dynamic sub domain]]></category>
		<category><![CDATA[recognise sub domains]]></category>
		<category><![CDATA[sub domains Drupal]]></category>
		<category><![CDATA[sub domains in Plesk]]></category>
		<category><![CDATA[sub-domain]]></category>

		<guid isPermaLink="false">http://rubberneckdesigns.com/?p=212</guid>
		<description><![CDATA[I am working on a web site that will be taking on many Individual Business Owners. The web site is designed to create sub domains created dynamically according to the input of users as they sign up for the service. Since the web site is expected to accommodate up to 30,000 users it would not [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a web site that will be taking on many Individual Business Owners. The web site is designed to create sub domains created dynamically according to the input of users as they sign up for the service. Since the web site is expected to accommodate up to 30,000 users it would not be practical to edit the httpd.conf configuration file in Apache for each one. The file would simply grow to be enormous. The solution? Create wild-card sub domains.</p>
<p>Wild-card sub domains can be a great way to handle multiple sub domains that need to be created dynamically by making a simple edit to Apache via the terminal and some creative PHP programming.</p>
<p>The first step is alter Apache. There are a few ways to do this depending on how your server is set up.<br />
Here are some links I have found on how to do this in various server environments;</p>
<ul>
<li><a href="http://http://rackerhacker.com/2007/08/10/using-wildcard-subdomains-in-plesk/">PLesk</a></li>
<li><a href="http://http://kb.siteground.com/article/How_to_enable_wildcard_subdomains.html">cPanel</a></li>
<li><a href="http://http://steinsoft.net/index.php?site=programming/articles/apachewildcarddomain">In Apache</a></li>
</ul>
<p><strong>NOTE:</strong> In the case of the project I am working on, we have a dedicated server by RackSpace. It was necessary to register the wild-card sub-domain ( *.you-domain.com ) with their name servers as well in order for this to work.</p>
<h3>Step One: Set Up a Wild Card DNS Record</h3>
<p>The first step is to create a wildcard DNS record. Your DNS server is already resolving visitors to domain.tld, but it doesn&#8217;t know where to resolve them to find subdomain1.domain.tld.</p>
<p>You&#8217;ll need to create what is called an &#8220;A record,&#8221; which is short for &#8220;address record.&#8221; As the name implies, &#8220;A records&#8221; tell what IP address a host is pointing to.</p>
<p>The way to do this will vary based on your DNS server and what control panel (or command line) you are using, most are somewhat similar. When you create a name record of type “A” pointing from *.domain.tld to your web server&#8217;s IP address.</p>
<p>If you are using a control panel, then likely you can set this using a web form. Sometimes have to get your web host to do this.</p>
<p>Your web server&#8217;s DNS service may need to be restarted. You can expext it to take a few hours or even up to a few days sometimes to propagate throughout the Internet.</p>
<h3>Step Two: Set Up a Wild Card DNS Record</h3>
<p>Test and make sure it working by typing in a random sub-domain url to your site ( ie. Http://random-name.your-domain.com  ). It should resolve to your site&#8217;s home.</p>
<p>Now that any sub-domain will point to your domain, you can use some PHP to determine what URL brought your user to your site. Once you have that knowledge you can manipulate the functionality of  your site accordingly. Pretty cool!</p>
<h3>Recognize Which Sub Domain Brought Your Visitor With PHP</h3>
<p>One way to “recognize” the subdomain from the URL that brought you visitor is to use the a supper global ( which means they are available in all scopes throughout a script. There is no need to do global $variable; to access them within functions or methods) server variable called $_SERVER['HTTP_HOST'].</p>
<p>This super global variable will return the host name.<br />
ie.   sub-domain.your-domain.com<br />
( if there is no sub- domain then it would just be the domain.com)</p>
<p>If you use PHP&#8217;s explode with “.” as the delimiter, you can isolate the sub-domain by separating out the first element of the resulting array of URL parts like this&#8230;</p>
<p>$url_sections = explode(&#8220;.&#8221;,$_SERVER['HTTP_HOST']);<br />
$subdomain =$url_sections[0];</p>
<p>Knowing what sub-domain you&#8217;re dealing with gives you the PHP power to make you scripts act accordingly. In my case, I used the extracted information for the “virtual” sub-domain to query the MySQL database.</p>
<p>Wild card sub domains can useful for content management platforms like Drupal. With wild card sub domains and a little cleverness you can handle multiple sub domains within a single installation of Drupal.</p>
<h3>A Special Note Regarding  SEO</h3>
<p>It is very important that you do not have more than one URL (including the sub domain) point to identical content. Google penalizes for &#8220;duplicate content&#8221; so be sure not to carelessly point various unknown sub domains at your sites home page. With wild card sub domains, if a user makes a mistake and types in a misspelling then use PHP to redirect their page in some way that corrects them and then points them to the right page.</p>
<p>If you are dealing with this already and have any comments or suggestions or corrections feel free to post a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/apache/wild-card-sub-domains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

