Monday, October 12, 2009

Basic Drupal Notes

Configuration

1. After installation, it is a good idea to set site configuration by going to Administer -> Settings -> Site Information to set email address, slogan, footer, greeting for anonymous user, etc.

2. Create an administer role and assigning permissions.

3. Enables the modules that you want to use by going to Administer -> Site Building -> Modules.. The Path module allows users to create URL alias to pages, which can benefit SEO when pages are named appropriately. These alias can be viewed at Administer -> Url Aliases.

4. Clean URL feature eliminates the query string parameters in the URL path and is recommended for SEO and can be done by Administration - > Settings -> Clean URLs . For this to work, your server must be Apache servers which have the LoadModule rewrite_module and mod_rewrite configured in httpd.conf. In the settings page, there is a test for you to run to see if your server is configured correctly or not. If you enable Clean URL without proper server configuration, you can get back to the admin page to disable the feature by using the non-clean URL of the form http://www.yourdomain.com/?q=admin/settings

5. Whether or not to allow users to post comments to your stories is controlled by Administer -> Content Management -> Content Type -> Edit.

6. You can configure your Contact form by Administer -> Site Building -> Menu -> Contact.

7. If you site is having problems because you are installing Drupal in a subdirectory, you might need to adjust the $base_url property in sites/default/settings.php.


Template Writing

1. Don't use relative image paths in the tpl files. Instead use ...

'< img src="/images/yourimage.gif" />'

2. Drupal caches on the server for non-registered users. So when you make changes to the template, one way to force Drupal to update its cache is to click on "Save Configuration" in Admin -> Site Building -> Modules. Also refresh your browser cache as well. Or you can run "DELETE * FROM cache;" on your database. Also your webhost may be caching. To mitigate that, you can do http://www.yourdomain.com/?dsfkds where the query string is some random characters.

3. If you want to change the User Login block, try to change it with CSS first. If you really want to get to the code, the function starts at user_login_block() in user.module and traces to drupal_render_form() and theme_form_element() and theme_button() in form.inc.

4.
Misc Notes

5. The MySQL username and password access can be found in sites/default/settings.php in the form...

$db_url = 'mysql://username:password@localhost/databasename';

6. If you don't want the login box to be displayed, you can disable the block and use the following to login...

http://www.yourdomain.net/user

or

http://www.yourdomain.net/?q=user

7. You can determine which node id a page is by printing out ...

nid); ?>

Then you can write PHP if condition and apply them to specific pages such as ...

nid == 33) { ?>
< style >
< /style >

No comments: