svn: /pear2/sandbox/pear2.php.net/trunk/www/ css/packages.css templates/pear2/html/Categories.tpl.php
[email protected] (Michael Gauthier)
| Newsgroups | php.pear.cvs,php.pear.core |
|---|---|
| Message-ID | <[email protected]> |
gauthierm Tue, 15 Jun 2010 02:39:43 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=300451
Log:
Clean up display of categories on PEAR2.
Changed paths:
U pear2/sandbox/pear2.php.net/trunk/www/css/packages.css
U pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Categories.tpl.php
Modified: pear2/sandbox/pear2.php.net/trunk/www/css/packages.css
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/css/packages.css 2010-06-15 02:07:07 UTC (rev 300450)
+++ pear2/sandbox/pear2.php.net/trunk/www/css/packages.css 2010-06-15 02:39:43 UTC (rev 300451)
@@ -79,19 +79,23 @@
padding-right: 6px;
}
-ul.categories div {
+ul.categories ul {
font-size: 75%;
margin: 0 10px;
}
-ul.categories div a:link,
-ul.categories div a:visited {
+ul.categories ul li {
+ display: inline;
+}
+
+ul.categories ul a:link,
+ul.categories ul a:visited {
text-decoration: none;
color: #333;
}
-ul.categories div a:hover,
-ul.categories div a:active {
+ul.categories ul a:hover,
+ul.categories ul a:active {
text-decoration: underline;
color: #204173;
}
Modified: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Categories.tpl.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Categories.tpl.php 2010-06-15 02:07:07 UTC (rev 300450)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Categories.tpl.php 2010-06-15 02:39:43 UTC (rev 300451)
@@ -1,6 +1,11 @@
<?php
+
// Set the page title
$parent->context->page_title = 'Categories | ' . PEAR2\SimpleChannelFrontend\Main::$channel->name;
+
+$categoriesPerRow = 3;
+$packagesPerCategory = 4;
+
?>
<div id="packages" class="pearbox">
<div class="pearbox-header">
@@ -9,22 +14,60 @@
</div>
<div class="pearbox-content">
<ul class="categories">
- <?php
- $num = 0; foreach ($context as $category) : ?>
- <li id="category-<?php echo ++$num; ?>" class="category <?php echo (($num % 3) === 1) ? 'category-clear' : ''; ?>">
- <h3><a href=""><span class="category-title"><?php echo $category->name; ?></span> <span class="category-count"><?php echo count($category); ?></span></a></h3>
- <div><?php
- if (count($category)) {
- echo '<ul>';
- foreach ($category as $package) {
- echo '<li><a href="'.PEAR2\SimpleChannelFrontend\Main::getURL().$package->name.'">'.$package->name.'</a></li>';
- }
- echo '</ul>';
- }
- ?></div>
- </li>
- <?php
- endforeach; ?>
+<?php
+
+$categoryCount = 0;
+foreach ($context as $category) {
+ $class = ($categoryCount % $categoriesPerRow === 0) ?
+ 'category category-clear' : 'category';
+
+ $packageCount = count($category);
+ $categoryName = htmlspecialchars($category->name);
+
+ echo '<li class="' . $class . '">';
+
+ echo '<h3>';
+ echo '<a href="#">';
+ echo '<span class="category-title">' . $categoryName . '</span> ';
+ echo '<span class="category-count">' . $packageCount . '</span>';
+ echo '</a>';
+ echo '</h3>';
+
+ if ($packageCount > 0) {
+ echo '<ul>';
+
+ $packageCount = 0;
+ foreach ($category as $package) {
+ echo '<li>';
+
+ if ($packageCount > 0) {
+ echo ', ';
+ }
+
+ if ($packageCount >= $packagesPerCategory) {
+ echo '…';
+ break;
+ } else {
+ $packageHref = PEAR2\SimpleChannelFrontend\Main::getURL()
+ . htmlspecialchars($package->name);
+
+ $packageName = htmlspecialchars($package->name);
+
+ echo '<a href="' . $packageHref . '">' . $packageName . '</a>';
+ }
+
+ echo '</li>';
+ $packageCount++;
+ }
+
+ echo '</ul>';
+ }
+
+ echo '</li>';
+ $categoryCount++;
+}
+
+?>
</ul>
</div>
</div>