Archive | Drupal RSS for this section

Embed flash to website

To embed flash to your website, you can use this:

<embed height="138" loop="true" menu="true" play="true" pluginspage="" src="/path/to/files.swf" type="application/x-shockwave-flash" width="840" wmode="transparent"></embed>

Use wmode=”transparent” to make the flash below the html (especially in IE). For some cases, in IE the flash is always on top of other html even if you use z-index positional. Use wmode=”transparent” to fix this problem.

Print taxonomy term in node without link in drupal 6

Put these lines to your node.tpl.php file:

<?php if ($terms): ?>
$vocabularies = taxonomy_get_vocabularies();
foreach($vocabularies as $vocabulary) {
if ($vocabularies) {
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary->vid);
if ($terms) {
print '<span class="taxonomy">';
foreach ($terms as $term) {
print $term->name;
print '</span>';
<?php endif; ?>


Create Image slide using javascript on Drupal

If you want to create an image slide on Drupal, one way to do it is using javascript. Here are some samples:

There are prev and next button to control your image slide. Your image will be play automatically, but you can control with button.

Here is the step by step:

  1. Download the javascript from here.
  2. Extract to your theme folder.
  3. Read More…

Drupal: Print User Profile in Body Content

I need to print user custom profile on my content body. I just need these code for print out my user profile.

<?php global $user; ?>
<?php $profile =  profile_load_profile($user); ?>
<?php print $user->profile_company_name; ?>
<?php print $user->profile_company_address; ?>

print drupal parameter in content body

I need to print user’s picture in the body of my content so I use the php input format and add this following lines:

global $user;
print $user->uid;

To view all attributes of the user:

<?php print_r($user); ?>

Drupal CSS for forms, collapsible settings, comment

Just want to share some drupal css for forms, collapsible admin settings, and comment border.

/* make form radios and checkboxes inline with its label */
.form-radios .form-item p, .form-checkboxes .form-item p{
display: inline;
.form-item label.option, .form-checkboxes label.option{
.form-checkboxes, .form-radios {

/*———- collapsible setting ————-*/
fieldset {
border:1px solid;
html.js fieldset.collapsed {
background:transparent none repeat scroll 0 0;

/* give dotted border for margin that is published */

.comment-published {
border:2px dotted #DBDBDB;

Drupal Search Box CSS example

form input[type="submit"] {
background: url(images/btn-bg.gif) no-repeat;
font: bold 12px Arial, Helvetica, sans-serif;
color: #FFFFFF;
border: none;
width: 144px;
height: 28px;
cursor: pointer;
/*search form */
#search-theme-form {
margin: 12px 0 0 0;
padding: 0 0 0 0;
#search-theme-form input[type="text"] {
width: 135px;
height: 21px;
padding: 2px 5px 1px 5px;
border: 1px solid #bed881;
background: #fff;
margin: 0 0 0 0;
color: #000000;
font-weight: normal;
#search-theme-form input[type="submit"] {
background: url(images/search-btn-bg.gif) no-repeat;
border: none;
margin: 0 0 0 0;
width: 67px;
height: 26px;
/*vertical-align: middle;*/
float: none;

CSS – Background Transparency

div#links {
background-color: #CCCCFF; /* pale weak blue */
border: solid 1px #000066; /* obscure dull blue */
opacity: 0.65;

Add Superfish drop down menu for Drupal 6 Theme

If you want Your Drupal theme to have some nice drop down menu, you can use Superfish. I’ll explain how to install it on your Drupal themes.

  1. Download Superfish from here.
    This zip file contain superfish javascript, css, and image. extract it to your theme folder. Create folder sf inside your theme directory and extract this file there.
  2. Edit files.
    Add superfish javascript and css (optional) to your .info file. If you already have your own css for the drop down menu, you may not add the superfish css to you .info file.
    stylesheets[all][] = sf/css/superfish.css
    stylesheets[all][] = sf/css/theme.css
    scripts[] = sf/js/superfish.js

    If you want your superfish menu different from your Primary links, you can add this line in your .info file.
    regions[superfish_menu] = Superfish Menu
  3. If you want to use superfish for you primary links, you can add these lines to your template.php file.
    function phptemplate_preprocess_page(&$vars) {
    $vars['primary_menu'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
    $vars['secondary_menu'] = theme('links', $vars['secondary_links'], array('class' => 'links secondary-links'));

    This function will load primary links tree to var primary_menu. You will use this primary_menu instead of primary_links in your page.tpl.php file.
    If you use superfish for diferent menu, you may not add this function. Read More…