All posts tagged: Drupal

Guide to migrate a Drupal website to Django after the release of Drupal 8

comments 2
django / Drupal / Howtos

I maintain a news website written in Drupal since 2007. It is a Drupal 6, before was a 5. I made many Drupal 7 installations in these years and I went to three Drupal local conventions. This is a guide on how to abandon Drupal if you already knows some basics of Django and Python. Drupal on LAMP: lessons learned PHP is for (not so) fast development but maintainability can be a pain. Drupal try to overcome PHP limits, with […]

Apache CentOS 6 cannot send email and Drupal get HTTP request status fails

comments 2
Drupal / Howtos / System Administration

I’m installing a Pressflow 6 on a new machine running CentOS 6. I’m using Apache MPM Worker with FastCGI. Then I get the classical e-mail error: Unable to send e-mail. Please contact the site administrator if the problem persists. Then I try to use sendmail: Where testmail is a file containing these lines: And i get the message. PHP cannot send email through apache! Trying a simple php script to send mail like drupal core […]

Disable upload and comment for a new content type programmatically

comments 9
Drupal

Following code is useful when installing a module that create a new content type programmatically on Drupal 6.x. Basically, it adds two variables setting default values for comments (core Comment module) and attachments (core Upload module). Code to write on my_funny_module/my_funny_module.install. function my_funny_module_install() { // Disable attachments // Read http://api.drupal.org/api/function/upload_nodeapi/6 on "load" variable_set("upload_my_content_type", 0); // Disable comments for this content type // Read http://api.drupal.org/api/function/comment_form_alter/6 variable_set('comment_my_content_type', COMMENT_NODE_DISABLED); // Install schema as usual (if any) drupal_install_schema('my_funny_module'); } […]

Add CSS style for a block into the same block

Leave a comment
Drupal

This simple code can be pasted into a PHP filtered block (or into a block declared by a module) to set some style from a block into the block container itself. <?php echo 'My block content'; /** Put styles inline on html head**/ drupal_set_html_head('<style type="text/css"> #my-block-id { /* my style*/ } </style> '); ?> This code is placed on html head, applied only to the pages where block appears, without touching css optimization. If you […]

Cron cannot run on Drupal: the drupal_goto() case

Leave a comment
Drupal

Sometimes you want to redirect a page to another on drupal. You can do this using a simple function called drupal_goto(). On few sites I’ve enabled the PHP filter module and then created a new page with PHP code input format with drupal_goto(‘node/2’) to redirect the current page to a specified node. Bad idea. I’ve noticed that, after this change, cron.php operations failed, if you have Search module enabled. On cron new contents are indexed […]