| Wordpress Information about integrating the calendar with the Wordpress Content Management System. |
 |
Integrating EPC into a Wordpress sidebar |
 |
07-17-2006, 02:29 AM
|
#1
|
|
Calendar User
Mad Dog is offline
Join Date: Jan 2006
Posts: 44
|
Integrating EPC into a Wordpress sidebar
I recently incorporated EPC into the sidebar of a WordPress template and had to muck my way through a few things before it worked right. It turns out it’s actually pretty simple once you know the steps. To help anyone else who’s looking to do this, here are the basic steps and pointers to ease the way:
1. Make sure you create the EPC database table in the same MySQL database WordPress uses. When you set up EPC, point it to the database and it will take care of the dirty work.
2. Most WordPress templates split pages into several files: header.php, sidebar.php, etc. Follow the directions in the INTEGRATION section of EPC help. Typically you’ll:
- Add the CSS call to the HEADER.PHP file just before the </HEAD> tag:
<?php $CSS=1; require("calendar/calendar.php"); ?>
- For the mouseover option, add the code in SIDEBAR.PHP, right below the <body> tag:
<?php $OL=1; require("calendar/calendar.php"); ?>
- You may have to play with the path to find works with your server and site structure. Make sure it’s a relative path. I ended up having to use: “../calendar/calendar.php”
3. In Wordpress, make sure the PERMALINKS (OPTIONS > PERMALINKS) are set for the default (“http://yoursite.com/wordpress/?p=123”) so your calendar’s month-to-month navigation works with your archive pages. If you don’t, things will get very confused.
That should pretty much do it. Of course you may need to edit the CSS to make the calendar smaller if you have a narrow sidebar.
Good luck!
Mad Dog
|
|
|
|
 |
07-17-2006, 09:00 AM
|
#2
|
|
EPC Developer
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,887
|
(Made into a sticky!)
|
|
|
|
 |
|
 |
09-28-2006, 12:08 AM
|
#3
|
|
Calendar User
gumbomasta is offline
Join Date: Sep 2006
Posts: 7
|
I am having trouble integrating my easy php calendar into my wordpress blog.
Thing I've done already:
I've successfully added my EPC to the wordpress blog's database on my server.
I host my my own WordPress site.
I've placed the <?php $CSS=1; require("calendar/calendar.php"); ?> tag in the header.php file.
Here are things I currently cannot do.
1) I cannot place the sidebar mouse-over code in the <body> portion of the sidebar.php of my theme because there is no <body> tag in the sidebar.php. I'm not sure if this is because I"m using dynamic sidebars, but the three sidebar.php files I've looked (my current theme, the Classic theme and the default theme simply do not have <body> tags in their sidebar.php files.
2) in addition, adding the php code you mentioned in the "Text 1" area of the sidebar (via the sidebar widget) results in nothing being displayed.
3) I've found that trying to post php code in my actual posts results in the code being ignored. I've tried using plugins like exec php, but to no avail.
Is there some kind of security built within wordpress that prevents php scripts from being executed?
I'm in the dark here. I've exhausted all my options. I want to get a dynamic blog working with a built in calendar. Is this too much to ask?
thanks for your input.
-cosmo d
|
|
|
|
 |
 |
|
 |
09-28-2006, 12:40 AM
|
#4
|
|
Calendar User
Mad Dog is offline
Join Date: Jan 2006
Posts: 44
|
Quote:
|
Originally Posted by gumbomasta
I am having trouble integrating my easy php calendar into my wordpress blog.
Thing I've done already:
I've successfully added my EPC to the wordpress blog's database on my server.
I host my my own WordPress site.
I've placed the <?php $CSS=1; require("calendar/calendar.php"); ?> tag in the header.php file.
Here are things I currently cannot do.
1) I cannot place the sidebar mouse-over code in the <body> portion of the sidebar.php of my theme because there is no <body> tag in the sidebar.php. I'm not sure if this is because I"m using dynamic sidebars, but the three sidebar.php files I've looked (my current theme, the Classic theme and the default theme simply do not have <body> tags in their sidebar.php files.
2) in addition, adding the php code you mentioned in the "Text 1" area of the sidebar (via the sidebar widget) results in nothing being displayed.
I wouldn't recommend adding PHP code using any widgets. Add it manually into the sidebar.php file.
3) I've found that trying to post php code in my actual posts results in the code being ignored. I've tried using plugins like exec php, but to no avail.
why are you trying to add PHO in your posts? Is this related to using EPC? (I have Exec PHP installed and it works fine for me)
Is there some kind of security built within wordpress that prevents php scripts from being executed?
Wordpress runs completely on PHP. Because of how it's parsed, without using a plug-in like ExecPHP it won't parse posts.
I'm in the dark here. I've exhausted all my options. I want to get a dynamic blog working with a built in calendar. Is this too much to ask?
thanks for your input.
-cosmo d
|
TRY THIS:
1. In the file header.php, find the <body> tag and place this code JUST UNDERNEATH IT:
<?php $OL=1; require("calendar/calendar.php"); ?>
2. In the file sidebar.php, right under the line <div id="sidebar"> (or whatever that div is called in your template) add this code:
<div id="easyCalender">
<!-- ADD CITYDISH.PHP CALENDAR -->
<?php require("calendar/calendar.php"); ?>
<!-- END CALENDAR -->
</div>
This of course will add the calendar to the top of the sidebar. It should work. You can move it elsewhere. And depending on your template, you might have to alter the EPC CSS to adjust the size of the calendar.
Let me know if that works.
Mad Dog
|
|
|
|
 |
09-28-2006, 12:57 AM
|
#5
|
|
Calendar User
gumbomasta is offline
Join Date: Sep 2006
Posts: 7
|
It worked. Thank you for posting the quick and useful reply. They key for me was putting the
<div id="easyCalender">
<!-- ADD CITYDISH.PHP CALENDAR -->
<?php require("calendar/calendar.php"); ?>
<!-- END CALENDAR -->
</div>
command in the sidebar.php file. What, exactly, does that command do?
I tell ya, I'm fairly new to PHP, but putting together my home website as given me a lot to chew on. Thank you for this very useful guide.
|
|
|
|
 |
|
 |
09-28-2006, 01:06 AM
|
#6
|
|
Calendar User
Mad Dog is offline
Join Date: Jan 2006
Posts: 44
|
Quote:
|
Originally Posted by gumbomasta
It worked. Thank you for posting the quick and useful reply. They key for me was putting the
<div id="easyCalender">
<!-- ADD CITYDISH.PHP CALENDAR -->
<?php require("calendar/calendar.php"); ?>
<!-- END CALENDAR -->
</div>
command in the sidebar.php file. What, exactly, does that command do?
I tell ya, I'm fairly new to PHP, but putting together my home website as given me a lot to chew on. Thank you for this very useful guide.
|
Sorry if I left out what I thought was the obvious in my posting: That's the code that inserts the actual calendar! It actually creates a <div> for it (in case you want to use custom CSS), then the lines before and after it are simply comments to make it easy for you to remember what that's all about when you have to go back to it in a few months.
The other pieces of code you added link to the CSS file and set it up so the mouseover works, what I thought were the tricky parts.
Learning to mess with Wordpress templates will teach you a lot....and frustrate you a lot. But it is a great learning experience. Glad I could help.
MD
|
|
|
|
 |
 |
|
 |
02-28-2007, 05:36 PM
|
#7
|
|
Calendar User
watershedstudio is offline
Join Date: Feb 2007
Posts: 1
|
Quote:
Originally Posted by Mad Dog
3. In Wordpress, make sure the PERMALINKS (OPTIONS > PERMALINKS) are set for the default (“http://yoursite.com/wordpress/?p=123”) so your calendar’s month-to-month navigation works with your archive pages. If you don’t, things will get very confused.
|
The issue appears to be that it always pulls in the php file (in the case of WP, that is index.php).
To make this not be an issue open calendar/calendar.php and look for:
Code:
// DETERMINE NAME OF CURRENT FILE
if (!isset($thisFile) || (isset($_GET['thisFile']) || isset($_POST['thisFile']))) {
$thisFile = $_SERVER['SCRIPT_NAME'];
$thisFile = explode("/",trim($thisFile));
$thisFile = $thisFile[count($thisFile)-1];
if (!file_exists($thisFile)) $thisFile = htmlentities($_SERVER['PHP_SELF']);
}
And replace it with:
Code:
// DETERMINE NAME OF CURRENT FILE
if (!isset($thisFile) || (isset($_GET['thisFile']) || isset($_POST['thisFile']))) {
$thisFile = "";
}
This should remove the "index.php" that it places in the links and any WordPress page should function correctly.
From what I've seen I don't think this will cause issues with the other displays, but if it does you could always create two versions of the file and call the one that you need for a particular display.
|
|
|
|
 |
02-28-2007, 05:49 PM
|
#8
|
|
Calendar User
Mad Dog is offline
Join Date: Jan 2006
Posts: 44
|
Quote:
Originally Posted by watershedstudio
From what I've seen I don't think this will cause issues with the other displays, but if it does you could always create two versions of the file and call the one that you need for a particular display.
|
I'll be interested to find out if other people try it to see if it works. For me, the default permalinks set-up works fine so I'm not inclined to mess with this unless I have to.
MD
|
|
|
|
06-06-2007, 05:50 PM
|
#9
|
|
Calendar User
lesliekirk is offline
Join Date: Jun 2007
Posts: 6
|
I'll let you know - because the permalink solution doesn't work for me either. I was able to get the calendar inserted but the links are wrong.
http://www.ignatiusproductions.org/ it's not looking for the calendar.php within the calendar directory.
Leslie
|
|
|
|
06-07-2007, 10:36 AM
|
#10
|
|
Calendar User
lesliekirk is offline
Join Date: Jun 2007
Posts: 6
|
Quote:
Originally Posted by watershedstudio
And replace it with:
Code:
// DETERMINE NAME OF CURRENT FILE
if (!isset($thisFile) || (isset($_GET['thisFile']) || isset($_POST['thisFile']))) {
$thisFile = "";
}
|
I tried using this code - now it produces links like Any other suggestions?
Thanks,
Leslie
|
|
|
|
06-07-2007, 11:08 AM
|
#11
|
|
Calendar User
lesliekirk is offline
Join Date: Jun 2007
Posts: 6
|
Also is I include this:
Quote:
- Add the CSS call to the HEADER.PHP file just before the </HEAD> tag:
<?php $CSS=1; require("calendar/calendar.php"); ?>
|
I wind up with 2 calendars. One at the very top of the page and one where I placed it.
Also none of the dates that have events are linked - in addition to the next month links being wrong.
Thanks again,
Leslie
|
|
|
|
06-07-2007, 12:47 PM
|
#12
|
|
Calendar User
Mad Dog is offline
Join Date: Jan 2006
Posts: 44
|
Quote:
Originally Posted by lesliekirk
Also is I include this:
I wind up with 2 calendars. One at the very top of the page and one where I placed it.
Also none of the dates that have events are linked - in addition to the next month links being wrong.
Thanks again,
Leslie
|
Looking at the URL you posted I see one calendar and the pop-ups work. Have you figured it all out or is something still a problem?
|
|
|
|
06-07-2007, 12:54 PM
|
#13
|
|
Calendar User
lesliekirk is offline
Join Date: Jun 2007
Posts: 6
|
I'm still "playing" with it. The links at the bottom still are wrong. I'm wondering is there some way to maybe iframe it? Even if I get the correct links, I have no idea how it's going to work - I think it will not "reload" into the WP index page.
I'm having to copy and paste the javascript into the sidebar and add the CSS into the WP css file to even get what I have there. None of the tips I have found posted here have worked for me.
|
|
|
|
06-07-2007, 03:35 PM
|
#14
|
|
Support Team
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
|
I'm not sure why you're having so much trouble... I am willing to give it a try if you will give me access to your Wordpress. (Contact me via the link in my sig)
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
|
|
|
|
06-07-2007, 05:14 PM
|
#15
|
|
Calendar User
Mad Dog is offline
Join Date: Jan 2006
Posts: 44
|
I'm checking it out and things seem to work as they're supposed to as far as I can see. The "next month" and "previous month" links work. The links underneath the calendar work. The calendar pop-ups work. So I'm not sure where the problem is at this point.
|
|
|
|
06-07-2007, 05:20 PM
|
#16
|
|
Calendar User
lesliekirk is offline
Join Date: Jun 2007
Posts: 6
|
Yup, yup! Many, many many thanks go to Gervais. Couple things I had tried were not quite right and then I left out a tag. But I know better now!
Leslie
|
|
|
|
07-11-2007, 12:05 PM
|
#17
|
|
Calendar User
jazbek is offline
Join Date: Jun 2007
Posts: 4
|
has anyone got the calendar working in AJAX mode with wordpress? i'm about to try it, but i'm wondering if anyone has any tips before i jump in.
cheers.
|
|
|
|
07-11-2007, 05:49 PM
|
#18
|
|
Support Team
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
|
I haven't heard of anyone trying it out. But I don't see why there would be an issue.
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
|
|
|
|
 |
|
 |
10-25-2007, 12:39 PM
|
#19
|
|
Calendar User
redcrew is offline
Join Date: Oct 2007
Posts: 33
|
Glad I found this thread - I've made the changes to the calendar.php file as suggested by watershedstudio.
The calendar displays, but when I change months the entire page the calendar is included on is re-loaded.
What I'd like is to just have the calendar re-written, not the entire page.
I found a reference to an iframe code, but I'm not sure how to incorporate the settings that are currently calling the monthly calendar to display.
Here's what I currently have to display the calendar:
<div id="easyCalender">
<!-- ADD EASY PHP CALENDAR -->
<?php
$TOC=1;
require("phpcalendar/calendar/calendar.php");
?>
<!-- END CALENDAR -->
</div>
and here is code for displaying the calendar in an iframe (found from another thread)
<iframe src="calendar_list_mode.php?mo=<?php echo $mo ?>&yr=<?php echo $yr ?>" height="400" width="465"></iframe>
How do I incorporate my code into the src value for the iframe code?
Hopefully I explained that so other people can understand...
|
|
|
|
 |
10-26-2007, 11:16 AM
|
#20
|
|
Calendar User
redcrew is offline
Join Date: Oct 2007
Posts: 33
|
Is there a list of command line variables, other than the few listed in the docs? I've searched this site, and all the files for the installation, but can't find any reference to the "calendar_list_mode" variable set in the iframe code above.
Did I miss the list somewhere?
|
|
|
|
10-26-2007, 08:06 PM
|
#21
|
|
EPC Developer
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,887
|
calendar_list_mode is not a command of the calendar. Must be something to do with WP?
|
|
|
|
10-27-2007, 01:03 PM
|
#22
|
|
Calendar User
redcrew is offline
Join Date: Oct 2007
Posts: 33
|
Thanks for the reply. Guess I'll reword the question.
How can I include the easy php calendar into a page using an iframe? What would be used for the "src" attribute in an iframe?
|
|
|
|
10-27-2007, 08:26 PM
|
#23
|
|
Support Team
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
|
Some other page that has the calendar displayed on it.... Like /calendar/demo.php for example.
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
|
|
|
|
10-27-2007, 09:16 PM
|
#24
|
|
Calendar User
redcrew is offline
Join Date: Oct 2007
Posts: 33
|
Guess I'm not explaining the issue very well.
On the page named "calendar", I want to include the simple php calendar in an iframe or object. The page named "calendar" is the page the currently contains the calendar code on the page, along with the header, footer, etc. for that page.
I don't want to include the page named "calendar" into another page - if I did, the other page would include the footer, header, etc. for that page.
What I'm looking for is the code reference to use just for the calendar created by simple php calendar. I want to reference it in the "src" for an iframe code segment.
Jazbek references the iframe code in this reply, but I haven't found her code posted on the forums.
|
|
|
|
10-28-2007, 06:20 PM
|
#25
|
|
Support Team
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
|
No, you're not getting it...
You cannot directly reference the calendar in the src of the iframe. You'll have to create your own blank page that includes the calendar (or use one of the demos that are included) and use that for your source.
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
|
|
|
|
02-15-2008, 03:55 PM
|
#26
|
|
Calendar User
Tore is offline
Join Date: Feb 2008
Posts: 21
|
Bump.
Would be good to have a way to get the nice permalinks in WordPress work with the calendar. The provided solution may have worked with past versions. But not with the latest WP and Calendar.
|
|
|
|
02-15-2008, 06:34 PM
|
#27
|
|
Support Team
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
|
It does work... as long as you keep the Permalinks set to the "Default" type.
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
|
|
|
|
02-16-2008, 11:46 AM
|
#28
|
|
Calendar User
Tore is offline
Join Date: Feb 2008
Posts: 21
|
What I mean is to use options like Date and Time based links. I'm sure most WP calendar users had WordPress before they got the
calendar and they already have permalinks set up to look "nicer" than the default option. Now they all have to give people new links to subpages.
If permalinks only works with one out of many many options, then they don't work well enough.
|
|
|
|
02-16-2008, 01:43 PM
|
#29
|
|
Support Team
ve9gra is offline
Join Date: Jun 2003
Location: New Brunswick, Canada
Posts: 4,965
|
You have to understand that Easy PHP Calendar was developed as a stand-alone application. Integrating it within other applications has a varying level of success, but it was never modified to cater to a specific application. It was never meant as a WP plugin, and should never be considered as such. The fact that it plays nice with one of the WP Permalinks type should be appreciated.
__________________
-- Gervais
EPC Tutorials... We're here to help!
Offering custom integration services. Contact me here.
* Not affiliated with EasyPHPCalendar or NashTech Inc.
|
|
|
|
02-17-2008, 10:49 AM
|
#30
|
|
Calendar User
Tore is offline
Join Date: Feb 2008
Posts: 21
|
I do appreciate it. That however no reason why one shouldn't wish to know it if somebody should come up with ways to integrate it even better.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:55 PM.
|