phptemplate user defined regions are loaded in every page and i have to change this with changing every block visibility
in this thread:
http://drupal.org/node/29139
offer this:

<?php
function _phptemplate_variables($hook, $variables) {
  // Load the node region only if we're not in a teaser view.
  if ($hook == 'node' && !$vars['teaser']) {
    // Load region content assigned via blocks.
    foreach (array('inline1') as $region) {
      $variables[$region] = theme('blocks', $region);
    }
  }
  return $variables;
}
?>

but this cant avoid generating all regions in every page and just override region varioable

Comments

zeta ζ’s picture

You can set the visibility of each block on a per page basis in /admin/build/block .

You can also make different page-nnn.tpl.php templates, that print regions or not, as you require.
http://drupal.org/node/104316
___________________
Explore your /admin page!
It’s in the detaιls…

demonstration portfolio

zeta ζ’s picture

Which did you try? Did it work? Does my suggestion need to be clarified?

Report your successes as well to guide others who read this.
___________________
Explore your /admin page!
It’s in the detaιls…

demonstration portfolio

esmailzadeh’s picture

i am sorry for late answer
i want to set visibility of whole regions, if i cant find any method for this, i use your first suggestion
i think tpl file for blocks is not good idea because those file must named by block id and id is not best method for identify a thing (generated from db) and unfortunatly this is alone way to access blocks form theme

zeta ζ’s picture

I think you are confusing blocks and regions;

  • blocks are placed in regions – use first method
  • regions are printed by templates – use second method.

id is the best method to identify anything – that’s why it’s called id.

The nnn specifies which page(s) the template applies to, and can print only the required regions. You are thinking of block-nnn.tpl.php which contains what to print for a specific block or set of blocks. See http://drupal.org/node/104319 .
___________________
It’s in the detaιls…

demonstration portfolio

esmailzadeh’s picture

no i dont confuse blocks and regions
sure blocks visibility can changed and set well with urls or php code but unfortunatly regions visibility cant change, all regions was loaded in all pages and it is not optimum

zeta ζ’s picture

Just because something is loaded in a page, doesn’t mean it has to be printed.

You’re the one with a question; why can’t you accept that it is because there is something you don’t understand?

Your stubborn refusal to accept that what I’ve told you might be true, even though it contradicts your understanding, is the only obstacle in your way. Read the whole of my comment, and don’t be so quick to take offence.

I’ve given you the answer: Go and try it, come back here when it doesn’t quite work exactly how you want, and hope that I’m still predisposed to helping you with the details.
___________________
It’s in the detaιls…

demonstration portfolio

esmailzadeh’s picture

my english language is weak and may be this cause misunderstand
i apologize if you thinked i take offence
i think i know what is block and what is region (i hope this was not offensive ;) )
block is a quadrangular shown in regions

about your two suggestions:
first suggestion is good if i cant find a solution to set visibility to regions.
(i want to set visibiliy to regions)
second sugession is not good for set visibility to regions because all regions is loaded and then not shown.

this is known bug in drupal and some (none good) solutions was created for solving this e.g:
http://drupal.org/project/region_assign

zeta ζ’s picture

Not showing a region means it is invisble.

My second suggestion is how you do this. Don’t look for the fastest execution: It is more important that it is easy to maintain. If there are half a dozen possible ways to not show something, you will create a nightmare for maintenance. If you want to make something run quickly, target the parts that are done 1000 times, not the part that is done once.

If there is a way to do something – don’t fight it, it has been designed that way.
___________________
It’s in the detaιls…

demonstration portfolio

wilson98’s picture

you can set your region visibility in your custom blocks theme function.

theme('blocks', $region)

override the system's default theme_blocks($region) function to set the region's visibility.

----------------------
http://www.doufin.com, drupal consult and service.