Drupal

    How do we use specific page tpl for content types ?

    Add following code in you template.php file and create a page tpl file names as page-blog.tpl.php
    <?php
    function THEMENAME_preprocess_page(&$vars) {
      if (
    $vars['node']->type == 'blog') {
       
    $vars['template_file'] = 'page-blog';
      }
    }
    ?>
    Here, THEMENAME is the name of the theme you are using

    Displaying primary links submenus

    http://drupal.org/project/dynamic_persistent_menu

    install the module and show the block in the particular region with selecting the menu from the configuration of the block

    ereg is deprecated errors in drupal 6

    When php is upgraded to version 5.3 drupal starts giving for ereg is deprecated so we have to change this ereg so that we don't encounter with the problem Change it in following way:
    <?php
    ereg
    ('\.([^\.]*$)', $this->file_src_name, $ext);
    ?>

    Change this code so that it will becomes:
    <?php preg_match('/\.([^\.]*$)/', $sourcename, $ext); ?>

    Simply we replaces the ereg function and some changes in regular expression
    In similar way we need to change function ereg_replace():

    How to add block by code in drupal?

    There are several way to insert blocks into a page in Drupal. We can use panels, or we can add a region in the theme, or we can call the blocks programmatically with php. Just As Follows
    <?php
    $block
    = module_invoke('modulename', 'block', 'view', 0);
    print
    $block['content'];
     
    ?>
    Refer http://api.drupal.org/api/function/module_invoke.

    How to add add/edit tpl for specific content type?

    This might work for you
    <?php
    function <name_of_theme>_preprocess_page(&$variables, $hooks) {
      if ((
    arg(0) == 'node') && (arg(1) == 'add' || arg(2) == 'page')) {
       
    $variables['template_files'][] =  'page-node-add-page';
      }
    }
    ?>