drupal

Printing of meta data on Drupal home page

The module Nodewords facilitates easy management of meta data on Drupal websites.

To set-up meta data for the home page note it's done via the URL path of admin/nodewords/meta-tags/frontpage and not by editing the fields within the content (node) that has been used as the home page.

Using the Drupal menu navigate as follows:

Administer -> Meta tags -> Default and specific meta tags -> Front Page

Execute shell command in PHP

The example below shows how to execute a shell command from within php script.

The command pwd executes the current working directory.

<?php
$output = shell_exec('pwd');
echo "<pre>$output</pre>";
?>

Drupal notes

  • If placed within a drupal node it will always display the base location of the drupal installation.
  • If you require to call a program which resides above the drupal directory the following may be used.

    <?
    include("../../legacy/program.php");
    ?>

Taxonomy terms in page.tpl.php

function YourThemeName_preprocess_page(&$variables) {
  foreach($variables['node']->taxonomy AS $tax_term) {   
    $variables['wowzers'] .= ", $tax_term->name";   
  }
  $variables['wowzers'] = substr($variables['wowzers'],1);  
}

After entering this in your template.php file the variable $wowzers will be availble for use within your page.tpl.php file.

Please note you can only use one preprocess function per template.tpl.php file.