Here is a basic run down of how to include the ExtCalendar2 in phpwcms.
File that need to be modified:
calendar.php
cal_search.php
register.php
Files that you may optional modify:
admin_categories.php
admin_events.php
admin_groups.php
admin_settings.php
admin_settings_template.php
admin_settings_updates.php
admin_users.php
login.php
profile.php
Soft Links to phpwcms directories inside the calendar directory:
img
phpwcms_template
Note: I needed those soft links because of files that are called relatively in my design. You may not need these.
In each of the calendar .php files right after the beginning
include or
require directives add the following code:
Code: Select all
// BEGIN phpWCMS template integration
ob_start();
// END phpWCMS template integration
This starts buffering the calendar output. The ExtCalendar2 has it's own header, calendar, and footer output functions. Also I made sure to set ExtCalendar2 to use a custom template that only contained the calendar itself without an HTML header and footer.
In any of the .php files after
add the following code:
Code: Select all
// BEGIN phpWCMS template integration
$cmstmpl['calendar'] = ob_get_contents();
ob_end_clean();
$cmstmpl['all'] = @file_get_contents('http://www.lbym.org/calview.phtml');
$cmstmpl['all'] = preg_replace("/href\ *\=\ *\"/","href=\"/", $cmstmpl['all']);
$cmstmpl['all'] = str_replace('href="//', 'href="/', $cmstmpl['all']);
$cmstmpl['all'] = preg_replace("/href\ *\=\ *\'/","href='/", $cmstmpl['all']);
$cmstmpl['all'] = str_replace("href='//", "href='/", $cmstmpl['all']);
$cmstmpl['all'] = str_replace('href="/javascript:', 'href="javascript:', $cmstmpl['all']);
$cmstmpl['all'] = str_replace('href="/http:', 'href="http:', $cmstmpl['all']);
$cmstmpl['all'] = str_replace('<!-- EXTCAL_CSS -->', '<link rel="stylesheet" type="text/css" href="/phpwcms_template/inc_css/calendar.css">', $cmstmpl['all']);
$cmstmpl['all'] = str_replace('{EXTCAL}', $cmstmpl['calendar'], $cmstmpl['all']);
echo $cmstmpl['all'];
// END phpWCMS template integration
This ends the buffering and does the replacement tag stuff. A couple of items that are coded into phpwcms are the following tags:
This is a replacement tag for the calendars css style sheet which I put in the template head section. I decided I only wanted it included when viewing the calendar and not have all that style sheet code loaded for any other pages when it's not needed there.
That replacement tag goes in the phpwcmw dummy template page. See and example here:
http://www.lbym.org/calview.phtml
What happens is I have my Calendar category redirect to the /calendar/ directory. Also underneath the Calendar category I have a Calendar View category with an alias of calview, this makes available the calview.phtml page that ExtCalendar make use of as it's template.
This feels like a really complex way of integrating the ExtCalendar but it is rather simple once you have it working. Hope this is helpful.