Tag Archives: Drupal

Drupal – Get URL Arguments in Custom module or Views Template

You can get the URL arguments in custom module or views template files. Create a custom module and use the hook_nodeapi to print the URL arguments.

/**
 * Implementation of hook_nodeapi()
 */
function custom_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'view':
      print arg(0);
      print "<br/>";
      print arg(1);
      break;
    }
}

Continue reading Drupal – Get URL Arguments in Custom module or Views Template

Drupal – Create your own CSS style

Last time we have added a new font in the Drupal website using the @font-face module.
Drupal – Customize Fonts in Drupal

We can also apply this font-family in the .css file but first we have to add our own .css file and included it in the theme.

Go to your theme folder and create a new folder named as css if it doesn’t exist. Then create your .css file there. After that, go back to the theme folder and add the following line in the <theme>.info file. Continue reading Drupal – Create your own CSS style

Drupal – Customize Fonts in Drupal

If you find the fonts of your Drupal site quite boring. The @font-your-face module could make the text of your Drupal site more fun. Before proceeding, it would be great if your PHP is already enabled with the zip extension. but no worry if you doesn’t have the zip extension. We can still complete it without any problem.

Download and enable module with those free fonts. Continue reading Drupal – Customize Fonts in Drupal

Drupal – Add Javascript in Theme

As discussed before, we can add Javascript/JQuery in Drupal modules.
Drupal – Create Javascript for Module

So if the Javascript/JQuery is related to the layout and independent of the module, we should add it in the theme instead. For example, i want to have a alert box whenever a page is loaded, i should then add it to my current Drupal theme. The steps are listed below.

1. Open you current theme folder and add the following line in the theme.info.

  • scripts[] = js/theme.js

Continue reading Drupal – Add Javascript in Theme