diff options
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/changelog.rst | 4 | ||||
-rw-r--r-- | user_guide_src/source/libraries/calendar.rst | 100 |
2 files changed, 54 insertions, 50 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5d5c5df26..9ec4d0d77 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -299,8 +299,8 @@ Release Date: Not Released - Added method chaining support. - Added configuration to generate days of other months instead of blank cells. - - Auto set *next_prev_url* if it is empty and *show_prev_next* is set to TRUE. - - The template now accepts an array in addition to the encoded string. + - Added auto-configuration for *next_prev_url* if it is empty and *show_prev_next* is set to TRUE. + - Added support for templating via an array in addition to the encoded string. - :doc:`Cart Library <libraries/cart>` changes include: diff --git a/user_guide_src/source/libraries/calendar.rst b/user_guide_src/source/libraries/calendar.rst index 792f1d504..b4f95db1b 100644 --- a/user_guide_src/source/libraries/calendar.rst +++ b/user_guide_src/source/libraries/calendar.rst @@ -60,11 +60,11 @@ parameter of the calendar generating function. Consider this example:: $this->load->library('calendar'); $data = array( - 3 => 'http://example.com/news/article/2006/03/', - 7 => 'http://example.com/news/article/2006/07/', - 13 => 'http://example.com/news/article/2006/13/', - 26 => 'http://example.com/news/article/2006/26/' - ); + 3 => 'http://example.com/news/article/2006/03/', + 7 => 'http://example.com/news/article/2006/07/', + 13 => 'http://example.com/news/article/2006/13/', + 26 => 'http://example.com/news/article/2006/26/' + ); echo $this->calendar->generate(2006, 6, $data); @@ -83,11 +83,11 @@ There are seven preferences you can set to control various aspects of the calendar. Preferences are set by passing an array of preferences in the second parameter of the loading function. Here is an example:: - $prefs = array ( - 'start_day' => 'saturday', - 'month_type' => 'long', - 'day_type' => 'short' - ); + $prefs = array( + 'start_day' => 'saturday', + 'month_type' => 'long', + 'day_type' => 'short' + ); $this->load->library('calendar', $prefs); @@ -123,10 +123,10 @@ To allow your calendar to dynamically increment/decrement via the next/previous links requires that you set up your calendar code similar to this example:: - $prefs = array ( - 'show_next_prev' => TRUE, - 'next_prev_url' => 'http://example.com/index.php/calendar/show/' - ); + $prefs = array( + 'show_next_prev' => TRUE, + 'next_prev_url' => 'http://example.com/index.php/calendar/show/' + ); $this->load->library('calendar', $prefs); @@ -147,63 +147,67 @@ Creating a Calendar Template ============================ By creating a calendar template you have 100% control over the design of -your calendar. Using the string method, each component of your calendar will be placed within a -pair of pseudo-variables as shown here:: +your calendar. Using the string method, each component of your calendar +will be placed within a pair of pseudo-variables as shown here:: $prefs['template'] = ' - {table_open}<table border="0" cellpadding="0" cellspacing="0">{/table_open} + {table_open}<table border="0" cellpadding="0" cellspacing="0">{/table_open} - {heading_row_start}<tr>{/heading_row_start} + {heading_row_start}<tr>{/heading_row_start} - {heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell} - {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell} - {heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell} + {heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell} + {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell} + {heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell} - {heading_row_end}</tr>{/heading_row_end} + {heading_row_end}</tr>{/heading_row_end} - {week_row_start}<tr>{/week_row_start} - {week_day_cell}<td>{week_day}</td>{/week_day_cell} - {week_row_end}</tr>{/week_row_end} + {week_row_start}<tr>{/week_row_start} + {week_day_cell}<td>{week_day}</td>{/week_day_cell} + {week_row_end}</tr>{/week_row_end} - {cal_row_start}<tr>{/cal_row_start} - {cal_cell_start}<td>{/cal_cell_start} - {cal_cell_start_today}<td>{/cal_cell_start_today} - {cal_cell_start_other}<td class="other-month">{/cal_cell_start_other} + {cal_row_start}<tr>{/cal_row_start} + {cal_cell_start}<td>{/cal_cell_start} + {cal_cell_start_today}<td>{/cal_cell_start_today} + {cal_cell_start_other}<td class="other-month">{/cal_cell_start_other} - {cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content} - {cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today} + {cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content} + {cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today} - {cal_cell_no_content}{day}{/cal_cell_no_content} - {cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today} + {cal_cell_no_content}{day}{/cal_cell_no_content} + {cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today} - {cal_cell_blank} {/cal_cell_blank} + {cal_cell_blank} {/cal_cell_blank} - {cal_cell_other}{day}{cal_cel_other} + {cal_cell_other}{day}{cal_cel_other} - {cal_cell_end}</td>{/cal_cell_end} - {cal_cell_end_today}</td>{/cal_cell_end_today} - {cal_cell_end_other}</td>{/cal_cell_end_other} - {cal_row_end}</tr>{/cal_row_end} + {cal_cell_end}</td>{/cal_cell_end} + {cal_cell_end_today}</td>{/cal_cell_end_today} + {cal_cell_end_other}</td>{/cal_cell_end_other} + {cal_row_end}</tr>{/cal_row_end} - {table_close}</table>{/table_close} + {table_close}</table>{/table_close} '; $this->load->library('calendar', $prefs); echo $this->calendar->generate(); -Using the array method, you will pass `key => value` pairs. You can pass as many or as few values as you'd like. Omitted keys will use the default values inherit in the calendar class. +Using the array method, you will pass `key => value` pairs. You can pass as +many or as few values as you'd like. Omitted keys will use the default values +inherited in the calendar class. - $prefs['template'] = array( - 'table_open' => '<table class="calendar">', - 'cal_cell_start' => '<td class="day">', - 'cal_cell_start_today' => '<td class="today">', - ); +Example:: + + $prefs['template'] = array( + 'table_open' => '<table class="calendar">', + 'cal_cell_start' => '<td class="day">', + 'cal_cell_start_today' => '<td class="today">' + ); - $this->load->library('calendar', $prefs); + $this->load->library('calendar', $prefs); - echo $this->calendar->generate(); + echo $this->calendar->generate(); *************** Class Reference |