Jump to content

inserting current month as a include.


hullcalendar

Recommended Posts

hey guys, im trying to create a local event website displaying a calendar for each month showing local events.

 

now i haven't got around to actually setting up the database yet so im sure i will be back with more questions about that soon, however im just trying to get the site frame work and im using a lot of includes as the site is subject to a lot of change etc. \

 

now basically i have a page called 'whatson.php' which im using this code to switch the include depending on the link clicked

<?php
switch($_GET['changePage']) {
    default:
    case 'default':
    include('test1.php');
    break; 
    case 'january':
    include('january.php');
    break;
    case 'february':
    include('february.php');
    break;
    case 'march':
    include('march.php');
    break;
    case 'april':
    include('april.php');
    break;
    case 'may':
    include('may.php');
    break;
    case 'june':
    include('june.php');
    break;
    case 'july':
    include('july.php');
    break;
    case 'august':
    include('august.php');
    break;
    case 'september':
    include('september.php');
    break;
    case 'october':
    include('october.php');
    break;
    case 'novemeber':
    include('novemeber.php');
    break;
    case 'december':
    include('december.php');
    break;
}
?>

 

now what i want is the default page at the to to display the current month, so i was wondering if there is anyway somebody could help me out with a code that gets the current month from the server or somewhere and inserts it into the default month part at the top of that code...

 

any help would be amazing

 

Link to comment
https://forums.phpfreaks.com/topic/249588-inserting-current-month-as-a-include/
Share on other sites

im really new to php so the only thing i have come up with is something like this, of course it doesn't work but im only at the start of my php for beginners book ha!

 

<?php

 

date_default_timezone_set('GMT');

 

$date = "date('F')";

 

include("'$date'.php");

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.