<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );echo '<p align="center">Αρχειθετημένες Ειδήσεις άνα Μήνα :</p>';echo '<p align="center"><select name="archdate" id="archdate" size="1" class="selectbox" onchange="gotoarchive();" ></p>';$months = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august','september','octomber', 'november','december');$curmonth = date('n').'-'.date('Y');for ($y=2009; $y < (date('Y') + 1); $y++) { for ($m=1; $m<13; $m++) { $n = $m - 1; $sel = ($curmonth == $months[$n].'-'.$y) ? ' selected="selected"' : ''; $trans = $months[$n]; $trans = eLOCALE::set_locale('greek'); $trans = eLOCALE::strftime_os('%B'); echo '<option value="'.$months[$n].'-'.$y.'"'.sel.'>'.$trans.', '.$y."</option>\n"; if ($sel != '') { break(2); } }}?></select><script type="text/javascript">/* <![CDATA[ */function gotoarchive() { var el = document.getElementById('archdate'); var sm = el.options[el.selectedIndex].value; var url ='<?php echo $mainframe->getCfg('live_site'); ?>/news-archive/'+sm+'/'; document.location.href = url;}/* ]]> */</script></p>
<script type="text/javascript">/* <![CDATA[ */function gotoarchive() { var el = document.getElementById('archdate'); var sm = el.options[el.selectedIndex].value; var url ='<?php echo $mainframe->getCfg('live_site'); ?>/news-archive/'+sm+'/'; document.location.href = url;}/* ]]> */</script><?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );eLOCALE::set_locale('greek');echo '<p align="center">Αρχειθετημένες Ειδήσεις άνα Μήνα :</p>';echo '<p align="center"><select name="archdate" id="archdate" size="1" class="selectbox" onchange="gotoarchive();" ></p>';$months = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august','september','octomber', 'november','december');$curmonth = date('n').'-'.date('Y');for ($y=2009; $y < (date('Y') + 1); $y++) { for ($m=1; $m<13; $m++) { $n = $m - 1; $sel = ($curmonth == $months[$n].'-'.$y) ? ' selected="selected"' : ''; $trans = eLOCALE::strftime_os("%B", mktime(1, 0, 0, $m, 10, 2009)); echo '<option value="'.$months[$n].'-'.$y.'"'.sel.'>'.$trans.', '.$y."</option>\n"; if ($sel != '') { break(2); } }}echo '</select>'?>
<?php$query = "SELECT * FROM #__categories WHERE section='15'" ;$database->setQuery($query,'#__',12,0);$row= $database->loadObjectList();?>
<?php //έστω$mindate = '2008-10-18 12:45:20';$maxdate = '2009-03-05 19:11:50';$ymin = date('Y', strtotime($mindate));$mmin = date('m', strtotime($mindate));$ts2 = mktime(0, 0, 0, date('m', strtotime($maxdate)), 1, date('Y', strtotime($maxdate)));$stopdate = date('Ym', $ts2);$continue = true;$final = array();while ($continue === true) { $ts = mktime(0, 0, 0, $mmin, 1, $ymin); $d = date('Ym', $ts); if ($d <= $stopdate) { array_push($final, $d); } else { $continue = false; } $mmin++;}print_r($final); //το τελικό array με τα έτη και τους μήνες?>
Array ( [0] => 200810 [1] => 200811 [2] => 200812 [3] => 200901 [4] => 200902 [5] => 200903)
<script type="text/javascript">/* <![CDATA[ */function gotoarchive() { var el = document.getElementById('archdate'); var sm = el.options[el.selectedIndex].value; var url ='<?php echo $mainframe->getCfg('live_site'); ?>/news-archive/'+sm+'/'; document.location.href = url;}/* ]]> */</script><?phpdefined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );global $database;$query = "SELECT seotitle FROM #__categories WHERE section='15' AND published='1'";$database->setQuery($query,'#__',12,0);$rows = $database->loadResultArray();echo '<p align="center"><select name="archdate" id="archdate" size="1" class="selectbox" onchange="gotoarchive();" ></p>';$months = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august','september','octomber', 'november','december');$curmonth = date('n').'-'.date('Y');for ($y=2009; $y < (date('Y') + 1); $y++) { for ($m=1; $m<13; $m++) { $n = $m - 1; $row = $rows[$n]; echo $row->seotitle; if($curmonth == $m.'-'.$y){ $sel = 'selected="selected"'; $trans = eLOCALE::strftime_os("%B", mktime(1, 0, 0, $m, 10, 2009)); echo '<option value="'.$months[$n].'-'.$y.'"'.$sel.'>'.$trans.', '.$y."</option>\n"; } else if($months[$n].'-'.$y == $row->seotitle) { $trans = eLOCALE::strftime_os("%B", mktime(1, 0, 0, $m, 10, 2009)); echo '<option value="'.$months[$n].'-'.$y.'">'.$trans.', '.$y."</option>\n"; } else if ($row->seotitle == ''){ $trans = eLOCALE::strftime_os("%B", mktime(1, 0, 0, $m, 10, 2009)); echo '<option value="'.$months[$n].'-'.$y.'">'.$trans.', '.$y."</option>\n"; } }}echo '</select>'?>
Να καλώ με Query την βάση μέσω elxis και να μου βγάζει τα αποτελέσματα σαν έναν πίνακα όπου το $row[0] να είναι η πρώτη εγγραφή που έχει βρει.
Από εκεί και πέρα λόγω ασφάλειας που είναι απολύτως φυσιολογικό μπορούμε να καλέσουμε συναρτήσεις όπως setQuery() , loadObjectList() etc τις οποίες που μπορώ να μάθω περισσότερα ;
$database->setQuery("SELECT COUNT(*) FROM #__xxx");$count = $database->loadResult();