#13 Notice: Undefined index: featuredblock
--- a/includes/class.TemplatePower.inc.php
+++ b/includes/class.TemplatePower.inc.php
@@ -605,36 +605,38 @@
*/
public function newBlock($blockname)
{
- $parent = &$this->content[ $this->parent[$blockname] .'_'. $this->index[$this->parent[$blockname]] ];
-
- $lastitem = sizeof( $parent );
- $lastitem > 1 ? $lastitem-- : $lastitem = 0;
-
- $ind_blockname = $blockname . '_' . $this->index[ $blockname ];
-
- if (! isset($parent[ $lastitem ]["_B:$blockname"])) {
- //ok, there is no block found in the parentblock with the name of {$blockname}
-
- //so, increase the index counter and create a new {$blockname} block
- $this->index[ $blockname ] += 1;
+ if(isset($this->parent[$blockname])) {
+ $parent = &$this->content[ $this->parent[$blockname] .'_'. $this->index[$this->parent[$blockname]] ];
+
+ $lastitem = sizeof( $parent );
+ $lastitem > 1 ? $lastitem-- : $lastitem = 0;
$ind_blockname = $blockname . '_' . $this->index[ $blockname ];
- if (! isset($this->content[ $ind_blockname ])) {
- $this->content[ $ind_blockname ] = array();
+ if (! isset($parent[ $lastitem ]["_B:$blockname"])) {
+ //ok, there is no block found in the parentblock with the name of {$blockname}
+
+ //so, increase the index counter and create a new {$blockname} block
+ $this->index[ $blockname ] += 1;
+
+ $ind_blockname = $blockname . '_' . $this->index[ $blockname ];
+
+ if (! isset($this->content[ $ind_blockname ])) {
+ $this->content[ $ind_blockname ] = array();
+ }
+
+ //tell the parent where his (possible) children are located
+ $parent[ $lastitem ]["_B:$blockname"] = $ind_blockname;
}
- //tell the parent where his (possible) children are located
- $parent[ $lastitem ]["_B:$blockname"] = $ind_blockname;
- }
-
- //now, make a copy of the block defenition
- $blocksize = sizeof( $this->content[ $ind_blockname ] );
-
- $this->content[ $ind_blockname ][ $blocksize ] = array( $blockname );
-
- //link the current block to the block we just created
- $this->currentBlock = &$this->content[ $ind_blockname ][ $blocksize ];
+ //now, make a copy of the block defenition
+ $blocksize = sizeof( $this->content[ $ind_blockname ] );
+
+ $this->content[ $ind_blockname ][ $blocksize ] = array( $blockname );
+
+ //link the current block to the block we just created
+ $this->currentBlock = &$this->content[ $ind_blockname ][ $blocksize ];
+ }
}
/**