In your case it is more logical not to use the syntax of templating but stupidly to substitute blocks through conditions. Judging by the example in question, you do not use mvc and your logic is not separable from the presentation. Then why reinvent the wheel =)
For example, collect all user blocks by request into an array, in which the key is that block name (it is its position in the template) and the value is the insert code itself:
Array [n]( "blockHead" => Array( "enabled" => "1", "content" => "...content..." ), ... "blockFoot" => Array( "enabled" => "1", "content" => "...content..." ) )
Well, then bring them in their places:
<!--blockHead placing--> <?=($blocksArray['blockHead']['emabled']) ? $blockArray['blockHead']$ : '';?> <!--/blockHead placing-->
ZY The honesty instilled in me by my grandmother as a child does not allow to call such an implementation correct (for many standards and terry postulates are violated), but quite reasonable in the framework of the question.