Drupal6: Nesting a scope in a .tpl.php view file

Does anyone have any ideas on how I could embed the region in a .tpl.php view file?

I do this easily enough in node.tpl.php by adding something like this to theme_preproces_node()

:

$vars['promos'] = theme('blocks', 'promos');

      

No problems. However, the function obviously doesn't exist theme_preprocess_view()

and I get memory errors when I try to add the same snippet to theme_preprocess()

.

Fatal error: 104857600 bytes allowed memory exhausted (tried to allocate 523800 bytes) in / Users / cpharmston / Sites / Projects / Threespot / neh 01 / includes / database.mysqli.inc on line 42

I'm stumped. Any ideas?

Thank!

+2


source to share


1 answer


The "quick and dirty" way: You can simply place the call theme('blocks', [region_name])

directly in the .tpl.php views file.

While the preprocessing functions are aimed at better separating the business and display logic, they are not required in any way, so you can still put your own code in the .tpl.php file however you like.



The right way: preprocessor functions for views, just a few. Take a look at the theme.inc file of the views module. There you will find different preprocessing functions for different templates that can be used in the view (eg "unformatted" or "table" versus "list", etc.). You just need to find one that fits the view template you want to introduce the new variable.

+2


source







All Articles