User:Dantman/Skinning system/Template syntax/php

Potentially a syntax, perhaps slightly strange. MonoBook is a bad example, the idea here is not that $this->html('title'); works the same as it does in a normal template, the idea is that these keys are not preloaded, they're only loaded when you request them, and we start adding things not listed here like the markup for a hover navigation menu or a set of header navigation links. Still, a little odd. Also note this would ideally be a new api, so in this case execute() is expected to output the contents of the body block. In other words, headelement, printTrail(), </body>, gone from the boilerplate. Also note things like catlinks and dataAfterContent (blech) don't use if conditions anymore. Only if you need wrapping.

<?php

class MonoBookTemplate extends BaseTemplate {

	function execute() {
?><div id="globalWrapper">
<div id="column-content">
	<div id="content"<?php $this->lang("page") ?>>
	<a id="top"></a>
	<?php if( $this->has('sitenotice') ) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>

	<h1 id="firstHeading" class="firstHeading"><?php $this->html('title') ?></h1>
	<div id="bodyContent">
		<?php foreach( $this->loop('subtitle') as $subtitle ) { ?>
			<?php $subtitle->html(); ?>
		<?php } ?>
		<?php if($this->has('newtalk') ) { ?><div class="usermessage"<?php $this->lang("user") ?>><?php $this->html('newtalk')  ?></div><?php } ?>
		<?php if($this->has('showjumplinks') { ?><div id="jump-to-nav"<?php $this->lang("user") ?>><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
		<!-- start content -->
		<?php $this->html('bodytext') ?>
		<?php $this->html('catlinks') ?>
		<!-- end content -->
		<?php $this->html('dataAfterContent') } ?>
		<div class="visualClear"></div>
	</div>
</div>
</div>
<div id="column-one"<?php $this->lang("user") ?>>
	<div id="p-cactions" class="portlet">
		<h5><?php $this->msg('views') ?></h5>
		<div class="pBody">
			<ul>
			<?php foreach( $this->loop('content_actions') as $ca ) ?>
				<?php $ca->listItem(); ?>
			<?php } ?>
			</ul>
		</div>
	</div>
	<div class="portlet" id="p-personal">
		<h5><?php $this->msg('personaltools') ?></h5>
		<div class="pBody">
			<ul<?php $this->html('userlangattributes') ?>>
			<?php foreach( $this->loop('personal_tools') as $pt ) ?>
				<?php $pt->listItem(); ?>
			<?php } ?>
			</ul>
		</div>
	</div>
	<div class="portlet" id="p-logo">
		<a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
			?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
			echo $skin->tooltipAndAccesskey('p-logo') ?>></a>
	</div>
	<script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
<?php
		foreach( $this->loop('sidebar') as $box ) { ?>
	<div class='<?php if ( $box->isGenerated ) { ?>generated-sidebar <?php } ?>portlet' id='<?php $box->id('p-'); ?>'<?php echo $box->tooltip('p-') ?>>
		<?php $box->header(5); ?>
		<div class='pBody'>
			<?php $box->cont(); /* just output the lists without customization */ ?>
		</div>
	</div>
<?php
		} ?>
</div><!-- end of the left (by default at least) column -->
<div class="visualClear"></div>
<div id="footer"<?php $this->lang("user") ?>>
<?php
		foreach( $this->loop('footericons', 'icononly') as $block ) { ?>
	<div id="<?php $block->id('f-'); ?>ico">
<?php
			foreach( $block->loop() as $icon ) { ?>
		<?php $icon->html(); ?>
<?php
			} ?>
	</div>
<?php
		} ?>

<?php
		if ( $this->has('footerlinks', 'flat') ) { ?>
	<ul id="f-list">
<?php
			foreach( $this->loop('footerlinks', 'flat') as $fl ) { ?>
		<?php $this->listItem(); ?>
<?php
			} ?>
	</ul>
<?php
		} ?>
</div>
</div>
<?php
	}

}