<?php

$headline = '';
$subline = '';
$text = '';
foreach($this->_data as $pagePart)
{
	switch ( $pagePart['type'])
	{
		case 'headline' :
			$headline = $pagePart['content'];
			break;
		case 'subline' :
			$subline = ($subline === '') ? $pagePart['content'] : $subline;
			break;
		case 'text' :
			$text = ($text === '') ? $pagePart['content'] : $text;
			break;
	}
}

?>

<div class="grid_40col wrapper">
	<div class="grid_40col">
		<h1><?php echo $headline; ?></h1>
		<h2><?php echo $subline; ?></h2>
		<div class="grid_40col spacer"></div>
		<div class="grid_40col text"><?php
		
		$text = strip_tags( $text );
		
		echo	( strlen ( $text ) > 300 && strpos ( $text , ' ' , 300 ) !== false )
				? substr ( $text , 0 , strpos ( $text , ' ' , 300 ) ) . ' ...'
				: $text;

		?></div>
	</div>
</div>
