[development] Making blocks from some setting in Drupal 7?

Mikkel Høgh mikkel at hoegh.org
Sat Feb 23 23:33:22 UTC 2008


Seeing that there are many different opinions about this, would it be 
possible to make this configurable? Make the function-based thing and 
then have a setting like "CREATE_MAGICAL_REGION_VARS", either in 
template.php, settings.php or even the database.
After all, if we have the functions already, creating the extra vars 
should be trivial.

Matthew Farina wrote:
> Putting function calls in the themes page.tpl.php file would be a step 
> backward for the theming system.
> 
> For the page.tpl.php file the problem of only having the regions you 
> want in the theme is solved in D5 with hook_regions and in D6 with the 
> themes .info file.
> 
> If we want to keep the separation of layers in drupals PAC 
> <http://www.dossier-andreas.net/software_architecture/pac.html> like 
> architecture and allow for any kind of plug-able presentation layer 
> function calls in the page.tpl.php file isn't a good idea.
> 
> The way we use theme('links', $primary_links) in the page.tpl.php files 
> seems out of place. Shouldn't that be pushed to the preprocess function?
> 
> Matt
> 
> 
> On Feb 23, 2008, at 3:17 PM, Larry Garfield wrote:
> 
>> That's also the original logic behind the component module:
>>
>> http://drupal.org/project/component
>>
>> That said, -1 to putting function calls directly in the template. 
>>  They're not
>> portable to other template engines other than PHPTemplate.  That's also
>> putting too much logic into a template, where it belongs in a 
>> theme/template
>> (preprocess) function.  
>>
>> On Saturday 23 February 2008, David Metzler wrote:
>>> Yep, I used something similar to this used to be possible in 4.7 and
>>> I used it to create a region and put it in into a panel using Panels
>>> so that I could still use block subscription and fole filtering logic
>>> etc within a panel.
>>>
>>> For some reason it quit working in 4.7 most likely because I was
>>> causing some system internal that shouldn't have been done.
>>>
>>> Love to see this supported.
>>>
>>> On Feb 22, 2008, at 5:20 AM, Gábor Hojtsy wrote:
>>>> On Thu, Feb 21, 2008 at 8:20 PM, Earl Miles <merlin at logrus.com> wrote:
>>>>> Gábor Hojtsy wrote:
>>>>>> What do you think?
>>>>>
>>>>> My one concern here is that because the block system is push, not
>>>>> pull,
>>>>> all blocks in all regions are always generated, regardless of
>>>>> whether
>>>>> the page needs them. That means we run the risk of degrading
>>>>> performance
>>>>> by generating a whole bunch of material that we have no intention of
>>>>> displaying, unless we have some way for the theme to signal which
>>>>> regions it wishes to generate on any given template. And that's a
>>>>> tough
>>>>> thing to do in the current system.
>>>>>
>>>>> This is one of the reasons I like the panels approach, but that's
>>>>> still
>>>>> pretty far from being able to fully emulate the block system.
>>>>
>>>> Completely understood. I always disliked that PHPTemplate builds all
>>>> block regions regardless of needs. I used to use lots of conditionals
>>>> around block region bulilding in my pure PHP themes (before migrating
>>>> over to PHPTemplate not long ago, due to its other advantages). So
>>>> after all, a possible explosion of blocks / regions would require some
>>>> (more) benchmarking and thinking about block performance. (Given that
>>>> I am working primarily on better support for WYSIWYG right now, this
>>>> is not my top priority unfortunately).
>>>>
>>>> Gabor
>>
>>
>> -- 
>> Larry Garfield AIM: LOLG42
>> larry at garfieldtech.com ICQ: 6817012
>>
>> "If nature has made any one thing less susceptible than all others of
>> exclusive property, it is the action of the thinking power called an 
>> idea,
>> which an individual may exclusively possess as long as he keeps it to
>> himself; but the moment it is divulged, it forces itself into the 
>> possession
>> of every one, and the receiver cannot dispossess himself of it."  -- 
>> Thomas
>> Jefferson
> 


More information about the development mailing list