Created
September 6, 2010 23:20
-
-
Save mrchrisadams/567623 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// $Id: views-view-summary.tpl.php,v 1.6.4.1 2010/03/16 23:12:31 merlinofchaos Exp $ | |
/** | |
* @file views-view-summary.tpl.php | |
* Default simple view template to display a list of summary lines | |
* | |
* @ingroup views_templates | |
*/ | |
?> | |
<div class="item-list"> | |
<ul class="views-summary"> | |
<?php foreach ($rows as $id => $row): ?> | |
<?php | |
$link_url = explode('/', $row->url); | |
// pull off our stupidly named Year+Month url | |
$squashed_months = array_pop($link_url); | |
// we're resorting to a regexp to split this at the right place | |
// consistently | |
// make one capture of four digits, then another capture of two | |
$pattern = '/([0-9]{4})([0-9]{2})/'; | |
// add a forward slash between them | |
$replacement = '$1/$2'; | |
// finally use the regexp to fix our figure | |
$fixed_months = preg_replace($pattern, $replacement, $squashed_months); | |
// then put them back together to make a handy relative url, albiet | |
// hard coded with all for now. | |
$fixed_url = implode('/', $link_url) . '/all' . '/' . $fixed_months; | |
?> | |
<li><a href="<?php print $fixed_url; ?>"<?php print !empty($classes[$id]) ? ' class="'. $classes[$id] .'"' : ''; ?>><?php print $row->link; ?></a> | |
<?php if (!empty($options['count'])): ?> | |
(<?php print $row->count?>) | |
<?php endif; ?> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment