Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 483893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:14:38+00:00 2026-05-13T01:14:38+00:00

I have developed a blogger-like archive feature (you know, from the feature module). I

  • 0

I have developed a blogger-like archive feature (you know, from the feature module).
I want to edit the .module file in order to automatically load the view-template (which is bundled in the feature) into the theme. Is there a way to do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:14:38+00:00Added an answer on May 13, 2026 at 1:14 am

    On a general level: you should think “features = modules” and leaving theming for… themes! This does not mean that you shouldn’t include a template with your feature, but that you should evaluate whether the template you have built suits a general use of your feature or it is specific for your currently used theme. If it is the latter case, you should not package your template file with the feature, but leave it with the theme instead. Just think to how the views module works, to get an idea of what I mean.

    [Maybe you are already aware of this and made your considerations to this regards, in which case simply disregard what above. I thought about writing it because your sentence “I want the tpl.php to be actually available for the feature to use it (just as if it were in the active theme folder)” surprised me as general-use templates do not live in the theme folder but in the their module one, and moreover views already provide a “general use” template.]

    That said, the way you normally tell drupal to use a given template, is via implementing hook_theme() in your module. In this case – though – given that you are going to override the template defined by views you should implement hook_theme_registry_alter() instead.

    Somebody actually already did it. Here’s the code snippet from the linked page:

    function MYMODULE_theme_registry_alter(&$theme_registry) {
      $my_path = drupal_get_path('module', 'MYMODULE');
      $hooks = array('node');  // you can do this to any number of template theme hooks
      // insert our module
      foreach ($hooks as $h) {
        _MYMODULE_insert_after_first_element($theme_registry[$h]['theme paths'], $my_path);
      }
    }
    
    function _MYMODULE_insert_after_first_element(&$a, $element) {
      $first_element = array_shift($a);
      array_unshift($a, $first_element, $element);
    }
    

    Of course you will have to alter the theme registry for your view, rather than for a node (the original example refers to a CCK type).

    As on using the template in the views_ui, I am not sure weather the features module already empty the theming cache when you install a feature (in which case you should be good to go). If not, you can trigger it manually by invoking cache_clear_all() from your install file. If emptying the entire cache is too much, you should dig into the views module on how to flush the cache relatively to a single views.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed sample api as jar file. This jar file contains the code
I have developed a website using Razor (Microsoft WebMatrix) and now I want to
I have developed a small administration page for game servers which you can add/remove/edit
I have developed a Java server using Eclipse that accepts TCP socket connection from
I have developed a sample WCF REST service that accepts that creates an Order
I have developed an android app that works great and i would like to
I have developed the ipad app which displays images and other product details from
We have developed a custom control in monotouch (inherited from UITextField, but that shouldn't
I have developed a simple application in GWT. After that, I generate war file
I have developed android application named VMS.I have to get messages from the webservice.The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.