Welcome Guest, Not a member yet? Register   Sign In
Adding multiple variables to calendar days
#2

(This post was last modified: 08-01-2017, 11:45 AM by Martin7483.)

From the documentation

PHP Code:
$this->load->library('calendar');

$data = array(
 
       3  => 'http://example.com/news/article/2006/06/03/',
 
       7  => 'http://example.com/news/article/2006/06/07/',
 
       13 => 'http://example.com/news/article/2006/06/13/',
 
       26 => 'http://example.com/news/article/2006/06/26/'
);

echo 
$this->calendar->generate(20066$data); 

Quote:Using the above example, day numbers 3, 7, 13, and 26 will become links pointing to the URLs you’ve provided.

You will need to pass a data array that holds an url for each day of a given month


This function will generate an array containing the number of days for each month of a passed in year.
If you don't pass in a year the current year is used
PHP Code:
function days_per_month($year '')
{
 
   $year = empty($year) ? date("Y"time()) : $year;
 
   
    for
($month 1$month <= 12$month++)
 
   {
 
       $days_per_month[$month] = date("t"mktime(000$month1$year) );
 
   }
    return 
$days_per_month;

Reply


Messages In This Thread
RE: Adding multiple variables to calendar days - by Martin7483 - 08-01-2017, 11:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB