How to add base path in drupal

    Base path in drupal can be added by using base_path() function You can do this in following way
    <?php

    $imagepath
    = base_path() . path_to_theme() .'/images/test.png';

    //$imagepath gives the path to the image in you drupal theme images folder

    echo '<img src="'. $imagepath .'" alt="test image" title ="test image">';

    ?>
    To include css and javascript in template files from theme
    <?php
    <link href="<?php print base_path(). path_to_theme();?>
    /css/styles.css" rel="stylesheet" type="text/css" />
    <script src="<?php print base_path(). path_to_theme();?>/js/test.js"></script>
    ?>
    5
    Average: 5 (1 vote)