Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7868531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:01:57+00:00 2026-06-03T01:01:57+00:00

I had used CodeIgniter for a lot of my projects and I decided to

  • 0

I had used CodeIgniter for a lot of my projects and I decided to use the Calendaring Class over Jquery Calendar to display monthly bookings. I have set it up and displaying data FINE.

It’s the fact that I don’t need the weekends, there taking up precious room on my webpage. I have researched online and some people explain that you can use the template in the $prefs array.

I think its something to do with the Template Parser Class but I just can’t get my head around it.

If any can give me link, help or examples it would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:01:59+00:00Added an answer on June 3, 2026 at 1:01 am

    I hope this is what you wanted.

    Please copy MY_Calendar.php to your library directory and in your controller paste this code:

    //controller
    $prefs['start_day'] = 'monday';         
    $this->load->library('calendar',$prefs);
    echo $this->calendar->generate_weekdays();
    

    MY_Calendar.php file:

    <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    class MY_Calendar extends CI_Calendar
    {
        public function __construct($config = array())
        {
            parent::__construct($config);
        }
    
        public function generate_weekdays($year = '', $month = '', $data = array())
        {
            // Set and validate the supplied month/year
            if ($year == '')
                $year  = date("Y", $this->local_time);
    
            if ($month == '')
                $month = date("m", $this->local_time);
    
            if (strlen($year) == 1)
                $year = '200'.$year;
    
            if (strlen($year) == 2)
                $year = '20'.$year;
    
            if (strlen($month) == 1)
                $month = '0'.$month;
    
            $adjusted_date = $this->adjust_date($month, $year);
    
            $month  = $adjusted_date['month'];
            $year   = $adjusted_date['year'];
    
            // Determine the total days in the month
            $total_days = $this->get_total_days($month, $year);
    
            // Set the starting day of the week
            $start_days = array('sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6);
            $start_day = ( ! isset($start_days[$this->start_day])) ? 0 : $start_days[$this->start_day];
    
            // Set the starting day number
            $local_date = mktime(12, 0, 0, $month, 1, $year);
            $date = getdate($local_date);
            $day  = $start_day + 1 - $date["wday"];
    
            while ($day > 1)
            {
                $day -= 7;
            }
    
            // Set the current month/year/day
            // We use this to determine the "today" date
            $cur_year   = date("Y", $this->local_time);
            $cur_month  = date("m", $this->local_time);
            $cur_day    = date("j", $this->local_time);
    
            $is_current_month = ($cur_year == $year AND $cur_month == $month) ? TRUE : FALSE;
    
            // Generate the template data array
            $this->parse_template();
    
            // Begin building the calendar output
            $out = $this->temp['table_open'];
            $out .= "\n";
    
            $out .= "\n";
            $out .= $this->temp['heading_row_start'];
            $out .= "\n";
    
            // "previous" month link
            if ($this->show_next_prev == TRUE)
            {
                // Add a trailing slash to the  URL if needed
                $this->next_prev_url = preg_replace("/(.+?)\/*$/", "\\1/",  $this->next_prev_url);
    
                $adjusted_date = $this->adjust_date($month - 1, $year);
                $out .= str_replace('{previous_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->temp['heading_previous_cell']);
                $out .= "\n";
            }
    
            // Heading containing the month/year
            $colspan = ($this->show_next_prev == TRUE) ? 5 : 7;
    
            $this->temp['heading_title_cell'] = str_replace('{colspan}', $colspan, $this->temp['heading_title_cell']);
            $this->temp['heading_title_cell'] = str_replace('{heading}', $this->get_month_name($month)."&nbsp;".$year, $this->temp['heading_title_cell']);
    
            $out .= $this->temp['heading_title_cell'];
            $out .= "\n";
    
            // "next" month link
            if ($this->show_next_prev == TRUE)
            {
                $adjusted_date = $this->adjust_date($month + 1, $year);
                $out .= str_replace('{next_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->temp['heading_next_cell']);
            }
    
            $out .= "\n";
            $out .= $this->temp['heading_row_end'];
            $out .= "\n";
    
            // Write the cells containing the days of the week
            $out .= "\n";
            $out .= $this->temp['week_row_start'];
            $out .= "\n";
    
            $day_names = $this->get_day_names();
    
            for ($i = 0; $i < 5; $i ++)
            {
                $out .= str_replace('{week_day}', $day_names[($start_day + $i) %7], $this->temp['week_day_cell']);
            }
    
            $out .= "\n";
            $out .= $this->temp['week_row_end'];
            $out .= "\n";
    
            // Build the main body of the calendar
            while ($day <= $total_days)
            {
                $out .= "\n";
                $out .= $this->temp['cal_row_start'];
                $out .= "\n";
    
                for ($i = 0; $i < 7; $i++)
                {
                    if($i!=5 && $i!=6)
                    {
                        $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_start_today'] : $this->temp['cal_cell_start'];
    
                        if ($day > 0 AND $day <= $total_days)
                        {
                            if (isset($data[$day]))
                            {
                                // Cells with content
                                $temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_content_today'] : $this->temp['cal_cell_content'];
                                $out .= str_replace('{day}', $day, str_replace('{content}', $data[$day], $temp));
                            }
                            else
                            {
                                // Cells with no content
                                $temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_no_content_today'] : $this->temp['cal_cell_no_content'];
                                $out .= str_replace('{day}', $day, $temp);
                            }
                        }
                        else
                        {
                            // Blank cells
                            $out .= $this->temp['cal_cell_blank'];
                        }
    
                        $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; 
                    }
    
                    $day++;
                }
    
                $out .= "\n";
                $out .= $this->temp['cal_row_end'];
                $out .= "\n";
            }
    
            $out .= "\n";
            $out .= $this->temp['table_close'];
    
            return $out;
        }
    }
    
    
    /* End of file  MY_Calendar.php */
    

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had used jquery media plugin to display pdf file in html This is
Feeling I had not enough control over the chart if I had used a
In the pages so far, I have had used one connection class and one
I used to use a guitar tab site and it had a feature where
I had the impression that Class.forName(String className) used the Thread.currentThread().getContextClassLoader() to load the class
I had used JDialog box to display an Error message , JOptionPane.showMessageDialog( null, ErrorMsg,
I had used Jquery validate plugin to check out error and i had submitted
i had used this plugin before, but now when i want to use it
I had used Google MAP with android before but now I want to use
I had used several ways to do some simple integer arithmetic in BASH (3.2).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.