<?php
class EditedTeplatePower extends TemplatePower
	{

    /**
     * constructor
     *
     * @param string $tpl_file
     * @return
	 *
	 * @access public
     */

	public function __contruct($tpl_file)
		{
		$this->TemplatePower($tpl_file);
		}
	/**
	 * newBlock
	 *
	 * @param string $blockname
	 * @return
	 *
	 * @acces public
	 */

	public function newBlock( $blockname )
		{
		if(!isset( $this->parent[$blockname],
			$this->parent[$blockname],
			$this->content[ $this->parent[$blockname] .'_'. $this->index[$this->parent[$blockname]] ]
			)
		)
			{
			trigger_error('TP: het block"'.$blockname.'" is niet gedefinieerd in het templatebestand/subblock');
			}
		else
			{
			$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;
				$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;
				}
		   //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 ];
			}
		}

	public function getGlobalValue( $varname )
		{
		return isset($this->globals[ $varname ])? $this->globals[ $varname ] : false;
		}
	}
?>

	 