Monthly calendar with category dropdown menu/selector

Need some help with the script?

Monthly calendar with category dropdown menu/selector

Postby Ned Flanders » Fri May 15, 2009 10:08 pm

Dear people,

As you can I see below I still have to finish the elsif-statement for go =”calendar”:

_______________________
<?php
include 'cuteru/head.php';

$header = array(
'users' => 'Users',
'search' => 'Search',
'category' => 'Categories',
'archives' => 'Archives',
);
?>


<a href="go=news">news</a> |
<a href="go=headlines">headlines</a> |
<a href="go= categories ">categories</a> |
<a href="go=search">search</a>


<?php
error_reporting (E_ALL ^ E_NOTICE);

if($_GET['go'] == "" or $_GET['go'] == "news"){
$show_calendar = true;
$number = 8;
include("cuteru/show_news.php");
}
elseif($_GET['go'] == "headlines"){
$template = "Headlines";
include("cuteru/show_news.php");
}
elseif($_GET['go'] == "categories"){
echo cn_archives();
echo cn_category();
}
elseif($_GET['go'] == "calendar"){
// what php code to write here??????
}
elseif($_GET['go'] == "search"){
include("cuteru/search.php");
}
?>

_______________________
When I click on the calendar link, I want the calendar of all twelve months to appear (three calendars per line, all categories) with a dropdown menu above it to select the categories.
I have tried by inserting the lines below in the elseif statement:

_______________________
php include('cuteru/calendar.php');

elseif($_GET['go'] == "calendar"){
category_dropdown().'<br />'.calendar_list($month_per_line = '3', $news = true, $archives = true, ($_POST ? $categories = $_POST['drop_cat'] : $categories = false));
calendar_list($month_per_line = '3', $news = true, $archives = true, $categories = false, $start_year = false);
}
_______________________
….but that just gives me calendars of 1969 and a whole bunch of the same error lines, starting as follows:

_______________________
Warning: file(/home/flanders/public_html/cuteru/data/category.db.php) [function.file]: failed to open stream: No such file or directory in /home/flanders/public_html/cuteru/calendar.php on line 437

Warning: Invalid argument supplied for foreach() in /home/flanders/public_html/cuteru/calendar.php on line 443

// HERE YOU FIND THE DROP DOWN MENU

Warning: file(/home/flanders/public_html/cuteru/data/news.txt) [function.file]: failed to open stream: No such file or directory in /home/flanders/public_html/cuteru/calendar.php on line 38

Warning: Invalid argument supplied for foreach() in /home/flanders/public_html/cuteru/calendar.php on line 43

Warning: opendir(/home/flanders/public_html/cuteru/data/archives) [function.opendir]: failed to open dir: No such file or directory in /home/flanders/public_html/cuteru/calendar.php on line 72

Warning: readdir(): supplied argument is not a valid Directory resource in /home/flanders/public_html/cuteru/calendar.php on line 74

Warning: closedir(): supplied argument is not a valid Directory resource in /home/flanders/public_html/cuteru/calendar.php on line 81

Warning: date() expects parameter 2 to be long, string given in /home/flanders/public_html/cuteru/inc/lang/en/langdate.php on line 24

Warning: date() expects parameter 2 to be long, string given in /home/flanders/public_html/cuteru/inc/lang/en/langdate.php on line 25

Warning: date() expects parameter 2 to be long, string given in /home/flanders/public_html/cuteru/inc/lang/en/langdate.php on line 26…..............
_______________________


Etc., etc. Over hundred lines of the last mentioned date error, concluding with 12 beautiful 1969 monthly calendars!
Well, that's how far I got. Your help would be greatly appreciated!

Best regards, Ned.
User avatar
Ned Flanders
 
Posts: 55
Joined: Mon May 11, 2009 10:28 pm
Location: Holy Kingdom

Postby Ned Flanders » Wed May 20, 2009 7:16 pm

FI-DD? Anybody? :roll: :shock: :?
User avatar
Ned Flanders
 
Posts: 55
Joined: Mon May 11, 2009 10:28 pm
Location: Holy Kingdom

Postby FI-DD » Sat May 23, 2009 7:01 pm

You are using code from my calendar plugin for the original Cutenews (cutephp.com). In CNR the calendar is already built-in. Just check the example page to see how to show the calendar.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby Ned Flanders » Sat May 23, 2009 7:19 pm

FI-DD wrote:You are using code from my calendar plugin for the original Cutenews (cutephp.com). In CNR the calendar is already built-in. Just check the example page to see how to show the calendar.


That's correct. I just thought let's give it a try in CNR. I've got the CNR built-in calendar already working. I just also would like to have a yearly overview with twelve monthly calendars with a dropdown to select which kind of news to be shown in the calendar. Is that also possible with in CNR integrated calendar FI-DD?
User avatar
Ned Flanders
 
Posts: 55
Joined: Mon May 11, 2009 10:28 pm
Location: Holy Kingdom

Postby Ned Flanders » Fri Jun 05, 2009 11:44 am

Anybody? :?
User avatar
Ned Flanders
 
Posts: 55
Joined: Mon May 11, 2009 10:28 pm
Location: Holy Kingdom

Postby FI-DD » Sat Jun 06, 2009 10:54 pm

The following code shows all the news of the current year:
Code: Select all
foreach ($sql->select(array('table' => 'news', 'where' => array('date < '.time()))) as $row){
         $save[] = $row['date'];
      }

      @rsort($save);
      

echo '<table><tr>';

   for($i = 1; $i <= 12; $i++){
      $events = array();
      foreach($save as $date){
         if (date('Y') == date('Y', $date) and $i == date('n', $date)){
            $events[date('j', $date)] = $date;
         }
      }
      echo '<td>'.calendar($i, date('Y'), $events, false).'</td>';
      if($i%3 == 0) echo '</tr><tr>';
   }

echo '</tr></table>';


Head.php must be included before to make this work.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby Ned Flanders » Mon Jun 08, 2009 5:30 pm

Thanks FI-DD. I tried it out just now, but all I get is:

Warning: include(/home/flanders/cuteru/head.php) [function.include]: failed to open stream: No such file or directory in /home/flanders/public_html/test.php on line 3

Warning: include() [function.include]: Failed opening '/home/flanders/cuteru/head.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/flanders/public_html/test.php on line 3

Fatal error: Call to a member function select() on a non-object in /home/flanders/public_html/test.php on line 6

:roll:

What have I done wrong?
User avatar
Ned Flanders
 
Posts: 55
Joined: Mon May 11, 2009 10:28 pm
Location: Holy Kingdom

Postby FI-DD » Sun Jul 05, 2009 7:54 pm

The path to head.php seems to be wrong.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby Ned Flanders » Sun Jul 05, 2009 10:19 pm

FI-DD wrote:The path to head.php seems to be wrong.


I must have done something stupid. I just recopied and reinserted your code and this time it worked straight away. Thanks FI-DD.
Looks great. Only thing I'd further like to add is a dropdown menu to select a certain category :oops: :roll:

PS Bye the way, do you remember my posts on new aticles taking like two days or so to highlight the corresponding date on the calender. Well, I have published an article yesterday, which is not visible in my monthly calendar, which I have placed in a sidebar. In this (new!) yearly overview, it's already highlighted on July's calendar. Funny innit? Two July calendars showing 'different' things.
User avatar
Ned Flanders
 
Posts: 55
Joined: Mon May 11, 2009 10:28 pm
Location: Holy Kingdom


Return to Help



Who is online

Users browsing this forum: No registered users and 4 guests

cron