So, jetzt gibts hier die Version 1.1.0 für das Archivmenü für Monat und Jahr!
Archivmenü "Jahr": mod_newsmenu_year.tpl
Code:
<!-- indexer::stop -->
<?php/*
* @template: mod_newsmenu_year.tpl
* @module: News archive menu (Archive format: Year)
* @function: news archiv menu as a drop-down-menu
* @version: 1.1.0.y (2011-04-29)
* @tested: Contao 2.9.4
* @author: µaTh
*
* needs JavaScript enabled
*
* help and new free versions: (German bulletin board) http://www.contao-community.de/showthread.php?9291
**/
?>
<div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<!-- headline start -->
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<!-- headline end -->
<!-- noscript: if JavaScript is enabled show this message and do not show archiv menu -->
<noscript><div class="noscript">Sorry, für das Archiv-Menü muss JavaScript in Ihrem Broswer eingeschalten sein</div></noscript>
<!-- style="display:none;"
hide the formular, if JavaScript is enabled.
Form will shown by JavaScript at the end of code of this template
-->
<form id="ArchivNaviForm" style="display:none;" action="">
<div class="ArchivNaviBlock">
<!-- drop-down-menu start -->
<!--
JavaScript tests the selected row in drop-down-menu.
If it is not the first item (cause it is only text)
than reload the page and show the selected month
-->
<select id="ArchivNavi" onchange="if (document.getElementById('ArchivNavi').selectedIndex != 0) parent.location.href = this.form.ArchivNavi.options[ this.form.ArchivNavi.options.selectedIndex ].value;">
<option selected="selected" value="">*** Auswahl Zeitraum *************************</option>
<!-- each YEAR in drop-down-menu -->
<?php foreach ($this->items as $year=>$month): ?>
<!-- label MONTH start-->
<option <?php if($month['isActive']): ?>selected="selected"<?php endif; ?> value="<?php echo $month['href']; ?>">
<?php echo $month['link']; ?><?php if ($this->showQuantity): ?> (<?php echo $month['quantity']; ?>)<?php endif; ?>
</option>
<!-- label MONTH end -->
<?php endforeach; ?>
</select>
<!-- drop-down-menu end -->
<a href="javascript:if ( 1 < document.getElementById('ArchivNavi').options.selectedIndex ) parent.location.href = document.getElementById('ArchivNavi').options[ document.getElementById('ArchivNavi').options.selectedIndex -1].value;">Jahr vor</a> |
<a href="javascript:if ( document.getElementById('ArchivNavi').length > document.getElementById('ArchivNavi').options.selectedIndex +1) parent.location.href = document.getElementById('ArchivNavi').options[ document.getElementById('ArchivNavi').options.selectedIndex +1].value;">Jahr zurück</a>
</div>
</form>
<!--
JavaScript: show formular
-->
<script type="text/javascript">
document.getElementById("ArchivNaviForm").style.display='inline';
</script>
</div>
<!-- indexer::continue -->
Archivmenü "Monat": mod_newsmenu.tpl
Code:
<!-- indexer::stop -->
<?php
/*
* @template: mod_newsmenu.tpl
* @module: News archive menu (Archive format: Month)
* @function: news archiv menu as a drop-down-menu
* @version: 1.1.0.m (2011-04-29)
* @tested: Contao 2.9.4
* @author: µaTh
*
* needs JavaScript enabled
*
* help and new free versions: (German bulletin board) http://www.contao-community.de/showthread.php?9291
*/
?>
<div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<!-- headline start -->
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<!-- headline end -->
<!-- noscript: if JavaScript is enabled show this message and do not show archiv menu -->
<noscript><div class="noscript">Sorry, für das Archiv-Menü muss JavaScript in Ihrem Broswer eingeschalten sein</div></noscript>
<!-- style="display:none;"
hide the formular, if JavaScript is enabled.
Form will shown by JavaScript at the end of code of this template
-->
<form id="ArchivNaviForm" style="display:none;" action="">
<div class="ArchivNaviBlock">
<!-- drop-down-menu start -->
<!--
JavaScript tests the selected row in drop-down-menu.
If it is not the first item (cause it is only text)
than reload the page and show the selected month
-->
<select id="ArchivNavi" onchange="if (document.getElementById('ArchivNavi').selectedIndex != 0) parent.location.href = this.form.ArchivNavi.options[ this.form.ArchivNavi.options.selectedIndex ].value;">
<option selected="selected" value="">*** Auswahl Zeitraum *************************</option>
<!-- each YEAR in drop-down-menu -->
<?php foreach ($this->items as $year=>$months): ?>
<!-- label YEAR -->
<optgroup label="<?php echo $year; ?>">
<!-- label MONTH start-->
<?php foreach ($months as $month): ?>
<option <?php if($month['isActive']): ?>selected="selected"<?php endif; ?> value="<?php echo $month['href']; ?>"><?php echo $month['link']; ?><?php if ($this->showQuantity): ?> (<?php echo $month['quantity']; ?>)<?php endif; ?></option>
<?php endforeach; ?>
<!-- label MONTH end -->
</optgroup>
<?php endforeach; ?>
</select>
<!-- drop-down-menu end -->
<a href="javascript:if ( 1 < document.getElementById('ArchivNavi').options.selectedIndex ) parent.location.href = document.getElementById('ArchivNavi').options[ document.getElementById('ArchivNavi').options.selectedIndex -1].value;">Monat vor</a> |
<a href="javascript:if ( document.getElementById('ArchivNavi').length > document.getElementById('ArchivNavi').options.selectedIndex +1) parent.location.href = document.getElementById('ArchivNavi').options[ document.getElementById('ArchivNavi').options.selectedIndex +1].value;">Monat zurück</a>
</div>
</form>
<!--
JavaScript: show formular
-->
<script type="text/javascript">
document.getElementById("ArchivNaviForm").style.display='inline';
</script>
</div>
<!-- indexer::continue -->
Viel Spaß damit.