Location: PHPKode > projects > PowerMovieList > powermovielist-0_14_beta/templates/index/date_old.tpl
{* powermovielist index-page - group by date-template
 * $Id: date_old.tpl,v 1.1 2006/01/19 18:20:24 niko Exp $ *}
{* 
Don't modify this file, make a copy of it and select the template in the design-config.
More Information about the syntax on http://smarty.php.net/manual/en/.

If you created a cool template, please send it to us!
www.powermovielist.com
*}
<html>
<head>
  <link REL="shortcut icon" HREF="image/divx.ico">
  <title>PowerMovieList - {$ActiveList.title}</title>
  <meta http-equiv="Content-Type" content="text/html; charset={$lang.LngCharSet}">
  <link rel="stylesheet" href="css/{if $ActiveList.designcss}{$ActiveList.designcss}{else}default.css{/if}"> 
</head>
<body>
{*
this is just a demonstration what index-pages you could create...
to get the {php}-tags work you must disable smartysecurity in config.inc.php

the number of entries loaded (default 5) is defined in design-config - but don't use
too high numbers, as it might cause performance-problems (but not a big problem if caching is enabled)

this example also uses a list named "News" and prints out the entries always on top (every day)
*}
{php}

//GroupBy - name of a filed or ListName/DateAdded/UserID etc...
$groupBy1 = "DateAdded";
$groupBy2 = "ListName"; //or Typ



//first the the movie-date into $MovieData
$MovieData = $GLOBALS['smarty']->_tpl_vars['MovieData'];

//first collect the data on what date what list should be displayed:
//(or whatever GroupBy defined)
foreach($MovieData as $kMovie=>$Movie) {
    $Dat[$Movie[$groupBy1]][$Movie[$groupBy2]][] = $kMovie;
}


foreach($Dat as $kGroup1=>$iGroup1) { //run through all group1's (=dates)
	echo "<br><b>$groupBy1: $kGroup1:</b><br>"; //print out date

    //here display FIRST the entries from list "News"
    foreach($iGroup1 as $kGroup2=>$iGroup2) { //run through all group2's
        if($kGroup2[0]['ListName']!="News") continue; //skip list named NOT "News"
        foreach($iGroup2 as $kMovie) { //print out all news-entries:
            $Movie = $MovieData[$kMovie];
            echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Movie[Title]<br>\n";
        }        
    }

	foreach($iGroup1 as $kGroup2=>$iGroup2) { //run through all group2's
        if($kGroup2[0]['ListName']=="News") continue; //skip list named "News"
		echo "&nbsp;&nbsp;&gt;$groupBy2: $kGroup2<br>\n"; //print out listname
        foreach($iGroup2 as $kMovie) {
            $Movie = $MovieData[$kMovie];
            echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Movie[Title]<br>\n";
        }

	}
}

{/php}
</body>
</html>
Return current item: PowerMovieList