Drupal-check.org - Drupal 5.x http://www.drupal-check.org/check/11 en Check modules and themes directories http://www.drupal-check.org/node/70 <p>There are some conventions when using contributed modules and/or themes. Most users would want to place them in <span class="geshifilter"><code class="geshifilter-text">modules</code></span> and <span class="geshifilter"><code class="geshifilter-text">themes</code></span> folders.</p> <p><strong>Don't ever do that!</strong> Never place modules or themes in these directories!</p> <p>Everything added to a fresh Drupal install should go somewhere in the sites directory:</p> <ul> <li>Contributed modules (from drupal.org) should go in <span class="geshifilter"><code class="geshifilter-text">sites/all/modules/contrib</code></span></li> <li>Project custom modules should go in <span class="geshifilter"><code class="geshifilter-text">sites/all/modules/custom</code></span></li> <li>Contributed themes (from drupal.org) should go in <span class="geshifilter"><code class="geshifilter-text">sites/all/themes/contrib</code></span></li> <li>Project custom themes should go in <span class="geshifilter"><code class="geshifilter-text">sites/all/themes/custom</code></span></li> </ul> <p>Note that if you have a multisite environment, you could place somes of the modules/themes:</p> <ul> <li>in <span class="geshifilter"><code class="geshifilter-text">sites/default/..</code></span></li> <li>or <span class="geshifilter"><code class="geshifilter-text">sites/example.com/..</code></span></li> <li>or <span class="geshifilter"><code class="geshifilter-text">sites/anotherdomain.com/..</code></span></li> <li>and so on..</li> </ul> <p>... depending on your configuration.</p> <p>Note that using a <em>contrib</em> and <em>custom</em> directory convention will help you find out which modules are contributed by the drupal community and which you have developped specifically for the website.</p> <p>This will allow you to update more easily your websites as the only directory you will need to preserve will be <span class="geshifilter"><code class="geshifilter-text">sites/*</code></span>.</p> Development conventions modules themes Drupal 5.x Drupal 6.x Drupal 7.x Mon, 15 Jun 2009 10:18:37 +0000 jchatard 70 at http://www.drupal-check.org Make your module translatable http://www.drupal-check.org/node/64 <p>To let users translate your module strings, you must use the <span class="geshifilter"><code class="geshifilter-text">t()</code></span> function. This allows the Drupal community to create translation files <span class="geshifilter"><code class="geshifilter-text">*.po</code></span>. But this also allows user to tweak some strings to fit their needs, with the <a href="http://drupal.org/project/stringoverrides">String Overrides module</a>.</p> <p>So everytime your write a sentence or a word in your module, surround your string with the <span class="geshifilter"><code class="geshifilter-text">t()</code></span> function.</p> <p>This is the <strong>bad way</strong>:</p> <p><div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;"><span style="color: #0000ff;">$foo</span> = <span style="color: #ff0000;">&quot;Thank you for your submission&quot;</span>;</div></div></p> <p>This is the <strong>good way</strong>:</p> <p><div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;"><span style="color: #0000ff;">$foo</span> = <span style="color: #000066;">t</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Thank you for your submission&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></div></p> <p>Note that you must always write your module strings in English as this is the default language in Drupal and is used as a base to provide the localization system.</p> <p>You will need to insert values in your strings:</p> <p><strong>Don't write:</strong></p> <p><div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;"><span style="color: #0000ff;">$points</span> = <span style="color: #cc66cc;">3</span>;<br /> <span style="color: #0000ff;">$foo</span> = <span style="color: #000066;">t</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;You just won $points points&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></div></p> <p><strong>This is the good way to insert placeholders values:</strong></p> <p><div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;"><span style="color: #0000ff;">$points</span> = <span style="color: #cc66cc;">3</span>;<br /> <span style="color: #0000ff;">$foo</span> = <span style="color: #000066;">t</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;You just won !points points&quot;</span>, <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'!points'</span> =<span style="color: #66cc66;">&gt;</span> <span style="color: #0000ff;">$points</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></div></p> <p>Check out the resources links to learn more about <span class="geshifilter"><code class="geshifilter-text">t()</code></span> function use.</p> <p>Note that starting with Drupal 6, you can also make your JavaScript files translatable.</p> <p>In your code use <span class="geshifilter"><code class="geshifilter-text">Drupal.t()</code></span> function. Example:</p> <p><div class="geshifilter"><div class="javascript geshifilter-javascript" style="font-family:monospace;">greetingMessage <span style="color: #339933;">=</span> Drupal.<span style="color: #660066;">t</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Your vote has been saved!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div></p> Development localization translation Drupal 5.x Drupal 6.x Drupal 7.x Mon, 15 Jun 2009 08:45:08 +0000 jchatard 64 at http://www.drupal-check.org Stop logins being remembered http://www.drupal-check.org/node/82 <p>By default Drupal will keep people logged in for 23 days (2000000 seconds) by saving a cookie in their browser. This is nice, but a potential security problem if people are using the site from shared computers.</p> <p>Consider editing the site's settings.php to have </p> <p><div class="geshifilter"><div class="php geshifilter-php" style="font-family:monospace;"><span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'session.cookie_lifetime'</span><span style="color: #339933;">,</span> &nbsp;0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div></p> <p>instead of the default</p> <p><div class="geshifilter"><div class="php geshifilter-php" style="font-family:monospace;"><span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'session.cookie_lifetime'</span><span style="color: #339933;">,</span> 2000000<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div></p> <p>With the former, the user's login will be forgotten when they close their browser window, even if they forget to log out explicitly.</p> Going live cookies login security Drupal 5.x Drupal 6.x Mon, 28 Sep 2009 21:23:43 +0000 Fonant 82 at http://www.drupal-check.org Turn off error reporting display http://www.drupal-check.org/node/59 <ul> <li>Go to <strong>Site configuration</strong> &gt; <strong>Error reporting</strong></li> <li>Set <strong>Error reporting</strong> list box to <strong>Write errors to log</strong></li> <li>Save configuration</li> </ul> Going live error message Drupal 5.x Drupal 6.x Fri, 12 Jun 2009 13:33:16 +0000 jchatard 59 at http://www.drupal-check.org Use Drupal replacement functions http://www.drupal-check.org/node/65 <p>When developping a module, we often use some commonly used PHP functions. As you may not know Drupal provides some overrides for these functions. They are often related to strings, they have the same name as their PHP native equivalent except that they are prefixed with <span class="geshifilter"><code class="geshifilter-text">drupal_</code></span>. Here is a list of PHP functions you should replace with its Drupal equivalent:</p> <ul> <li>Replace <span class="geshifilter"><code class="geshifilter-text">strlen()</code></span> with <span class="geshifilter"><code class="geshifilter-text">drupal_strlen()</code></span></li> <li>Replace <span class="geshifilter"><code class="geshifilter-text">strtoupper()</code></span> with <span class="geshifilter"><code class="geshifilter-text">drupal_strtoupper()</code></span></li> <li>Replace <span class="geshifilter"><code class="geshifilter-text">strtolower()</code></span> with <span class="geshifilter"><code class="geshifilter-text">drupal_strtolower()</code></span></li> <li>Replace <span class="geshifilter"><code class="geshifilter-text">ucfirst()</code></span> with <span class="geshifilter"><code class="geshifilter-text">drupal_ucfirst()</code></span></li> <li>Replace <span class="geshifilter"><code class="geshifilter-text">substr()</code></span> with <span class="geshifilter"><code class="geshifilter-text">drupal_substr()</code></span></li> <li>Replace <span class="geshifilter"><code class="geshifilter-text">eval()</code></span> with <span class="geshifilter"><code class="geshifilter-text">drupal_eval()</code></span></li> <li>Replace <span class="geshifilter"><code class="geshifilter-text">clone</code></span> with <span class="geshifilter"><code class="geshifilter-text">drupal_clone()</code></span></li> </ul> <p>For more on this, you should <strong>read</strong> <span class="geshifilter"><code class="geshifilter-text">includes/unicode.inc</code></span> and <span class="geshifilter"><code class="geshifilter-text">includes/common.inc</code></span>.</p> Development code function php Drupal 5.x Drupal 6.x Drupal 7.x Mon, 15 Jun 2009 08:56:58 +0000 jchatard 65 at http://www.drupal-check.org Install the Boost module http://www.drupal-check.org/node/73 <p>Consider installing the Boost module to create static HTML versions of pages that are served anonymously. Cached pages don't even use PHP (they are served as .html files) let alone create or use queries in MySQL so caching is super fast. Cached pages can be cleared on a regular basis with cron. Works with multisites and provides speed improvements to almost any Drupal site. Requires modification of default .htaccess file.</p> Optimization caching performance Drupal 5.x Drupal 6.x Tue, 16 Jun 2009 09:17:23 +0000 ghazlewood 73 at http://www.drupal-check.org Disallow odd usernames http://www.drupal-check.org/node/62 <p>It is recommended that you prevent users from registering on your website with some odd usernames like:</p> <ul> <li>root</li> <li>admin</li> <li>administrator</li> <li>webmaster</li> </ul> <p>To prevent this from happening:</p> <ul> <li>Go to <strong>Administer</strong> &gt; <strong>User management</strong> &gt; <strong>Access rules</strong> &gt; <strong>Add rule</strong></li> <li>Set <strong>Access type</strong> to <strong>Deny</strong></li> <li>Set <strong>Rule type</strong> to <strong>Username</strong></li> <li>In <strong>Mask</strong> type <em>root</em></li> <li>Click the <strong>Add rule</strong> button</li> </ul> <p><strong>Repeat this for every username</strong> you don't want to be created on your site.</p> Going live users Drupal 5.x Drupal 6.x Fri, 12 Jun 2009 15:54:10 +0000 jchatard 62 at http://www.drupal-check.org Google Analytics http://www.drupal-check.org/node/79 <p>Google analytics is a free and useful tool for getting information about your site visitors, and there is little reason not to set it up on your site before launch.</p> <p>You will need a GA account, and know it's account number. Install the GA module linked, and enter the account number into /admin/settings/googleanalytics and customize if desired.</p> <p>When using GA in Germany you have to publish "datenschutzrechtliche Hinweise" on your site to inform users, that some of their data - e.g. IP-adress - will be tracked. Normally you set up a text block in your imprint. Using GA is maybe not conform with contemporary requirements of protection of private data.</p> SEO analytics google google analytics Drupal 5.x Drupal 6.x Drupal 7.x Mon, 06 Jul 2009 14:09:29 +0000 kwinters 79 at http://www.drupal-check.org Move .htaccess content to Apache config http://www.drupal-check.org/node/72 <p>Having an .htaccess file is a pain regarding performances. Apache needs to read it on every single request (the page, every image, CSS files, JS files, etc.).</p> <p>It is strongly recommended to move rules defined in Drupal <span class="geshifilter"><code class="geshifilter-text">.htaccess</code></span> file in your Apache global configuration or in your vhost configuration file. This way all rules are only loaded 1 time, during Apache start.</p> <p>To achieve this, just copy/paste your .htaccess content in your Apache server configuration file and don't forget to surround it by the directory where your Drupal install resides.</p> <p><div class="geshifilter"><div class="apache geshifilter-apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">Directory</span> /var/www/path/to/drupal/directory/&gt;<br /> &nbsp; <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">None</span><br /> &nbsp; <span style="color: #adadad; font-style: italic;">### &nbsp; &nbsp; &nbsp;ALL YOUR .HTACCESS CONTENT GOES HERE &nbsp; &nbsp;###</span><br /> &lt;/<span style="color: #000000; font-weight:bold;">Directory</span>&gt;</div></div></p> <p>Note that we added <span class="geshifilter"><code class="geshifilter-text">AllowOverride None</code></span> to prevent Drupal <span class="geshifilter"><code class="geshifilter-text">.htaccess</code></span> to be read by Apache.</p> <p>Check for syntaxe error:</p> <p><span class="geshifilter"><code class="geshifilter-text">$ apachectl configtest</code></span></p> <p>And restart Apache:</p> <p><span class="geshifilter"><code class="geshifilter-text">$ apachectl restart</code></span></p> <p>Note that if you are on Plesk, you must use the following command before restarting Apache:</p> <p><span class="geshifilter"><code class="geshifilter-text">$ /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=example.com</code></span></p> Optimization apache htaccess rewrite rules Drupal 5.x Drupal 6.x Drupal 7.x Mon, 15 Jun 2009 13:10:28 +0000 jchatard 72 at http://www.drupal-check.org Remove TXT files http://www.drupal-check.org/node/63 <p>Drupal comes with a set of TXT files at root level (things like install instructions, upgrade instructions, etc.). To avoid malicious users to have information on the Drupal version you are using, it is strongly recommended to remove those files.</p> <p>From the root directory of your installation, remove the following files:</p> <ul> <li>CHANGELOG.txt</li> <li>COPYRIGHT.txt</li> <li>INSTALL.mysql.txt</li> <li>INSTALL.pgsql.txt</li> <li>INSTALL.txt</li> <li>LICENSE.txt</li> <li>MAINTAINERS.txt</li> <li>UPGRADE.txt</li> </ul> <p>Whether or not these files contains security information (like Drupal version for example), the all contain a CVS header that gives a really precise version information on your Drupal installation.</p> Going live security Drupal 5.x Drupal 6.x Drupal 7.x Mon, 15 Jun 2009 07:47:08 +0000 jchatard 63 at http://www.drupal-check.org Enable cache http://www.drupal-check.org/node/56 <ul> <li>Go to <strong>Administer &gt; Site configuration &gt; Performance</strong></li> <li>Set <strong>Caching mode</strong> to <strong>Normal</strong> or <strong>Agressive</strong></li> <li>Set <strong>Block cache</strong> to <strong>Enabled</strong></li> <li>Save your settings</li> </ul> <p>In regards to page compression, you will find on <em>admin/settings/performance</em> a description that looks like <cite>By default, Drupal compresses the pages it caches in order to save bandwidth and improve download times. This option should be disabled when using a webserver that performs compression</cite>. To find out whether your server already performs compression have a peek at /etc/httpd/conf/httpd.conf (CentOS/Redhat) or /etc/apache2/mods-enabled (Debian/Ubuntu) to find out if the module mod_deflate is called. If so, turn off page compression.</p> <p>You're done!<strong></strong></p> Optimization caching performance Drupal 5.x Drupal 6.x Thu, 11 Jun 2009 16:56:06 +0000 jchatard 56 at http://www.drupal-check.org Escape accents with Pathauto http://www.drupal-check.org/node/71 <p>If you what Pathauto to transform caracters with accents into simple letters like:</p> <ul> <li><em>éèêë</em> to become <em>e</em></li> <li><em>àâï</em> to become <em>a</em></li> </ul> <p>You must enable in Pathauto the option <em>Transliterate prior to creating alias</em>. But by default, you can't tick the checkbox.</p> <p>You first need to rename a file. From within the Pathauto directory, rename <span class="geshifilter"><code class="geshifilter-text">i18n-ascii.example.txt</code></span> to <span class="geshifilter"><code class="geshifilter-text">i18n-ascii.txt</code></span>. Once renamed, you can enable the option from the Pathauto settings form.</p> SEO accent url alias Drupal 5.x Drupal 6.x Mon, 15 Jun 2009 12:09:19 +0000 jchatard 71 at http://www.drupal-check.org Reduce HTTP requests http://www.drupal-check.org/node/61 <p>Go to <strong>Site configuration</strong> &gt; <strong>Performance</strong>, in <strong>Bandwidth optimizations</strong> section:</p> <ul> <li>Set <strong>Optimize CSS files</strong> to <strong>Enabled</strong></li> <li>Set <strong>Optimize JavaScript files</strong> to <strong>Enabled</strong></li> <li>Save your settings</li> </ul> <p>It is recommended to put JavaScript files at the bottom of your document (i.e. your theme <span class="geshifilter"><code class="geshifilter-text">page.tpl.php</code></span>). Here is an example with Garland, but it should be the same with other themes. Search for the line <span class="geshifilter"><code class="geshifilter-text">&lt;?php print $scripts ?&gt;</code></span>:</p> <p><div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;">&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$language</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">language</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; lang=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$language</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">language</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; dir=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$language</span>-<span style="color: #66cc66;">&gt;</span><span style="color: #006600;">dir</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<br /> &nbsp; &lt;head&gt;<br /> &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$head</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br /> &nbsp; &nbsp; &lt;title&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$head_title</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/title&gt;<br /> &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$styles</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br /> &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$scripts</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br /> &nbsp; &lt;/head&gt;</div></div></p> <p>Cut and paste it just <strong>before</strong> the <span class="geshifilter"><code class="geshifilter-text">&lt;?php print $closure ?&gt;</code></span> statment and before the closing <span class="geshifilter"><code class="geshifilter-text">&lt;/body&gt;</code></span> tag, as shown below:</p> <p><div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;">&nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$scripts</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br /> &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$closure</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br /> &nbsp; &lt;/body&gt;<br /> &lt;/html&gt;</div></div></p> Optimization bandwidth optimizations page load Drupal 5.x Drupal 6.x Fri, 12 Jun 2009 15:14:05 +0000 jchatard 61 at http://www.drupal-check.org Setting up cron http://www.drupal-check.org/node/75 <p>Cron is a deamon which triggers certain actions (cron jobs) at configured times. Windows has an equivalent system called Task Scheduler. Calling cron.php at regular intervals will allow, amongst others, the indexation of content the content and to check for updates.</p> <p><strong>Setting up a cron job under a *nix system is fairly easy.</strong></p> <ol> <li>Create or edit a crontab by typing in a terminal <span class="geshifilter"><code class="geshifilter-text">crontab -e</code></span></li> <li>Assuming that you have one of the following programs on your system, add one of the following line to trigger a request to cron.php every hour: <ul> <li><span class="geshifilter"><code class="geshifilter-text">0 * * * * /usr/bin/wget -O - -q -t 1 http://example.com/cron.php</code></span></li> <li><span class="geshifilter"><code class="geshifilter-text">0 * * * * &nbsp;/usr/bin/lynx -source http://example.com/cron.php</code></span></li> <li><span class="geshifilter"><code class="geshifilter-text">0 * * * * curl --silent --compressed http://example.com/cron.php</code></span></li> </ul> </li> <li>Save and exit your editor.</li> </ol> <p><strong>Setting up cron jobs on Windows is almost as easy!</strong> See Resources below.</p> <p>Drupal logs information about cron jobs. Once you have configured it, you should see entries in your logs (Administer &gt; Reports &gt; Status report and Administer &gt; Reports &gt; Recent log entries) indicating the status of the related tasks.</p> Going live maintenance modules updates Drupal 5.x Drupal 6.x Drupal 7.x Fri, 19 Jun 2009 01:00:23 +0000 fp 75 at http://www.drupal-check.org Disable unecessary modules http://www.drupal-check.org/node/67 <p>You can gain performances by disabling unecessary contributed modules from your live site. Here is a list of modules you can safely disable on a production site:</p> <ul> <li>Devel</li> <li>Devel generate</li> <li>Devel node access</li> <li>Performance Logging</li> <li>Theme developer</li> <li>Advanced help example</li> <li>ImageCache UI</li> <li>Views UI</li> </ul> Going live modules Drupal 5.x Drupal 6.x Mon, 15 Jun 2009 09:50:52 +0000 jchatard 67 at http://www.drupal-check.org Set your front page http://www.drupal-check.org/node/68 <p>By default Drupal front page lists all nodes promoted to front page. We will often want the front page to display something different (a View, a panel, a node, etc.). To do so:</p> <ul> <li>Go to <strong>Administer</strong> &gt; <strong>Site configuration</strong> &gt; <strong>Site Information</strong></li> <li>Set <strong>Default front page</strong> to the path of your View, Panel, node or anything.</li> <li>Save your settings</li> </ul> <p>Note that the default value for <strong>Default front page</strong> is <em>node</em>.</p> Development front page Drupal 5.x Drupal 6.x Drupal 7.x Mon, 15 Jun 2009 09:54:54 +0000 jchatard 68 at http://www.drupal-check.org Contact Forms http://www.drupal-check.org/node/77 <p>There are a number of settings for contact forms that are easy to miss, since they aren't readily visible on the site. After you are sure that all the settings are right, you should also submit a test contact on every unique contact form to make sure the email address actually works.</p> <p>The Site Information settings page at /admin/settings/site-information contains the from address setting.</p> <p>/admin/build/contact has "To:" addresses and auto-responders, etc.</p> <p>If you use Webforms, there are similar settings at /admin/settings/webform and per-node at /admin/content/webform (minimally, check the to address in each webform node).</p> Going live contact live Drupal 5.x Drupal 6.x Drupal 7.x Mon, 06 Jul 2009 13:46:57 +0000 kwinters 77 at http://www.drupal-check.org Customize your 404 http://www.drupal-check.org/node/66 <p>Create a node (a page content type for example) with some extra information so that your visitors don't ever fall on the default 404 page not found.</p> <p>Once this node is created:</p> <ul> <li>Remember its node ID,</li> <li>Go to <strong>Administer</strong> &gt; <strong>Site configuration</strong> &gt; <strong>Error reporting</strong></li> <li>Set <strong>Default 404 (not found) page</strong> to the <strong>node ID you just created</strong></li> <li>Save your settings</li> </ul> <p>You can alternatively use the <a href="http://drupal.org/project/search404">Search 404 module</a>.</p> Going live 404 page not found Drupal 5.x Drupal 6.x Drupal 7.x Mon, 15 Jun 2009 09:18:50 +0000 jchatard 66 at http://www.drupal-check.org PHP tags usage http://www.drupal-check.org/node/76 <p><strong>Use full PHP tags</strong></p> <p>Write:<br /> <div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$foo</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div></p> <p>Don't write:<br /> <div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$foo</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div></p> <p><strong>Semicolons</strong><br /> Write:<br /> <div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$foo</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div></p> <p>Don't write:<br /> <div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000066;">print</span> <span style="color: #0000ff;">$foo</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div></p> <p><strong>No closing tags</strong><br /> When writing a module or customizing your theme <span class="geshifilter"><code class="geshifilter-text">template.php</code></span>, don't use PHP closing tag <span class="geshifilter"><code class="geshifilter-text">?&gt;</code></span>.</p> <p>Notice that at the bottom of the following snippet, there is no PHP closing:<br /> <div class="geshifilter"><div class="drupal6 geshifilter-drupal6" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br /> <span style="color: #808080; font-style: italic;">// Your file starts here</span><br /> <span style="color: #000000; font-weight: bold;">function</span> phptemplate_foo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br /> &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$bar</span>;<br /> <span style="color: #66cc66;">&#125;</span><br /> <span style="color: #808080; font-style: italic;">// Your file ends here</span><br /> <span style="color: #808080; font-style: italic;">// Don't add PHP closing tag</span></div></div></p> <p>By doing this you prevent PHP interpreter to stop and restart on the next source code file. This mean better performance.</p> Development coding conventions syntax Drupal 5.x Drupal 6.x Drupal 7.x Mon, 22 Jun 2009 16:37:43 +0000 jchatard 76 at http://www.drupal-check.org Protect email adresses http://www.drupal-check.org/node/80 <p>Sometimes, you need to enter email adresses in your content. Good examples are your About page, or even your Contact page. But this the better way to get spammed!</p> <p>It is strongly recommened to install a module such as SpamSan:</p> <ul> <li>Download and activate <a href="http://drupal.org/project/spamspan">SpamSan module</a></li> <li>Go to <strong>Site configuration</strong> &gt; <strong>Input formats</strong></li> </ul> <p>For each of your input format do the following:</p> <ul> <li>Click on <strong>Edit</strong></li> <li>Check that <strong>Hide email addresses</strong> is enabled and save</li> <li>Click the <strong>Rearrange</strong> tab and set <strong>Hide email adresses</strong> with a super high weight (10 for example)</li> <li>Click <strong>Save configuration</strong></li> </ul> <p>All email adresses are now spam protected.</p> Development email spam Drupal 5.x Drupal 6.x Wed, 08 Jul 2009 14:35:05 +0000 jchatard 80 at http://www.drupal-check.org