OpenCraft
Follow OC!
  • Home
  • About
  • Solutions
  • Portfolio
  • Clients
  • Blog
  • Contact

coding

Fri, 2009-06-19 09:51
Tags:
  • coding
  • php

The Automatic Resource Destructor pattern

By: 
Karim Ratib

What happens if you need to open a file with fopen, but find that your function can exit at multiple points? It is tedious and error-prone to call fclose at each exit point. Alternatively, you could re-structure your code to only exit at the bottom, thereby calling fclose only once, but you would end up with many nested blocks that hamper readibility and are generally considered bad programming style.Read more

  • kratib's blog
  • 3 comments
Wed, 2008-10-08 00:37
Tags:
  • coding
  • drupal
  • php

Beware PHP $_REQUEST!

By: 
Karim Ratib

I recently came across an interesting bug that I thought to share with you PHP/Drupal heads.Read more

  • kratib's blog
  • 21 comments
Tue, 2008-08-12 15:59
Tags:
  • coding
  • drupal
  • nagios

Run webinject (nagios plugin) for drupal projects

By: 
Ahmed Mowafy

First we will define webinject and nagios.Read more

  • amowafy's blog
  • 35 comments
  • 1 attachment
Mon, 2008-06-09 11:14
Tags:
  • coding
  • drupal
  • theming

Coloring 1pixelout flash player in audio module

By: 
Rita Faddoul

In order to theme the 1pixelout player in drupal, you need to paste the following code in the template.php file of the theme.

<?php
function phptemplate_audio_1pixelout_node_player($node, $options = array()) {
  $defaultoptions['leftbg'] = '0x000000';
  $defaultoptions['rightbg'] = '0x000000';
  $defaultoptions['lefticon'] = '0xFFFFFF';
  $defaultoptions['righticon'] = '0xFFFFFF';
  $options = array_merge($defaultoptions, $options);
  return theme_audio_1pixelout_node_player($node, $options);
}
?>
Read more

  • rfaddoul's blog
  • 2 attachments
Thu, 2008-05-22 19:25
Tags:
  • apache
  • coding
  • drupal

Apache MultiViews automatically appends file extensions

By: 
Abdel-Karim Mardini

We were having a problem with a redirection issue in one of our projects. We had a page that had the url(i.e. path alias in Drupal) as /index. Whenever that page was called, Apache would append to it .php extension and the request gets routed to index.php which is NOT the desired effect.

This was due to the option "MultiViews" being enabled on our new Debian installation. For more info, read this.

I added this line to our .htaccess.Read more

  • amardini's blog
  • 8 comments
Sun, 2008-03-16 16:51
Tags:
  • coding
  • drupal

How to associate default users with projects in 'Case Tracker' module?

By: 
Ahmed Mowafy

To associate default user in case tracker project:

1-Add a CCK user reference field "Default assignee" in the project content type.

2-Create ajax function on .js file :

function get_default_assignee(path, field_id) {
   var field = $('#'+ field_id).val();
   $.ajax({
    async:true,
    type:"GET",
    url:path + "get/default/assignee/" + field,
    success:function(data) {
     $("input[@id=edit-assign-to]").attr('value',data);
    }
  });
 }

3-In your .module file create menu item :

$items[] = array(Read more

  • amowafy's blog
  • 5 comments
Thu, 2007-12-06 12:31
Tags:
  • apache
  • coding
  • drupal
  • ubuntu

Enabling clean URLs for Drupal on a clean Ubuntu

By: 
Karim Ratib

This article applies to Ubuntu with Apache 2, MySQL 5 and PHP 5 installed from the package manager.

When you start using Drupal on Ubuntu, one of the first things to do is to enable clean urls. That page will first ask you to run the clean URL test, which will show you if the underlying Apache infrastructure is ready for this or not. It it's ready, clicking the test link should bring you back to the same page, but with the radiobuttons enabled. Otherwise, you will get a "page not found" error.Read more

  • kratib's blog
  • 12 comments
Mon, 2007-12-03 00:22
Tags:
  • coding
  • drupal
  • javascript

How to use other JavaScript libraries that use "$" in Drupal

By: 
Karim Ratib

Drupal uses jQuery for all its JavaScript work. This library defines the variable "$" as a shorthand for jQuery, to allow writing concise code. However, other JavaScript libraries such as script.aculo.us and prototype also use the same variable name, making it a problem to use them in Drupal!Read more

  • kratib's blog
  • 6 comments
Thu, 2007-06-28 14:22
Tags:
  • coding
  • drupal
  • ssl

Resolving file upload with SSL

By: 
Karim Ratib

The answer to working uploads with SSL is to make $base_url use the https protocol instead of http. Simple huh! Found here.

  • kratib's blog
  • 5 comments
Thu, 2007-02-15 14:07
Tags:
  • coding
  • Mantis

Mantis now supports Arabic

By: 
Karim Ratib

To let Mantis 1.0.x accept Arabic input, we did the following:

  • First convert the existing database to UTF-8. You need to make sure that my.cnf contains the following:

[mysqld]
max_allowed_packets=16M
init-connect='SET NAMES utf8'
 
[mysql.server]
default-character-set=utf8

  • Export the current database:

$ mysqldump -u root -p --opt --allow-keywords --hex-blob --max_allowed_packet=16M --quote-names mantis > mantis.sql

  • Convert the contents to UTF-8:

$ iconv -f latin1 -t UTF-8 mantis.sql > mantis-utf8.sqlRead more

  • kratib's blog
  • 5 comments

OpenCraft

  • About
  • Team
  • Process
  • Community
  • Media Kit
  • Portfolio
  • Clients
  • Industries
    • Social economic development
    • Multimedia culture
  • Services
    • Drupal development
    • Information architecture
    • Open source software development
    • Social network engineering
  • Request quote
  • Contact
  • Search
Blog

Our profiles at:

Drupal Google
rss

Creative Commons License
search