tips

drupal 6 use "script.js" file

umesh sharma's picture

Drupal 6 has improved theming system. for adding JavaScript code to your pages, you just need to create a file named "script.js" in your theme folder.

Theme engine will automatically pick it up and place in scripts section.

Drupal: Submit Button with Image submit

Though this is not the correct way todo - but this works fine.

Usng this code you can replace your Submit button with Image submit button.

<?php
$myVariable = str_replace('type="submit"', 'type="image"', str_replace('value="Send"', 'src="files/myimage.gif"', my_form() ) );
?>

Removing "Read more" links from Frontpage

My website is powered by Drupal 5.7. Recently i reworked on its frontpage for better readiblity of data.

I was trying to remove "Read more" links from frontpage. After analyzing, i found that i could change in the module itself - but this will be overridden once i update my module.

I was looking for alternative solution to this - and while searching in Drupal.org forums, i came across
http://drupal.org/node/244182#comment-881076

I used this code to hide links on frontpage.


// Hide links - such as email to friend, mark as spam, etc
.links { display: none }

Drupal: Form object ($form) and its manipulation

<?php
$type = "page"; // use any content type

$node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type);

$form = drupal_retrieve_form($type .'_node_form', $node);

drupal_prepare_form($type .'_node_form', $form); // does not returns anything - modifies $form object

// print_r($form); // you can check all fields (including CCK ones )in $form object

drupal_render_form($type .'_node_form',$form)
?>

( also posted at http://drupal.org/node/151008#comment-842764 )

Syndicate content