Dzulqarnain Nasir

  • October 22, 2011

    Setting up Wysiwyg editor + IMCE in Drupal 7

    Once you’ve set up your Drupal installation, you will undoubtedly want to start adding contents. The Filtered HTML format works for the most parts, but what if you wanted to add tables or images into your content? Well, that where the Full HTML format comes in handy. But let’s face it, not everyone is a coder, and HTML is pretty much Greek to them (unless you are Greek, of course).

    This is where What You See Is What You Get (Wysiwyg) editors come in handy. Wysiwyg editors allow users to write content as they would on any word processor such as Word. You can set the text format, font size and colour of the content and see how it would look like once it’s published. You can also insert tables and images and position them anywhere you’d like within your content (to a certain degree), and you don’t even need to know any HTML to achieve this. The Wysiwyg editor does that for you.

    Unfortunately, Drupal 7 does not come with a Wysiwyg editor as standard like, for example, Wordpress does. But that’s OK, because I’m going to show you how to quickly get a Wysiwyg editor up and running in Drupal. This tutorial will also cover instructions on how to set up a file manager to use with your Wysiwyg editor.

    Read more »
  • October 04, 2011

    Creating a Multilingual Drupal site

    Recently I’ve been working a lot with MODX, and in case you don’t know what MODX is, it’s a great content management system designed with PHP developers, such as myself, in mind. You can check it out here.

    The projects I have been working on using MODX are mostly multilingual sites. MODX Evolution has a great multilingual module called YAMS (Yet Another Multilingual Solution) and it allows me to create a page with multiple resources in multiple languages. Did that sound right? Well, basically you can have a page in multiple languages, and you can switch between languages by modifying the URL - usually by adding a two-letter combination of the language you want (eg. en for English, fr for French, ru for Russian). This is great, because all the pages can use the same template so they all look the same, but by adding a language tag to the URL visitors can view the same page in different languages.

    Then I wanted to make the same thing work in Drupal. I got to know that there’s also a multilingual solution for Drupal, namely the Internationalization module. I went through a few tutorials that explained how to set this up, which was fine, but it was until I found this tutorial that I managed to get a multilingual front page up and running.

    So in this tutorial, I’ll be showing you how to set up a multilingual site with a fully functioning multilingual front page and nice clean URL paths to boot.

    Read more »
  • July 18, 2011

    Get N Items From Multiple Arrays With Condition

    The title may be a bit confusing, but recent I have come to need a function that retrieves the latest items from my database object arrays in one of my PHP project. I have three object arrays obtained using the mysql_fetch_object function, and I needed to get the latest items based on the timestamp they were posted. Before you tell me I should have used better SQL queries, I should mention that the MySQL tables have different data structures, but with the same column names.

    I googled around hoping that there would be some simple solution to my needs – a function that will retrieve a preset number of items based on a condition from an array and output them as a new array. But the search was taking too long and Google was showing me too many irrelevant results. This prompted me to write my own solution, as usual.

    Read more »
  • April 23, 2011

    Tutorial: How to enable PHP5's imageantialias on Ubuntu 10.10

    I am currently working on a small project that requires me to use Apache on a Linux server. Since I am more accustomed to Ubuntu, I decided to install Ubuntu 10.10 on one of my virtual machines. So I installed everything I needed like Apache, MySQL and PHP5. Unfortunately, when I ran my PHP script, I hit a small problem. I kept getting an error 500 and it turned out that apparently the function imageantialias was not available in the PHP installation on my server.

    After a bit of research, it turned out that the GD package used in Ubuntu is different to that used in other Linux distros. I looked around for a viable solution and finally discovered that the best way to overcome this problem was to compile PHP5 from source. Here’s how I did it.

    Read more »
  • February 17, 2011

    Unresolved external 'LresultFromObject' error in RAD Studio 2010

    Recently, I’ve been working on a small service application that monitors the IIS7 server for calls to have the server restart or shutdown. The reasoning behind using a service instead of having PHP restart or shutdown the server was that PHP does not run as a user with restart/shutdown privileges. So, it became a necessity to have a service that monitors for any shutdown calls from PHP.

    I created a small service application using Embarcadero’s RAD Studio 2010 that runs as a service and checks for shutdown calls, as well as other processes. However, coming from Codegear, there were a few issues when importing an old application to be used as a base for the new application. Even after correcting all the paths that needed correction, I was getting this one error that prevented me from compiling the application.

    Read more »