diff options
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 | ||||
-rw-r--r-- | user_guide_src/source/libraries/calendar.rst | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index bda4cbab4..9907e9722 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -300,6 +300,7 @@ 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. - :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 2263aa404..792f1d504 100644 --- a/user_guide_src/source/libraries/calendar.rst +++ b/user_guide_src/source/libraries/calendar.rst @@ -100,7 +100,7 @@ preferences below. ====================== ================= ============================================ =================================================================== Preference Default Options Description ====================== ================= ============================================ =================================================================== -**template** None None A string containing your calendar template. +**template** None None A string or array containing your calendar template. See the template section below. **local_time** time() None A Unix timestamp corresponding to the current time. **start_day** sunday Any week day (sunday, monday, tuesday, etc.) Sets the day of the week the calendar should start on. @@ -147,7 +147,7 @@ Creating a Calendar Template ============================ By creating a calendar template you have 100% control over the design of -your calendar. Each component of your calendar will be placed within a +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'] = ' @@ -193,6 +193,18 @@ pair of pseudo-variables as shown here:: 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. + + $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); + + echo $this->calendar->generate(); + *************** Class Reference *************** |