[development] how to create channel based template callback

andrew morton drewish at katherinehouse.com
Mon Sep 28 12:38:50 UTC 2009


I'm not totally clear what you're trying to do but it seems like you
could use a preprocess hook (e.g. modulename_preprocess_page()) to
alter the 'template_files' variable that the theme system uses to find
candidate files. I'd suggest reviewing the code in
template_preprocess_page() to see how the list of candidates is
assembled.

andrew

On Mon, Sep 28, 2009 at 3:34 AM, wang zifeng <frank.zifeng at gmail.com> wrote:
> Hey Guys, first I am new to drupal development and try to learn everything
> about drupal by scratch. My questions might be easy to you but still hard
> for me, so any reply is welcomed and appreciated.
>
> Recently, I am going to create a customize module that to show all the blog
> members with their avatars triggering by hook_menu ‘?q=blog’ path.
>
> I write the code as what the drupal module development guide taught,  first
> to use hook_menu to route the path as well as the callback function, then
> use hook_theme to state the template, and then use theme() function in the
> customize function to call template, last is use template_preprocess
> function to create the variables before it pass to template file.
>
> But I found, all the variables that passed to the template file was packed
> into ‘contents’ region finally and placed into the template file. In other
> words, I can’t change the variable into other region, so that let me create
> a fully customize template for a specific path.
>
> For a clearer understanding of my problem:
>
> For example, like the difference between page.tpl.php and
> page-front.tpl.php, the second one could be fully customized with regions.
>
>  If I want to call page-blogmember.tpl.php trigger by ‘?q=blogmember ‘ to
> show all the blog avatars but with a fully customized region template, how
> can I do.  Like creating customized channel by ?q=video or ?q=game.
>
> Thanks
>
> Frank
>


More information about the development mailing list