Re: Sidebar and Dynamic News
| From: | Paul Dragoonis | Date: | Thu, 18 Aug 2011 11:57:21 +0000 |
| Subject: | Re: Sidebar and Dynamic News | ||
| References: | 1 | Groups: | php.webmaster |
| Request: | Send a blank email to php-webmaster+get-11954@lists.php.net to get a copy of this message | ||
Adding the patch again because seemingly it didn't get added in the last
email.
On Thu, Aug 18, 2011 at 11:56 AM, Paul Dragoonis <dragoonis@gmail.com>wrote:
> Hey Stewart + all,
>
> As discussed previously I'd get back into the new prototype again. Here is
> my first patch in a while with more to come.
>
> I have attached my patch here for review before i commit it to SVN.
> I've also attached a screenshot for those who want to see visual changes
> without importing a patch.
>
>
> I took our discussion of Dynamic News and went with it.
>
> Firstly, I took the initiative of separating our App logic and our
> Presentation logic, (or merely just not putting inline HTML into our main
> backend pages).
> The initial implementation of the news here was in a HEREDOC and that was
> just horrible.
>
> I've added a new function called print_view() this guy is our way to hand
> off Presentation logic into its own file giving us a maintainability boost
> and all the goodness you get from views in general.
>
> For example on loading the sidebar I've done
> print_view('homepage/sidebar.php'); which in turn loads the individual views
> for the news, user groups, conferences and the Thanks sections. It's much
> more organised now! yay!
>
> I also modified the <h2> CSS styles on the right hand side (visible in the
> screenshot). Beforehand we had a border-top on our h2's and it was very
> confusing. I've now put the underline/border below the header and it looks
> more readable now.
>
> PS: If the code is reviewed and I broke coding standards, let me know it's
> been a while!
>
> Regards,
> Paul Dragoonis.
>
>
Index: index-beta.php =================================================================== --- index-beta.php (revision 315128) +++ index-beta.php (working copy) @@ -49,62 +49,6 @@ include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; include_once $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc'; -// Prepare news headings. -$news = "<ul>"; -foreach (print_news($NEWS_ENTRIES, "frontpage", 5, null, true) as $entry) { - $news .= <<< EOT -<li>[{$entry["date"]}] <a href="{$entry["permlink"]}">{$entry["title"]}</a></li> -EOT; -} -$news .= "</ul>"; -$news .= '<p class="center"><a href="/archive/index.php">News Archive</a></p>'; - -// Prepare sidebar. -$sidebar = <<< EOT -<div class=home-sidebar> - <h2>Recent News</h2> - <ul> - <li>PHP 5.3.5 and 5.2.17 Released!</li> - <li>PHP 5.2.16 Released!</li> - <li>PHP 5.3.4 Released!</li> - </ul> - - <h2>Conferences</h2> - <ul> - <li>Lorem ipsum dolor sit amet</li> - <li>Lorem ipsum dolor sit amet</li> - <li>Lorem ipsum dolor sit amet</li> - </ul> - - <h2>User Group Events</h2> - <ul> - <li>Lorem ipsum dolor sit amet</li> - <li>Lorem ipsum dolor sit amet</li> - <li>Lorem ipsum dolor sit amet</li> - </ul> - - <h2>Thanks To</h2> - <ul> - <li><a href="http://www.easydns.com/?V=698570efeb62a6e2" title="DNS Hosting provided by easyDNS">easyDNS</a></li> - <li><a href="http://www.directi.com/">Directi</a></li> - <li><a href="http://promote.pair.com/direct.pl?php.net">pair Networks</a></li> - <li><a href="http://www.servercentral.net/">Server Central</a></li> - <li><a href="http://www.hostedsolutions.com/">Hosted Solutions</a></li> - <li><a href="http://www.spry.com/">Spry VPS Hosting</a></li> - <li><a href="http://ez.no/">eZ Systems</a> / <a href="http://www.hit.no/">HiT</a></li> - <li><a href="http://www.osuosl.org">OSU Open Source Lab</a></li> - <li><a href="http://www.yahoo.com/">Yahoo! Inc.</a></li> - <li><a href="http://www.binarysec.com/">BinarySEC</a></li> - <li><a href="http://www.nexcess.net/">NEXCESS.NET</a></li> - <li><a href="http://www.rackspace.com/">Rackspace</a></li> - <li><a href="http://www.eukhost.com/">EUKhost</a></li> - <li><a href="http://www.micfo.com/">micfo</a></li> - <li><a href="http://www.redpill-linpro.com">Redpill Linpro</a></li> - <li><a href="http://www.facebook.com">Facebook</a></li> - </ul> -</div> -EOT; - // Prepare announcements. $announcements = " <div class='announcements'> @@ -120,8 +64,8 @@ <h2>Get Involved!</h2> <p> Getting involved with PHP is easier than you think. - Are you interested in helping to improve one of the world's most - widely used scripting languages? We are looking for all sorts + Are you interested in helping to improve one of the world's most + widely used scripting languages? We are looking for all sorts of people, not only developers. <a href='/get-involved.php' class='readmore'>Read more...</a> </p> @@ -130,8 +74,8 @@ <span class=graphic></span> <h2>Need Help?</h2> <p> - Everyone needs a little help from time to time, and finding it - isn't always easy. Thankfully, PHP has one of the best support + Everyone needs a little help from time to time, and finding it + isn't always easy. Thankfully, PHP has one of the best support communities out there. <a href='/support.php' class='readmore'>Read more...</a> </p> @@ -177,7 +121,7 @@ 'onload' => 'boldEvents();', 'headtags' => array( '<link rel="alternate" type="application/atom+xml" title="PHP: Hypertext Preprocessor" href="' . $MYSITE . 'feed.atom" />', - '<script type="text/javascript">', + '<script type="text/javascript">', "function okc(f){var c=[38,38,40,40,37,39,37,39,66,65,13],x=function(){x.c=x.c||Array.apply({},c);x.r=function(){x.c=null};return x.c},h=function(e){if(x()[0]==(e||window.event).keyCode){x().shift();if(!x().length){x.r();f()}}else{x.r()}};window.addEventListener?window.addEventListener('keydown',h,false):document.attachEvent('onkeydown',h)}", "okc(function(){if(document.getElementById){i=document.getElementById('phplogo');i.src='".$_SERVER['STATIC_ROOT']."/images/php_konami.gif'}});", '</script>' @@ -202,7 +146,7 @@ ); // Print body of home page. -print $sidebar; +print_view('homepage/sidebar.php', array('news' => $NEWS_ENTRIES)); print $content; // Print the common footer. Index: views/homepage/sidebar.php =================================================================== --- views/homepage/sidebar.php (revision 0) +++ views/homepage/sidebar.php (revision 0) @@ -0,0 +1,6 @@ +<div class=home-sidebar> + <?php print_view('homepage/news.php', array('news' => $news)); ?> + <?php print_view('homepage/conferences.php'); ?> + <?php print_view('homepage/ug_events.php'); ?> + <?php print_view('homepage/thanks.php'); ?> +</div> \ No newline at end of file Index: views/homepage/conferences.php =================================================================== --- views/homepage/conferences.php (revision 0) +++ views/homepage/conferences.php (revision 0) @@ -0,0 +1,6 @@ +<h2>Conferences</h2> +<ul> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> +</ul> \ No newline at end of file Index: views/homepage/news.php =================================================================== --- views/homepage/news.php (revision 0) +++ views/homepage/news.php (revision 0) @@ -0,0 +1,13 @@ +<h2>Recent News</h2> +<ul> + <?php + $i = 0; + foreach (print_news($news, "frontpage", 5, null, true) as $entry): + $escaped_title = htmlentities($entry['title'], ENT_QUOTES, 'UTF-8'); + ?> + <li><a target="_blank" title="<?= $escaped_title; ?>" href="<?= $entry['permlink']; ?>"><?= $escaped_title; ?></a></li> + <?php + endforeach; + ?> +</ul> +<p class="center"><a href="/archive/index.php" title="News Archive">News Archive</a></p> \ No newline at end of file Index: views/homepage/ug_events.php =================================================================== --- views/homepage/ug_events.php (revision 0) +++ views/homepage/ug_events.php (revision 0) @@ -0,0 +1,6 @@ +<h2>User Group Events</h2> +<ul> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> +</ul> \ No newline at end of file Index: views/homepage/thanks.php =================================================================== --- views/homepage/thanks.php (revision 0) +++ views/homepage/thanks.php (revision 0) @@ -0,0 +1,19 @@ +<h2>Thanks To</h2> +<ul> + <li><a href="http://www.easydns.com/?V=698570efeb62a6e2" title="DNS Hosting provided by easyDNS">easyDNS</a></li> + <li><a href="http://www.directi.com/">Directi</a></li> + <li><a href="http://promote.pair.com/direct.pl?php.net">pair Networks</a></li> + <li><a href="http://www.servercentral.net/">Server Central</a></li> + <li><a href="http://www.hostedsolutions.com/">Hosted Solutions</a></li> + <li><a href="http://www.spry.com/">Spry VPS Hosting</a></li> + <li><a href="http://ez.no/">eZ Systems</a> / <a href="http://www.hit.no/">HiT</a></li> + <li><a href="http://www.osuosl.org">OSU Open Source Lab</a></li> + <li><a href="http://www.yahoo.com/">Yahoo! Inc.</a></li> + <li><a href="http://www.binarysec.com/">BinarySEC</a></li> + <li><a href="http://www.nexcess.net/">NEXCESS.NET</a></li> + <li><a href="http://www.rackspace.com/">Rackspace</a></li> + <li><a href="http://www.eukhost.com/">EUKhost</a></li> + <li><a href="http://www.micfo.com/">micfo</a></li> + <li><a href="http://www.redpill-linpro.com">Redpill Linpro</a></li> + <li><a href="http://www.facebook.com">Facebook</a></li> +</ul> \ No newline at end of file Index: views/homepage/sidebar.php =================================================================== --- views/homepage/sidebar.php (revision 0) +++ views/homepage/sidebar.php (revision 0) @@ -0,0 +1,6 @@ +<div class=home-sidebar> + <?php print_view('homepage/news.php', array('news' => $news)); ?> + <?php print_view('homepage/conferences.php'); ?> + <?php print_view('homepage/ug_events.php'); ?> + <?php print_view('homepage/thanks.php'); ?> +</div> \ No newline at end of file Index: views/homepage/conferences.php =================================================================== --- views/homepage/conferences.php (revision 0) +++ views/homepage/conferences.php (revision 0) @@ -0,0 +1,6 @@ +<h2>Conferences</h2> +<ul> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> +</ul> \ No newline at end of file Index: views/homepage/news.php =================================================================== --- views/homepage/news.php (revision 0) +++ views/homepage/news.php (revision 0) @@ -0,0 +1,13 @@ +<h2>Recent News</h2> +<ul> + <?php + $i = 0; + foreach (print_news($news, "frontpage", 5, null, true) as $entry): + $escaped_title = htmlentities($entry['title'], ENT_QUOTES, 'UTF-8'); + ?> + <li><a target="_blank" title="<?= $escaped_title; ?>" href="<?= $entry['permlink']; ?>"><?= $escaped_title; ?></a></li> + <?php + endforeach; + ?> +</ul> +<p class="center"><a href="/archive/index.php" title="News Archive">News Archive</a></p> \ No newline at end of file Index: views/homepage/ug_events.php =================================================================== --- views/homepage/ug_events.php (revision 0) +++ views/homepage/ug_events.php (revision 0) @@ -0,0 +1,6 @@ +<h2>User Group Events</h2> +<ul> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> +</ul> \ No newline at end of file Index: views/homepage/thanks.php =================================================================== --- views/homepage/thanks.php (revision 0) +++ views/homepage/thanks.php (revision 0) @@ -0,0 +1,19 @@ +<h2>Thanks To</h2> +<ul> + <li><a href="http://www.easydns.com/?V=698570efeb62a6e2" title="DNS Hosting provided by easyDNS">easyDNS</a></li> + <li><a href="http://www.directi.com/">Directi</a></li> + <li><a href="http://promote.pair.com/direct.pl?php.net">pair Networks</a></li> + <li><a href="http://www.servercentral.net/">Server Central</a></li> + <li><a href="http://www.hostedsolutions.com/">Hosted Solutions</a></li> + <li><a href="http://www.spry.com/">Spry VPS Hosting</a></li> + <li><a href="http://ez.no/">eZ Systems</a> / <a href="http://www.hit.no/">HiT</a></li> + <li><a href="http://www.osuosl.org">OSU Open Source Lab</a></li> + <li><a href="http://www.yahoo.com/">Yahoo! Inc.</a></li> + <li><a href="http://www.binarysec.com/">BinarySEC</a></li> + <li><a href="http://www.nexcess.net/">NEXCESS.NET</a></li> + <li><a href="http://www.rackspace.com/">Rackspace</a></li> + <li><a href="http://www.eukhost.com/">EUKhost</a></li> + <li><a href="http://www.micfo.com/">micfo</a></li> + <li><a href="http://www.redpill-linpro.com">Redpill Linpro</a></li> + <li><a href="http://www.facebook.com">Facebook</a></li> +</ul> \ No newline at end of file Index: include/layout.inc =================================================================== --- include/layout.inc (revision 315128) +++ include/layout.inc (working copy) @@ -350,8 +350,8 @@ </div> </div> <!--[if IE 6]> -<script type="text/javascript"> - /*Load jQuery if not already loaded*/ if(typeof jQuery == 'undefined'){ document.write("<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js\"></"+"script>"); var __noconflict = true; } +<script type="text/javascript"> + /*Load jQuery if not already loaded*/ if(typeof jQuery == 'undefined'){ document.write("<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js\"></"+"script>"); var __noconflict = true; } var IE6UPDATE_OPTIONS = { icons_path: "/ie6update/images/" } @@ -698,6 +698,25 @@ $SIDEBAR_DATA .= '</ul>'; } +/** + * Print a view + * + * @param string $templateName + * @param array $params + * @return void + */ +function print_view($templateName, array $params = array()) { + $path = $_SERVER['DOCUMENT_ROOT'] . '/views/' . $templateName; + if(file_exists($path)) { + if(!empty($params)) { + foreach($params as $key => $param) { + $$key = $param; + } + } + include_once $path; + } +} + // Print news function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) { $retval = array(); Index: include/header.inc =================================================================== --- include/header.inc (revision 315128) +++ include/header.inc (working copy) @@ -1,4 +1,6 @@ <?php +error_reporting(E_ALL); +ini_set('display_errors', 'On'); // Disable caching, annoying while developing $v = "?v=" .$_SERVER["REQUEST_TIME"]; header("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); @@ -16,11 +18,11 @@ <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $lang?>"> <head> - + <title>PHP: <?php echo $title ?></title> - + <meta charset="utf-8"/> - + <link rel="shortcut icon" href="<?php echo $STATIC_ROOT ?>favicon.ico" /> <link rel="search" type="application/opensearchdescription+xml" href="http://www.php.net/phpnetimprovedsearch.src" title="Add PHP.net search" /> <link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE ?>releases.atom" title="PHP Release feed" /> @@ -36,13 +38,13 @@ <?php foreach($config["meta-navigation"] as $rel => $page): ?> <link rel="<?php echo $rel ?>" href="<?php echo $MYSITE ?><?php echo $page ?>" /> <?php endforeach ?> - - <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/reset.css<?php echo $v?>" media="all" /> + + <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/reset.css<?php echo $v?>" media="all" /> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/theme.css<?php echo $v?>" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/doc.css<?php echo $v?>" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/home.css<?php echo $v?>" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/dynamic.php<?php echo $v?>" media="screen" /> - + <!--[if lte IE 7]> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/workarounds.ie7.css<?php echo $v?>" media="screen" /> <![endif]--> @@ -54,7 +56,7 @@ <!--[if IE]> <script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/ext/html5.js<?php echo $v?>"></script> <![endif]--> - + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script> <script type="text/javascript"> @@ -67,7 +69,7 @@ <?php if (!empty($_SERVER["BASE_HREF"])): ?> <base href="<?php echo $_SERVER["BASE_HREF"] ?>" /> <?php endif ?> - + </head> <body class="<?php print $curr; ?>"> @@ -82,7 +84,7 @@ </div> </div> <nav id="headnav"> - + <ul id="headmenu"> <li id="headsearch"> <form method="post" action="/search.php" id="topsearch"> @@ -204,7 +206,7 @@ <br style="clear: both;" /> </div></div></div> </li> - + </ul> <br style="clear: both;" /> </nav> Index: styles/home.css =================================================================== --- styles/home.css (revision 315128) +++ styles/home.css (working copy) @@ -60,7 +60,7 @@ } -/* We have to override these because theme.css has a generic style for 'ul' +/* We have to override these because theme.css has a generic style for 'ul' and that doesn't apply here on the downloads area */ #mega-drop-down div.download ul { @@ -268,12 +268,13 @@ } div.home-sidebar h2 { - border-top: 6px solid #c3add9; + border-bottom: 6px solid #c3add9; font-size: 1.5em; line-height: 100%; - padding: 5px 0 10px 0; + padding: 5px 0 5px 0; font-weight: normal; - margin: 0; + margin: 0 0 5px 0; + margin-top: 20px; } div.home-sidebar h2:first-child { @@ -281,7 +282,7 @@ } div.home-sidebar ul { - margin: 0 0 30px 0; + margin: 0 0 0 0; list-style-type: none; padding: 0; } \ No newline at end of file
Index: index-beta.php =================================================================== --- index-beta.php (revision 315128) +++ index-beta.php (working copy) @@ -49,62 +49,6 @@ include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; include_once $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc'; -// Prepare news headings. -$news = "<ul>"; -foreach (print_news($NEWS_ENTRIES, "frontpage", 5, null, true) as $entry) { - $news .= <<< EOT -<li>[{$entry["date"]}] <a href="{$entry["permlink"]}">{$entry["title"]}</a></li> -EOT; -} -$news .= "</ul>"; -$news .= '<p class="center"><a href="/archive/index.php">News Archive</a></p>'; - -// Prepare sidebar. -$sidebar = <<< EOT -<div class=home-sidebar> - <h2>Recent News</h2> - <ul> - <li>PHP 5.3.5 and 5.2.17 Released!</li> - <li>PHP 5.2.16 Released!</li> - <li>PHP 5.3.4 Released!</li> - </ul> - - <h2>Conferences</h2> - <ul> - <li>Lorem ipsum dolor sit amet</li> - <li>Lorem ipsum dolor sit amet</li> - <li>Lorem ipsum dolor sit amet</li> - </ul> - - <h2>User Group Events</h2> - <ul> - <li>Lorem ipsum dolor sit amet</li> - <li>Lorem ipsum dolor sit amet</li> - <li>Lorem ipsum dolor sit amet</li> - </ul> - - <h2>Thanks To</h2> - <ul> - <li><a href="http://www.easydns.com/?V=698570efeb62a6e2" title="DNS Hosting provided by easyDNS">easyDNS</a></li> - <li><a href="http://www.directi.com/">Directi</a></li> - <li><a href="http://promote.pair.com/direct.pl?php.net">pair Networks</a></li> - <li><a href="http://www.servercentral.net/">Server Central</a></li> - <li><a href="http://www.hostedsolutions.com/">Hosted Solutions</a></li> - <li><a href="http://www.spry.com/">Spry VPS Hosting</a></li> - <li><a href="http://ez.no/">eZ Systems</a> / <a href="http://www.hit.no/">HiT</a></li> - <li><a href="http://www.osuosl.org">OSU Open Source Lab</a></li> - <li><a href="http://www.yahoo.com/">Yahoo! Inc.</a></li> - <li><a href="http://www.binarysec.com/">BinarySEC</a></li> - <li><a href="http://www.nexcess.net/">NEXCESS.NET</a></li> - <li><a href="http://www.rackspace.com/">Rackspace</a></li> - <li><a href="http://www.eukhost.com/">EUKhost</a></li> - <li><a href="http://www.micfo.com/">micfo</a></li> - <li><a href="http://www.redpill-linpro.com">Redpill Linpro</a></li> - <li><a href="http://www.facebook.com">Facebook</a></li> - </ul> -</div> -EOT; - // Prepare announcements. $announcements = " <div class='announcements'> @@ -120,8 +64,8 @@ <h2>Get Involved!</h2> <p> Getting involved with PHP is easier than you think. - Are you interested in helping to improve one of the world's most - widely used scripting languages? We are looking for all sorts + Are you interested in helping to improve one of the world's most + widely used scripting languages? We are looking for all sorts of people, not only developers. <a href='/get-involved.php' class='readmore'>Read more...</a> </p> @@ -130,8 +74,8 @@ <span class=graphic></span> <h2>Need Help?</h2> <p> - Everyone needs a little help from time to time, and finding it - isn't always easy. Thankfully, PHP has one of the best support + Everyone needs a little help from time to time, and finding it + isn't always easy. Thankfully, PHP has one of the best support communities out there. <a href='/support.php' class='readmore'>Read more...</a> </p> @@ -177,7 +121,7 @@ 'onload' => 'boldEvents();', 'headtags' => array( '<link rel="alternate" type="application/atom+xml" title="PHP: Hypertext Preprocessor" href="' . $MYSITE . 'feed.atom" />', - '<script type="text/javascript">', + '<script type="text/javascript">', "function okc(f){var c=[38,38,40,40,37,39,37,39,66,65,13],x=function(){x.c=x.c||Array.apply({},c);x.r=function(){x.c=null};return x.c},h=function(e){if(x()[0]==(e||window.event).keyCode){x().shift();if(!x().length){x.r();f()}}else{x.r()}};window.addEventListener?window.addEventListener('keydown',h,false):document.attachEvent('onkeydown',h)}", "okc(function(){if(document.getElementById){i=document.getElementById('phplogo');i.src='".$_SERVER['STATIC_ROOT']."/images/php_konami.gif'}});", '</script>' @@ -202,7 +146,7 @@ ); // Print body of home page. -print $sidebar; +print_view('homepage/sidebar.php', array('news' => $NEWS_ENTRIES)); print $content; // Print the common footer. Index: views/homepage/sidebar.php =================================================================== --- views/homepage/sidebar.php (revision 0) +++ views/homepage/sidebar.php (revision 0) @@ -0,0 +1,6 @@ +<div class=home-sidebar> + <?php print_view('homepage/news.php', array('news' => $news)); ?> + <?php print_view('homepage/conferences.php'); ?> + <?php print_view('homepage/ug_events.php'); ?> + <?php print_view('homepage/thanks.php'); ?> +</div> \ No newline at end of file Index: views/homepage/conferences.php =================================================================== --- views/homepage/conferences.php (revision 0) +++ views/homepage/conferences.php (revision 0) @@ -0,0 +1,6 @@ +<h2>Conferences</h2> +<ul> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> +</ul> \ No newline at end of file Index: views/homepage/news.php =================================================================== --- views/homepage/news.php (revision 0) +++ views/homepage/news.php (revision 0) @@ -0,0 +1,13 @@ +<h2>Recent News</h2> +<ul> + <?php + $i = 0; + foreach (print_news($news, "frontpage", 5, null, true) as $entry): + $escaped_title = htmlentities($entry['title'], ENT_QUOTES, 'UTF-8'); + ?> + <li><a target="_blank" title="<?= $escaped_title; ?>" href="<?= $entry['permlink']; ?>"><?= $escaped_title; ?></a></li> + <?php + endforeach; + ?> +</ul> +<p class="center"><a href="/archive/index.php" title="News Archive">News Archive</a></p> \ No newline at end of file Index: views/homepage/ug_events.php =================================================================== --- views/homepage/ug_events.php (revision 0) +++ views/homepage/ug_events.php (revision 0) @@ -0,0 +1,6 @@ +<h2>User Group Events</h2> +<ul> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> +</ul> \ No newline at end of file Index: views/homepage/thanks.php =================================================================== --- views/homepage/thanks.php (revision 0) +++ views/homepage/thanks.php (revision 0) @@ -0,0 +1,19 @@ +<h2>Thanks To</h2> +<ul> + <li><a href="http://www.easydns.com/?V=698570efeb62a6e2" title="DNS Hosting provided by easyDNS">easyDNS</a></li> + <li><a href="http://www.directi.com/">Directi</a></li> + <li><a href="http://promote.pair.com/direct.pl?php.net">pair Networks</a></li> + <li><a href="http://www.servercentral.net/">Server Central</a></li> + <li><a href="http://www.hostedsolutions.com/">Hosted Solutions</a></li> + <li><a href="http://www.spry.com/">Spry VPS Hosting</a></li> + <li><a href="http://ez.no/">eZ Systems</a> / <a href="http://www.hit.no/">HiT</a></li> + <li><a href="http://www.osuosl.org">OSU Open Source Lab</a></li> + <li><a href="http://www.yahoo.com/">Yahoo! Inc.</a></li> + <li><a href="http://www.binarysec.com/">BinarySEC</a></li> + <li><a href="http://www.nexcess.net/">NEXCESS.NET</a></li> + <li><a href="http://www.rackspace.com/">Rackspace</a></li> + <li><a href="http://www.eukhost.com/">EUKhost</a></li> + <li><a href="http://www.micfo.com/">micfo</a></li> + <li><a href="http://www.redpill-linpro.com">Redpill Linpro</a></li> + <li><a href="http://www.facebook.com">Facebook</a></li> +</ul> \ No newline at end of file Index: views/homepage/sidebar.php =================================================================== --- views/homepage/sidebar.php (revision 0) +++ views/homepage/sidebar.php (revision 0) @@ -0,0 +1,6 @@ +<div class=home-sidebar> + <?php print_view('homepage/news.php', array('news' => $news)); ?> + <?php print_view('homepage/conferences.php'); ?> + <?php print_view('homepage/ug_events.php'); ?> + <?php print_view('homepage/thanks.php'); ?> +</div> \ No newline at end of file Index: views/homepage/conferences.php =================================================================== --- views/homepage/conferences.php (revision 0) +++ views/homepage/conferences.php (revision 0) @@ -0,0 +1,6 @@ +<h2>Conferences</h2> +<ul> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> +</ul> \ No newline at end of file Index: views/homepage/news.php =================================================================== --- views/homepage/news.php (revision 0) +++ views/homepage/news.php (revision 0) @@ -0,0 +1,13 @@ +<h2>Recent News</h2> +<ul> + <?php + $i = 0; + foreach (print_news($news, "frontpage", 5, null, true) as $entry): + $escaped_title = htmlentities($entry['title'], ENT_QUOTES, 'UTF-8'); + ?> + <li><a target="_blank" title="<?= $escaped_title; ?>" href="<?= $entry['permlink']; ?>"><?= $escaped_title; ?></a></li> + <?php + endforeach; + ?> +</ul> +<p class="center"><a href="/archive/index.php" title="News Archive">News Archive</a></p> \ No newline at end of file Index: views/homepage/ug_events.php =================================================================== --- views/homepage/ug_events.php (revision 0) +++ views/homepage/ug_events.php (revision 0) @@ -0,0 +1,6 @@ +<h2>User Group Events</h2> +<ul> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> + <li>Lorem ipsum dolor sit amet</li> +</ul> \ No newline at end of file Index: views/homepage/thanks.php =================================================================== --- views/homepage/thanks.php (revision 0) +++ views/homepage/thanks.php (revision 0) @@ -0,0 +1,19 @@ +<h2>Thanks To</h2> +<ul> + <li><a href="http://www.easydns.com/?V=698570efeb62a6e2" title="DNS Hosting provided by easyDNS">easyDNS</a></li> + <li><a href="http://www.directi.com/">Directi</a></li> + <li><a href="http://promote.pair.com/direct.pl?php.net">pair Networks</a></li> + <li><a href="http://www.servercentral.net/">Server Central</a></li> + <li><a href="http://www.hostedsolutions.com/">Hosted Solutions</a></li> + <li><a href="http://www.spry.com/">Spry VPS Hosting</a></li> + <li><a href="http://ez.no/">eZ Systems</a> / <a href="http://www.hit.no/">HiT</a></li> + <li><a href="http://www.osuosl.org">OSU Open Source Lab</a></li> + <li><a href="http://www.yahoo.com/">Yahoo! Inc.</a></li> + <li><a href="http://www.binarysec.com/">BinarySEC</a></li> + <li><a href="http://www.nexcess.net/">NEXCESS.NET</a></li> + <li><a href="http://www.rackspace.com/">Rackspace</a></li> + <li><a href="http://www.eukhost.com/">EUKhost</a></li> + <li><a href="http://www.micfo.com/">micfo</a></li> + <li><a href="http://www.redpill-linpro.com">Redpill Linpro</a></li> + <li><a href="http://www.facebook.com">Facebook</a></li> +</ul> \ No newline at end of file Index: include/layout.inc =================================================================== --- include/layout.inc (revision 315128) +++ include/layout.inc (working copy) @@ -350,8 +350,8 @@ </div> </div> <!--[if IE 6]> -<script type="text/javascript"> - /*Load jQuery if not already loaded*/ if(typeof jQuery == 'undefined'){ document.write("<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js\"></"+"script>"); var __noconflict = true; } +<script type="text/javascript"> + /*Load jQuery if not already loaded*/ if(typeof jQuery == 'undefined'){ document.write("<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js\"></"+"script>"); var __noconflict = true; } var IE6UPDATE_OPTIONS = { icons_path: "/ie6update/images/" } @@ -698,6 +698,25 @@ $SIDEBAR_DATA .= '</ul>'; } +/** + * Print a view + * + * @param string $templateName + * @param array $params + * @return void + */ +function print_view($templateName, array $params = array()) { + $path = $_SERVER['DOCUMENT_ROOT'] . '/views/' . $templateName; + if(file_exists($path)) { + if(!empty($params)) { + foreach($params as $key => $param) { + $$key = $param; + } + } + include_once $path; + } +} + // Print news function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) { $retval = array(); Index: include/header.inc =================================================================== --- include/header.inc (revision 315128) +++ include/header.inc (working copy) @@ -1,4 +1,6 @@ <?php +error_reporting(E_ALL); +ini_set('display_errors', 'On'); // Disable caching, annoying while developing $v = "?v=" .$_SERVER["REQUEST_TIME"]; header("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); @@ -16,11 +18,11 @@ <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $lang?>"> <head> - + <title>PHP: <?php echo $title ?></title> - + <meta charset="utf-8"/> - + <link rel="shortcut icon" href="<?php echo $STATIC_ROOT ?>favicon.ico" /> <link rel="search" type="application/opensearchdescription+xml" href="http://www.php.net/phpnetimprovedsearch.src" title="Add PHP.net search" /> <link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE ?>releases.atom" title="PHP Release feed" /> @@ -36,13 +38,13 @@ <?php foreach($config["meta-navigation"] as $rel => $page): ?> <link rel="<?php echo $rel ?>" href="<?php echo $MYSITE ?><?php echo $page ?>" /> <?php endforeach ?> - - <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/reset.css<?php echo $v?>" media="all" /> + + <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/reset.css<?php echo $v?>" media="all" /> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/theme.css<?php echo $v?>" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/doc.css<?php echo $v?>" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/home.css<?php echo $v?>" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/dynamic.php<?php echo $v?>" media="screen" /> - + <!--[if lte IE 7]> <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/workarounds.ie7.css<?php echo $v?>" media="screen" /> <![endif]--> @@ -54,7 +56,7 @@ <!--[if IE]> <script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/ext/html5.js<?php echo $v?>"></script> <![endif]--> - + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script> <script type="text/javascript"> @@ -67,7 +69,7 @@ <?php if (!empty($_SERVER["BASE_HREF"])): ?> <base href="<?php echo $_SERVER["BASE_HREF"] ?>" /> <?php endif ?> - + </head> <body class="<?php print $curr; ?>"> @@ -82,7 +84,7 @@ </div> </div> <nav id="headnav"> - + <ul id="headmenu"> <li id="headsearch"> <form method="post" action="/search.php" id="topsearch"> @@ -204,7 +206,7 @@ <br style="clear: both;" /> </div></div></div> </li> - + </ul> <br style="clear: both;" /> </nav> Index: styles/home.css =================================================================== --- styles/home.css (revision 315128) +++ styles/home.css (working copy) @@ -60,7 +60,7 @@ } -/* We have to override these because theme.css has a generic style for 'ul' +/* We have to override these because theme.css has a generic style for 'ul' and that doesn't apply here on the downloads area */ #mega-drop-down div.download ul { @@ -268,12 +268,13 @@ } div.home-sidebar h2 { - border-top: 6px solid #c3add9; + border-bottom: 6px solid #c3add9; font-size: 1.5em; line-height: 100%; - padding: 5px 0 10px 0; + padding: 5px 0 5px 0; font-weight: normal; - margin: 0; + margin: 0 0 5px 0; + margin-top: 20px; } div.home-sidebar h2:first-child { @@ -281,7 +282,7 @@ } div.home-sidebar ul { - margin: 0 0 30px 0; + margin: 0 0 0 0; list-style-type: none; padding: 0; } \ No newline at end of file