<?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"
	>

<channel>
	<title>Media Growl Blog</title>
	<atom:link href="http://mediagrowl.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://mediagrowl.com/blog</link>
	<description>Official blog of Media Growl</description>
	<pubDate>Tue, 11 May 2010 15:41:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Use a PHP variable in your Javascript code</title>
		<link>http://mediagrowl.com/blog/posts/use-a-php-variable-in-your-javascript-code/</link>
		<comments>http://mediagrowl.com/blog/posts/use-a-php-variable-in-your-javascript-code/#comments</comments>
		<pubDate>Tue, 11 May 2010 15:20:35 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=40</guid>
		<description><![CDATA[What if you&#8217;d like to use a PHP variable in your javascript code? 
You can use this code in your javascript:



var VarName = ;


 
In order to use this PHP function, you need to have at PHP version 5.2.
What does this function do? This returns the JSON representation of a value. Take note that this [...]]]></description>
			<content:encoded><![CDATA[<p>What if you&#8217;d like to use a PHP variable in your javascript code? </p>
<p>You can use this code in your javascript:</p>
<pre>
<?php
$VarValue = "Hello World";
?>
<script>
var VarName = <?= json_encode($VarValue); ?>;
</script>
</pre>
<p> <span id="more-40"></span></p>
<p>In order to use this PHP function, you need to have at PHP version 5.2.</p>
<p>What does this function do? This returns the JSON representation of a value. Take note that this function works only with data encoded in UTF-8.  </p>
<p>Learn more about the function <a href="http://php.net/manual/en/function.json-encode.php" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/use-a-php-variable-in-your-javascript-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;Become a Fan&#8221; button has been replaced with &#8220;Like&#8221;</title>
		<link>http://mediagrowl.com/blog/posts/become-a-fan-button-has-been-replaced-with-like/</link>
		<comments>http://mediagrowl.com/blog/posts/become-a-fan-button-has-been-replaced-with-like/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 07:29:23 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[Internet Marketing]]></category>

		<category><![CDATA[Social Media]]></category>

		<category><![CDATA[Usability]]></category>

		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=39</guid>
		<description><![CDATA[Just recently, the &#8220;Become a Fan&#8221; button in Facebook pages have been replaced with &#8220;Like&#8221;. For those who are using Facebook Pages for their online contests, you may want to revise your contest mechanics. 
Why it was changed?
To improve your experience and promote consistency across the site, we&#8217;ve changed the language for Pages from &#8220;Fan&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Just recently, the &#8220;Become a Fan&#8221; button in Facebook pages have been replaced with &#8220;Like&#8221;. For those who are using Facebook Pages for their online contests, you may want to revise your contest mechanics. <span id="more-39"></span></p>
<p><a href="http://www.facebook.com/help/?faq=17167" target="_blank">Why it was changed?</a></p>
<blockquote><p>To improve your experience and promote consistency across the site, we&#8217;ve changed the language for Pages from &#8220;Fan&#8221; to &#8220;Like.&#8221; We believe this change offers you a more light-weight and standard way to connect with people, things and topics in which you are interested.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/become-a-fan-button-has-been-replaced-with-like/feed/</wfw:commentRss>
		</item>
		<item>
		<title>XML-RPC2 and Drupal&#8217;s Services Module</title>
		<link>http://mediagrowl.com/blog/posts/xml-rpc2-and-drupals-services-module/</link>
		<comments>http://mediagrowl.com/blog/posts/xml-rpc2-and-drupals-services-module/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 07:20:31 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=38</guid>
		<description><![CDATA[Sometimes, there will be a need for you to integrate Drupal content to a non-Drupal content. For instance, the non-Drupal content is in PHP and you want to have the same menu from Drupal to appear on your non-Drupal site. You can do that using the Drupal Services module and using PEAR&#8217;s XML-RPC2 Library. 
A [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, there will be a need for you to integrate Drupal content to a non-Drupal content. For instance, the non-Drupal content is in PHP and you want to have the same menu from Drupal to appear on your non-Drupal site. You can do that using the Drupal <a href="http://drupal.org/projec/services" target="_blank">Services</a> module and using PEAR&#8217;s XML-RPC2 Library. <span id="more-38"></span></p>
<p>A concise example can be found using this <a href="http://drupal-dev.blogspot.com/2009/12/drupal-services-module.html" target="_blank">page</a></p>
<p>The example that was linked does not use the key authentication. However, I would not recommend for you not to use the key authentication so that you can prevent other people accessing the API without your knowledge.</p>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/xml-rpc2-and-drupals-services-module/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Displaying the total number of times the node has been accessed</title>
		<link>http://mediagrowl.com/blog/posts/displaying-the-total-number-of-times-the-node-has-been-accessed/</link>
		<comments>http://mediagrowl.com/blog/posts/displaying-the-total-number-of-times-the-node-has-been-accessed/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 17:16:40 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=37</guid>
		<description><![CDATA[Seriously, you do not need to manually query SQL statements just to get how many times the node has been accessed in Drupal. First, make sure that the Statistics module is enabled. Then, all you need to do is write this piece of code:



So why do we need to enable the Statistics module? We need [...]]]></description>
			<content:encoded><![CDATA[<p>Seriously, you do not need to manually query SQL statements just to get how many times the node has been accessed in Drupal. First, make sure that the Statistics module is enabled. Then, all you need to do is write this piece of code:</p>
<p><code><br />
<?<br />
	$node_stats = array();<br />
	$node_stats = statistics_get($node->nid);<br />
        print $node_stats['totalcount'];<br />
?></code></p>
<p><span id="more-37"></span></p>
<p>So why do we need to enable the Statistics module? We need to do it to be able to make use of the said function. In addition, this module will record in the database how many times the node has been accessed. Statistics is a core Drupal module.</p>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/displaying-the-total-number-of-times-the-node-has-been-accessed/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Theming Drupal&#8217;s Pager</title>
		<link>http://mediagrowl.com/blog/posts/theming-drupals-pager/</link>
		<comments>http://mediagrowl.com/blog/posts/theming-drupals-pager/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 15:06:46 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Drupal 6 theming]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=36</guid>
		<description><![CDATA[There are times that you would like to edit how the pagination of Drupal is displayed. To give you more control aside from editing the stylesheet, let&#8217;s use the theme_pager() function in our template.php file. 
In your theme&#8217;s template.php Insert the following code:
function phptemplate_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), [...]]]></description>
			<content:encoded><![CDATA[<p>There are times that you would like to edit how the pagination of Drupal is displayed. To give you more control aside from editing the stylesheet, let&#8217;s use the <strong>theme_pager()</strong> function in our <strong>template.php</strong> file. <span id="more-36"></span></p>
<p>In your theme&#8217;s <strong>template.php</strong> Insert the following code:</p>
<p><code>function phptemplate_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) {<br />
global $pager_page_array, $pager_total;</p>
<p>// Calculate various markers within this pager piece:<br />
// Middle is used to "center" pages around the current page.<br />
$pager_middle = ceil($quantity / 2);<br />
// current is the page we are currently paged to<br />
$pager_current = $pager_page_array[$element] + 1;<br />
// first is the first page listed by this pager piece (re quantity)<br />
$pager_first = $pager_current - $pager_middle + 1;<br />
// last is the last page listed by this pager piece (re quantity)<br />
$pager_last = $pager_current + $quantity - $pager_middle;<br />
// max is the maximum page number<br />
$pager_max = $pager_total[$element];<br />
// End of marker calculations.</p>
<p>// Prepare for generation loop.<br />
$i = $pager_first;<br />
if ($pager_last &gt; $pager_max) {<br />
// Adjust &#8220;center&#8221; if at end of query.<br />
$i = $i + ($pager_max - $pager_last);<br />
$pager_last = $pager_max;<br />
}<br />
if ($i &lt;= 0) {<br />
// Adjust &#8220;center&#8221; if at start of query.<br />
$pager_last = $pager_last + (1 - $i);<br />
$i = 1;<br />
}<br />
// End of generation loop preparation.</p>
<p>$li_first = theme(&#8217;pager_first&#8217;, (isset($tags[0]) ? $tags[0] : t(&#8217;&lt; first&#8217;)), $limit, $element, $parameters);<br />
$li_previous = theme(&#8217;pager_previous&#8217;, (isset($tags[1]) ? $tags[1] : t(&#8217;&lt;&#8217;)), $limit, $element, 1, $parameters);<br />
$li_next = theme(&#8217;pager_next&#8217;, (isset($tags[3]) ? $tags[3] : t(&#8217;&gt;&#8217;)), $limit, $element, 1, $parameters);<br />
$li_last = theme(&#8217;pager_last&#8217;, (isset($tags[4]) ? $tags[4] : t(&#8217;last &gt;&#8217;)), $limit, $element, $parameters);</p>
<p>if ($pager_total[$element] &gt; 1) {<br />
if ($li_first) {<br />
$items[] = array(<br />
&#8216;class&#8217; =&gt; &#8216;pager-first&#8217;,<br />
&#8216;data&#8217; =&gt; $li_first,<br />
);<br />
}<br />
if ($li_previous) {<br />
$items[] = array(<br />
&#8216;class&#8217; =&gt; &#8216;pager-previous&#8217;,<br />
&#8216;data&#8217; =&gt; $li_previous,<br />
);<br />
}</p>
<p>// When there is more than one page, create the pager list.<br />
if ($i != $pager_max) {<br />
if ($i &gt; 1) {<br />
$items[] = array(<br />
&#8216;class&#8217; =&gt; &#8216;pager-ellipsis&#8217;,<br />
&#8216;data&#8217; =&gt; &#8216;…&#8217;,<br />
);<br />
}<br />
// Now generate the actual pager piece.<br />
for (; $i &lt;= $pager_last &amp;&amp; $i &lt;= $pager_max; $i++) {<br />
if ($i &lt; $pager_current) {<br />
$items[] = array(<br />
&#8216;class&#8217; =&gt; &#8216;pager-item&#8217;,<br />
&#8216;data&#8217; =&gt; theme(&#8217;pager_previous&#8217;, $i, $limit, $element, ($pager_current - $i), $parameters),<br />
);<br />
}<br />
if ($i == $pager_current) {<br />
$items[] = array(<br />
&#8216;class&#8217; =&gt; &#8216;pager-current&#8217;,<br />
&#8216;data&#8217; =&gt; $i,<br />
);<br />
}<br />
if ($i &gt; $pager_current) {<br />
$items[] = array(<br />
&#8216;class&#8217; =&gt; &#8216;pager-item&#8217;,<br />
&#8216;data&#8217; =&gt; theme(&#8217;pager_next&#8217;, $i, $limit, $element, ($i - $pager_current), $parameters),<br />
);<br />
}<br />
}<br />
if ($i &lt; $pager_max) {<br />
$items[] = array(<br />
&#8216;class&#8217; =&gt; &#8216;pager-ellipsis&#8217;,<br />
&#8216;data&#8217; =&gt; &#8216;…&#8217;,<br />
);<br />
}<br />
}<br />
// End generation.<br />
if ($li_next) {<br />
$items[] = array(<br />
&#8216;class&#8217; =&gt; &#8216;pager-next&#8217;,<br />
&#8216;data&#8217; =&gt; $li_next,<br />
);<br />
}<br />
if ($li_last) {<br />
$items[] = array(<br />
&#8216;class&#8217; =&gt; &#8216;pager-last&#8217;,<br />
&#8216;data&#8217; =&gt; $li_last,<br />
);<br />
}<br />
return theme(&#8217;item_list&#8217;, $items, NULL, &#8216;ul&#8217;, array(&#8217;class&#8217; =&gt; &#8216;pager&#8217;));<br />
}<br />
}</code></p>
<p>Here&#8217;s how the pagination looks like using the above function.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://imgur.com/JU2EC.png" alt="pagination" /></p>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/theming-drupals-pager/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using an image link menu in Drupal 6 instead of text</title>
		<link>http://mediagrowl.com/blog/posts/using-an-image-link-menu-in-drupal-6-instead-of-text/</link>
		<comments>http://mediagrowl.com/blog/posts/using-an-image-link-menu-in-drupal-6-instead-of-text/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 02:46:58 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Drupal 6 theming]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=35</guid>
		<description><![CDATA[Sometimes, we don&#8217;t want to limit our creativity by just using text in all of the menu items. Sometimes, we would want to use an image as a link in a menu.
For example, you want to have Home as an image link rather than a text link. Here&#8217;s a code you can use in your [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, we don&#8217;t want to limit our creativity by just using text in all of the menu items. Sometimes, we would want to use an image as a link in a menu.</p>
<p>For example, you want to have Home as an image link rather than a text link. Here&#8217;s a code you can use in your theme&#8217;s <strong>template.php</strong> file. <span id="more-35"></span></p>
<p><code>function phptemplate_menu_item_link($link) {</p>
<p>  if ($link['title']==&#8217;Home&#8217;) {<br />
	 $link['localized_options']['html'] = TRUE;<br />
         $image_path = path_to_theme(). &#8216;images/home.png&#8217;;<br />
         $title = &#8216;Home&#8217;;<br />
         $link['title'] = theme(&#8217;image&#8217;, $image_path, $title, $title);<br />
	return theme_menu_item_link($link);<br />
  }</p>
<p>  else {<br />
    return theme_menu_item_link($link);<br />
  }<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/using-an-image-link-menu-in-drupal-6-instead-of-text/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Display your Drupal Search Form</title>
		<link>http://mediagrowl.com/blog/posts/display-drupal-search-form/</link>
		<comments>http://mediagrowl.com/blog/posts/display-drupal-search-form/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 07:46:07 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Drupal 6 theming]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=34</guid>
		<description><![CDATA[The first step you would want to consider in displaying your Drupal Search Form is to use install the search module. A fresh installation of Drupal does not include yet the search form in the installed and enable modules. Then, apply the desired settings that you want for your search form and add necessary permissions. [...]]]></description>
			<content:encoded><![CDATA[<p>The first step you would want to consider in displaying your Drupal Search Form is to use install the search module. A fresh installation of Drupal does not include yet the search form in the installed and enable modules. Then, apply the desired settings that you want for your search form and add necessary permissions. <span id="more-34"></span></p>
<p>In your <strong>page-tpl.php</strong>, add this code where you want to place the search form.</p>
<p><code>print drupal_get_form('search_form');</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/display-drupal-search-form/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fixing Fatal error: Call to a member function add_current_page() is osCommerce</title>
		<link>http://mediagrowl.com/blog/posts/fixing-fatal-error-call-to-a-member-function/</link>
		<comments>http://mediagrowl.com/blog/posts/fixing-fatal-error-call-to-a-member-function/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 07:52:43 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[e-Commerce]]></category>

		<category><![CDATA[osCommerce]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=33</guid>
		<description><![CDATA[Recently, I experienced getting this error on osCommerce:
Fatal error: Call to a member function add_current_page() on a non-object 
This happened while I was uploading a file and then I tried accessing the site. So, what I did is to delete the domain cookies so that I won&#8217;t get the error.
]]></description>
			<content:encoded><![CDATA[<p>Recently, I experienced getting this error on osCommerce:</p>
<p><strong>Fatal error: Call to a member function add_current_page() on a non-object </strong></p>
<p>This happened while I was uploading a file and then I tried accessing the site. So, what I did is to delete the domain cookies so that I won&#8217;t get the error.</p>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/fixing-fatal-error-call-to-a-member-function/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting the current order ID in osCommerce</title>
		<link>http://mediagrowl.com/blog/posts/getting-the-current-order-id-in-oscommerce/</link>
		<comments>http://mediagrowl.com/blog/posts/getting-the-current-order-id-in-oscommerce/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 05:06:30 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[e-Commerce]]></category>

		<category><![CDATA[osCommerce]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=32</guid>
		<description><![CDATA[Sometimes, you need to get the current order ID of a transaction in progress. This is probably because you want to put a Google Analytics Tracking Code or you might want to save the transaction ID generated by your payment gateway into your database. 
Since you won&#8217;t be able to access the order ID through [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, you need to get the current order ID of a transaction in progress. This is probably because you want to put a <a href="http://blog.jayare.eu/e-commerce-tracking-in-oscommerce-with-new-google-analytics-tracking-code.html" target="_blank">Google Analytics Tracking Code</a> or you might want to save the transaction ID generated by your payment gateway into your database. <span id="more-32"></span></p>
<p>Since you won&#8217;t be able to access the order ID through the <strong>class order</strong>, here&#8217;s a way to do it.</p>
<p><code></p>
<p>global $customer_id;</p>
<p>$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1");<br />
$orders = tep_db_fetch_array($orders_query);<br />
$order_id = $orders['orders_id'];</p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/getting-the-current-order-id-in-oscommerce/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Problem with Force Cookies Set to True in osCommerce?</title>
		<link>http://mediagrowl.com/blog/posts/problem-with-force-cookies-set-to-true-in-oscommerce/</link>
		<comments>http://mediagrowl.com/blog/posts/problem-with-force-cookies-set-to-true-in-oscommerce/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 20:23:42 +0000</pubDate>
		<dc:creator>karlaredor</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[e-Commerce]]></category>

		<category><![CDATA[osCommerce]]></category>

		<guid isPermaLink="false">http://mediagrowl.com/blog/?p=31</guid>
		<description><![CDATA[By default, an osCommerce installation would have a session setting &#8220;Force Cookies On = False&#8221;. The problem with such setting arises when your payment gateway sets the path where to return the result of transaction. This means that the session is lost. 
In configuring the file includes/configure.php, you should always set the cookie path to:

define('HTTP_COOKIE_PATH', [...]]]></description>
			<content:encoded><![CDATA[<p>By default, an osCommerce installation would have a session setting &#8220;Force Cookies On = False&#8221;. The problem with such setting arises when your payment gateway sets the path where to return the result of transaction. This means that the session is lost. <span id="more-31"></span></p>
<p>In configuring the file <strong>includes/configure.php</strong>, you should always set the cookie path to:<br />
<code><br />
define('HTTP_COOKIE_PATH', '/');<br />
define('HTTPS_COOKIE_PATH', '/');<br />
</code></p>
<p>I recently encountered a problem by setting a different cookie path and every time I try to log in as a customer, I am redirected to a page that says <strong>Cookies must be enabled</strong>.</p>
<p>If you do not want to session IDs to be appended to your URLs, then I&#8217;d recommend for you to set force cookies to true in your admin configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://mediagrowl.com/blog/posts/problem-with-force-cookies-set-to-true-in-oscommerce/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
