<?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>Prestashop Brisbane Web Design, Silverstripe osCommerce File Browser, Javascript, PHP, Web Development &#187; PHP</title>
	<atom:link href="http://www.jellygnite.com.au/blog/index.php/category/web-development/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jellygnite.com.au/blog</link>
	<description>Web design advice on Prestashop, Silverstripe, osCommerce, javascript, PHP, web techniques</description>
	<lastBuildDate>Mon, 12 Dec 2011 04:11:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Update: Display HTML in Prestashop Category Description (v 1.4)</title>
		<link>http://www.jellygnite.com.au/blog/index.php/archive/update-display-html-in-prestashop-category-description-v-1-4/</link>
		<comments>http://www.jellygnite.com.au/blog/index.php/archive/update-display-html-in-prestashop-category-description-v-1-4/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 01:52:17 +0000</pubDate>
		<dc:creator>Jim Chisholm</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jellygnite.com.au/blog/?p=33</guid>
		<description><![CDATA[Update for Prestashop version 1.4 
When you enter a category into Prestashop you have the ability to enter a description. This only allows text though &#8211; no HTML.
Find out how to display HTML in Prestashop&#8217;s category description&#8230;
	
You need to make some changes to Prestashop&#8217;s core code so please be advised any future upgrades may overwrite [...]]]></description>
			<content:encoded><![CDATA[<p>Update for Prestashop version 1.4 </p>
<p>When you enter a category into Prestashop you have the ability to enter a description. This only allows text though &#8211; no HTML.</p>
<p>Find out how to display HTML in Prestashop&#8217;s category description&#8230;</p>
<p>	<span id="more-33"></span></p>
<p>You need to make some changes to Prestashop&#8217;s core code so please be advised any future upgrades may overwrite your changes. Backup all files before beginning!	</p>
<p>These changes have been tested with Prestashop version 1.4</p>
<p>23 Sep 2011 : I have updated to include the WYSYWIG editor. Please note these changes are optional and make changes to Prestashop&#8217;s core code. </p>
<h3>1. Create a file called Category.php  in the /override/classes   folder</h3>
<p>Add the content below to Category.php:</p>
<pre class="html" name="code">&lt;?php

class Category extends CategoryCore
{
    public function getTranslationsFieldsChild() {
        self::validateFieldsLang();

        $fieldsArray = array('name', 'link_rewrite', 'meta_title', 'meta_keywords', 'meta_description');
        $fields = array();
        $languages = Language::getLanguages();
        $defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
        foreach ($languages as $language)
        {
            $fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
            $fields[$language['id_lang']][$this-&gt;identifier] = intval($this-&gt;id);
            $fields[$language['id_lang']]['description'] = (isset($this-&gt;description[$language['id_lang']])) ? Tools::htmlentitiesDecodeUTF8(pSQL($this-&gt;description[$language['id_lang']], true)) : '';
            foreach ($fieldsArray as $field)
            {
                if (!Validate::isTableOrIdentifier($field))
                    die(Tools::displayError());

                /* Check fields validity */
                if (isset($this-&gt;{$field}[$language['id_lang']]) AND !empty($this-&gt;{$field}[$language['id_lang']]))
                    $fields[$language['id_lang']][$field] = pSQL($this-&gt;{$field}[$language['id_lang']]);
                elseif (in_array($field, $this-&gt;fieldsRequiredLang))
                    $fields[$language['id_lang']][$field] = pSQL($this-&gt;{$field}[$defaultLanguage]);
                else
                    $fields[$language['id_lang']][$field] = '';
            }
        }
        return $fields;
    }
}
</pre>
<h3>2. Create a file called AdminTab.php  in the /override/classes   folder</h3>
<p>To convert tags in the category listing in the admin area you need to add in<br />
Tools::htmlentitiesUTF8 to the value being printed.</p>
<p>Add the content below to AdminTab.php:</p>
<pre class="html" name="code">&lt;?php
class AdminTab extends AdminTabCore
 	{
 	public function displayListContent($token = NULL)
 	{
 	/* Display results in a table
 	*
 	* align  : determine value alignment
 	* prefix : displayed before value
 	* suffix : displayed after value
 	* image  : object image
 	* icon   : icon determined by values
 	* active : allow to toggle status
 	*/

 global $currentIndex, $cookie;
 	$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));

 $id_category = 1; // default categ

 $irow = 0;
 	if ($this-&gt;_list AND isset($this-&gt;fieldsDisplay['position']))
 	{
 	$positions = array_map(create_function('$elem', 'return (int)($elem[\'position\']);'), $this-&gt;_list);
 	sort($positions);
 	}
 	if ($this-&gt;_list)
 	{
 	$isCms = false;
 	if (preg_match('/cms/Ui', $this-&gt;identifier))
 	$isCms = true;
 	$keyToGet = 'id_'.($isCms ? 'cms_' : '').'category'.(in_array($this-&gt;identifier, array('id_category', 'id_cms_category')) ? '_parent' : '');
 	foreach ($this-&gt;_list AS $i =&gt; $tr)
 	{
 	$id = $tr[$this-&gt;identifier];
 	echo '&lt;tr'.(array_key_exists($this-&gt;identifier,$this-&gt;identifiersDnd) ? ' id=&quot;tr_'.(($id_category = (int)(Tools::getValue('id_'.($isCms ? 'cms_' : '').'category', '1'))) ? $id_category : '').'_'.$id.'_'.$tr['position'].'&quot;' : '').($irow++ % 2 ? ' class=&quot;alt_row&quot;' : '').' '.((isset($tr['color']) AND $this-&gt;colorOnBackground) ? 'style=&quot;background-color: '.$tr['color'].'&quot;' : '').'&gt;
 	&lt;td class=&quot;center&quot;&gt;';
 	if ($this-&gt;delete AND (!isset($this-&gt;_listSkipDelete) OR !in_array($id, $this-&gt;_listSkipDelete)))
 	echo '&lt;input type=&quot;checkbox&quot; name=&quot;'.$this-&gt;table.'Box[]&quot; value=&quot;'.$id.'&quot; class=&quot;noborder&quot; /&gt;';
 	echo '&lt;/td&gt;';
 	foreach ($this-&gt;fieldsDisplay AS $key =&gt; $params)
 	{
 	$tmp = explode('!', $key);
 	$key = isset($tmp[1]) ? $tmp[1] : $tmp[0];
 	echo '
 	&lt;td '.(isset($params['position']) ? ' id=&quot;td_'.(isset($id_category) AND $id_category ? $id_category : 0).'_'.$id.'&quot;' : '').' class=&quot;'.((!isset($this-&gt;noLink) OR !$this-&gt;noLink) ? 'pointer' : '').((isset($params['position']) AND $this-&gt;_orderBy == 'position')? ' dragHandle' : ''). (isset($params['align']) ? ' '.$params['align'] : '').'&quot; ';
 	if (!isset($params['position']) AND (!isset($this-&gt;noLink) OR !$this-&gt;noLink))
 	echo ' onclick=&quot;document.location = \''.$currentIndex.'&amp;'.$this-&gt;identifier.'='.$id.($this-&gt;view? '&amp;view' : '&amp;update').$this-&gt;table.'&amp;token='.($token!=NULL ? $token : $this-&gt;token).'\'&quot;&gt;'.(isset($params['prefix']) ? $params['prefix'] : '');
 	else
 	echo '&gt;';
 	if (isset($params['active']) AND isset($tr[$key]))
 	$this-&gt;_displayEnableLink($token, $id, $tr[$key], $params['active'], Tools::getValue('id_category'), Tools::getValue('id_product'));
 	elseif (isset($params['activeVisu']) AND isset($tr[$key]))
 	echo '&lt;img src=&quot;../img/admin/'.($tr[$key] ? 'enabled.gif' : 'disabled.gif').'&quot;
 	alt=&quot;'.($tr[$key] ? $this-&gt;l('Enabled') : $this-&gt;l('Disabled')).'&quot; title=&quot;'.($tr[$key] ? $this-&gt;l('Enabled') : $this-&gt;l('Disabled')).'&quot; /&gt;';
 	elseif (isset($params['position']))
 	{
 	if ($this-&gt;_orderBy == 'position' AND $this-&gt;_orderWay != 'DESC')
 	{
 	echo '&lt;a'.(!($tr[$key] != $positions[sizeof($positions) - 1]) ? ' style=&quot;display: none;&quot;' : '').' href=&quot;'.$currentIndex.
 	'&amp;'.$keyToGet.'='.(int)($id_category).'&amp;'.$this-&gt;identifiersDnd[$this-&gt;identifier].'='.$id.'
 	&amp;way=1&amp;position='.(int)($tr['position'] + 1).'&amp;token='.($token!=NULL ? $token : $this-&gt;token).'&quot;&gt;
 	&lt;img src=&quot;../img/admin/'.($this-&gt;_orderWay == 'ASC' ? 'down' : 'up').'.gif&quot;
 	alt=&quot;'.$this-&gt;l('Down').'&quot; title=&quot;'.$this-&gt;l('Down').'&quot; /&gt;&lt;/a&gt;';

 echo '&lt;a'.(!($tr[$key] != $positions[0]) ? ' style=&quot;display: none;&quot;' : '').' href=&quot;'.$currentIndex.
 	'&amp;'.$keyToGet.'='.(int)($id_category).'&amp;'.$this-&gt;identifiersDnd[$this-&gt;identifier].'='.$id.'
 	&amp;way=0&amp;position='.(int)($tr['position'] - 1).'&amp;token='.($token!=NULL ? $token : $this-&gt;token).'&quot;&gt;
 	&lt;img src=&quot;../img/admin/'.($this-&gt;_orderWay == 'ASC' ? 'up' : 'down').'.gif&quot;
 	alt=&quot;'.$this-&gt;l('Up').'&quot; title=&quot;'.$this-&gt;l('Up').'&quot; /&gt;&lt;/a&gt;';						}
 	else
 	echo (int)($tr[$key] + 1);
 	}
 	elseif (isset($params['image']))
 	{
 	// item_id is the product id in a product image context, else it is the image id.
 	$item_id = isset($params['image_id']) ? $tr[$params['image_id']] : $id;
 	// If it's a product image
 	if (isset($tr['id_image']))
 	{
 	$image = new Image((int)$tr['id_image']);
 	$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$image-&gt;getExistingImgPath().'.'.$this-&gt;imageType;
 	}else
 	$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)($tr['id_image']) : '').'.'.$this-&gt;imageType;

 	echo cacheImage($path_to_image, $this-&gt;table.'_mini_'.$item_id.'.'.$this-&gt;imageType, 45, $this-&gt;imageType);
 	}
 	elseif (isset($params['icon']) AND (isset($params['icon'][$tr[$key]]) OR isset($params['icon']['default'])))
 	echo '&lt;img src=&quot;../img/admin/'.(isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'].'&quot; alt=&quot;'.$tr[$key]).'&quot; title=&quot;'.$tr[$key].'&quot; /&gt;';
 	elseif (isset($params['price']))
 	echo Tools::displayPrice($tr[$key], (isset($params['currency']) ? Currency::getCurrencyInstance((int)($tr['id_currency'])) : $currency), false);
 	elseif (isset($params['float']))
 	echo rtrim(rtrim($tr[$key], '0'), '.');
 	elseif (isset($params['type']) AND $params['type'] == 'date')
 	echo Tools::displayDate($tr[$key], $cookie-&gt;id_lang);
 	elseif (isset($params['type']) AND $params['type'] == 'datetime')
 	echo Tools::displayDate($tr[$key], $cookie-&gt;id_lang, true);
 	elseif (isset($tr[$key]))
 	{
 	//$echo = ($key == 'price' ? round($tr[$key], 2) : isset($params['maxlength']) ? Tools::substr($tr[$key], 0, $params['maxlength']).'...' : $tr[$key]);
 	$echo = ($key == 'price' ? round($tr[$key], 2) : isset($params['maxlength']) ? Tools::substr(Tools::htmlentitiesUTF8($tr[$key]), 0, $params['maxlength']).'...' : Tools::htmlentitiesUTF8($tr[$key]));
 	echo isset($params['callback']) ? call_user_func_array(array($this-&gt;className, $params['callback']), array($echo, $tr)) : $echo;
 	}
 	else
 	echo '--';

 echo (isset($params['suffix']) ? $params['suffix'] : '').
 	'&lt;/td&gt;';
 	}

 if ($this-&gt;edit OR $this-&gt;delete OR ($this-&gt;view AND $this-&gt;view !== 'noActionColumn'))
 	{
 	echo '&lt;td class=&quot;center&quot; style=&quot;white-space: nowrap;&quot;&gt;';
 	if ($this-&gt;view)
 	$this-&gt;_displayViewLink($token, $id);
 	if ($this-&gt;edit)
 	$this-&gt;_displayEditLink($token, $id);
 	if ($this-&gt;delete AND (!isset($this-&gt;_listSkipDelete) OR !in_array($id, $this-&gt;_listSkipDelete)))
 	$this-&gt;_displayDeleteLink($token, $id);
 	if ($this-&gt;duplicate)
 	$this-&gt;_displayDuplicate($token, $id);
 	echo '&lt;/td&gt;';
 	}
 	echo '&lt;/tr&gt;';
 	}
 	}
 	}
 	}
?&gt;</pre>
<h3>3. Update templates</h3>
<p>Locate instances in your template files where you use the category description. Some of these may need to be altered. </p>
<p>e.g. </p>
<p>In /modules/blockcategories/category-tree-branch.tpl  line 28: </p>
<pre class="html" name="code">&lt;a href=&quot;{$node.link}&quot; {if isset($currentCategoryId) &amp;&amp; ($node.id == $currentCategoryId)}class=&quot;selected&quot;{/if} title=&quot;{$node.desc|escape:html:'UTF-8'}&quot;&gt;{$node.name|escape:html:'UTF-8'}&lt;/a&gt; </pre>
<p>Create a copy of this file and put in /themes/your_theme/modules/blockcategories/ </p>
<p>Update the  line to include <span class="html">the smarty function <em>strip_tags</em></span> in the title tag: </p>
<pre class="html" name="code">&lt;a href=&quot;{$node.link}&quot; {if isset($currentCategoryId) &amp;&amp; ($node.id == $currentCategoryId)}class=&quot;selected&quot;{/if} title=&quot;{$node.desc|strip_tags:false|escape:html:'UTF-8'}&quot;&gt;{$node.name|escape:html:'UTF-8'}&lt;/a&gt;</pre>
<p>Make sure you update the category description anywhere else in your templates as required. </p>
<p>Thats all there is to it. If you notice any bugs or problems please drop me an email or comment. </p>
<p>&nbsp;</p>
<h3>4. Optional TinyMCE editor in Admin Area </h3>
<p>Please note the following optional  changes affect Prestashop&#8217;s core code. These changes will be overwritten if you ever update Prestashop.</p>
<p>In [admin folder]/tabs/AdminCategories.php, line 233: </p>
<pre class="html" name="code">&lt;textarea name=&quot;description_'.$language['id_lang'].'&quot; rows=&quot;10&quot; cols=&quot;100&quot;&gt;'.htmlentities($this-&gt;getFieldValue($obj, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'&lt;/textarea&gt;</pre>
<p> Add <em>class=&quot;rte&quot;</em> to the textarea</p>
<pre class="html" name="code">&lt;textarea name=&quot;description_'.$language['id_lang'].'&quot; rows=&quot;10&quot; cols=&quot;100&quot; class=&quot;rte&quot;&gt;'.htmlentities($this-&gt;getFieldValue($obj, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'&lt;/textarea&gt;</pre>
<p>Also in [admin folder]/tabs/AdminCategories.php, at the end (line 318) after: </p>
<pre class="html" name="code">&lt;p class=&quot;clear&quot;&gt;&lt;/p&gt;';</pre>
<p>Add the following to load TinyMCE:</p>
<pre class="html" name="code">/* Add TinyMCE */
		global $cookie;
		$iso = Language::getIsoById((int)($cookie->id_lang));
		$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
		$ad = dirname($_SERVER["PHP_SELF"]);
		echo '
			&lt;script type=&quot;text/javascript&quot;&gt;
			var iso = \''.$isoTinyMCE.'\' ;
			var pathCSS = \''._THEME_CSS_DIR_.'\' ;
			var ad = \''.$ad.'\' ;
			&lt;/script&gt;
			&lt;script type=&quot;text/javascript&quot; src=&quot;'.__PS_BASE_URI__.'js/tiny_mce/tiny_mce.js&quot;&gt;&lt;/script&gt;
			&lt;script type=&quot;text/javascript&quot; src=&quot;'.__PS_BASE_URI__.'js/tinymce.inc.js&quot;&gt;&lt;/script&gt;';
		/* End TinyMCE */</pre>
<p>In /classes/Category.php, line 88:</p>
<pre class="html" name="code">protected 	$fieldsValidateLang = array('name' =&gt; 'isCatalogName', 'link_rewrite' =&gt; 'isLinkRewrite', 'description' =&gt; 'isCleanHtml',
			'meta_title' =&gt; 'isGenericName', 'meta_description' =&gt; 'isGenericName', 'meta_keywords' =&gt; 'isGenericName');</pre>
<p>Change the field type of description: <em>&lsquo;description&rsquo; =&gt; &lsquo;isCleanHtml&rsquo;</em> becomes <em>&lsquo;description&rsquo; =&gt; &lsquo;isString&rsquo;</em></p>
<pre class="html" name="code">protected 	$fieldsValidateLang = array('name' =&gt; 'isCatalogName', 'link_rewrite' =&gt; 'isLinkRewrite', 'description' =&gt; 'isString',
			'meta_title' =&gt; 'isGenericName', 'meta_description' =&gt; 'isGenericName', 'meta_keywords' =&gt; 'isGenericName');</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jellygnite.com.au/blog/index.php/archive/update-display-html-in-prestashop-category-description-v-1-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cms.jellygnite redeveloped using MochaUI</title>
		<link>http://www.jellygnite.com.au/blog/index.php/archive/mochaui-based-cms/</link>
		<comments>http://www.jellygnite.com.au/blog/index.php/archive/mochaui-based-cms/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 02:22:32 +0000</pubDate>
		<dc:creator>Jim Chisholm</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[mochaui]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://www.jellygnite.com.au/blog/?p=15</guid>
		<description><![CDATA[I am currently developing/redesigning my CMS and admin panel I use for clients&#8217; websites. I have found a fantastic tool called MochaUI which was developed using the Mootools javascript framework.  MochaUI is a user interface library that you can use to build your web application on.
I had reservations making my CMS completely dependent on [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently developing/redesigning my CMS and admin panel I use for clients&#8217; websites. I have found a fantastic tool called <a href="http://mochaui.com/" rel="external">MochaUI</a> which was developed using the Mootools javascript framework.  MochaUI is a user interface library that you can use to build your web application on.</p>
<p>I had reservations making my CMS completely dependent on MochaUI so I have made everything modular. This will allow me to easily change the user interface should I no longer wish to use MochaUI in the future.</p>
<p>MochaUI provides the ability to open draggable, resizable, rounded-corner and dropshadowed windows without using images. These work great for  help and  file browser popup windows. It lets you design the user interface using columns and panels which are also resizeable. It uses the canvas tag so everything looks great with customisable curves and dropshadows.</p>
<p><a href="/_lib/blog/screen_cms.jellygnite.jpg" rel="roebox">View a screen shot of the CMS initial concept</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jellygnite.com.au/blog/index.php/archive/mochaui-based-cms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strip non-alphanumeric characters using PHP</title>
		<link>http://www.jellygnite.com.au/blog/index.php/archive/strip-non-alphanumeric-characters-using-php/</link>
		<comments>http://www.jellygnite.com.au/blog/index.php/archive/strip-non-alphanumeric-characters-using-php/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 03:00:28 +0000</pubDate>
		<dc:creator>Jim Chisholm</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[non-alphanumeric]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[strip]]></category>

		<guid isPermaLink="false">http://www.jellygnite.com.au/blog/?p=14</guid>
		<description><![CDATA[You can use regular expressions to achieve this very simply.
function clean_query_string($vsString) {
     return ereg_replace(&#34;[^A-Za-z0-9-]&#34;, &#34;&#34;, $vsString);
}
The regular expression, [^A-Za-z0-9-] tells the function to replace any character that is not (^  means not) any of these characters, A-Za-z0-9-
This would be useful when you need to clean a query string value or [...]]]></description>
			<content:encoded><![CDATA[<p>You can use regular expressions to achieve this very simply.</p>
<pre class="html" name="code">function clean_query_string($vsString) {
     return ereg_replace(&quot;[^A-Za-z0-9-]&quot;, &quot;&quot;, $vsString);
}</pre>
<p>The regular expression, <em><strong>[^A-Za-z0-9-]</strong></em> tells the function to replace any character that is not (^  means not) any of these characters, <strong>A-Za-z0-9-</strong></p>
<p>This would be useful when you need to clean a query string value or the like.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jellygnite.com.au/blog/index.php/archive/strip-non-alphanumeric-characters-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

