| 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.
|
|
|
|
07-11-2007, 12:05 PM
|
#14
|
|
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
|
#15
|
|
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
|
#16
|
|
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
|
#17
|
|
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
|
#18
|
|
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?
|
|
|
|
09-13-2008, 09:14 AM
|
#19
|
|
Calendar User
Tal is offline
Join Date: Sep 2008
Posts: 23
|
Just wanted to say thanks for the instructions on this thread - with the first few posts I successfully got my calendar in my sidebar - nice.
the calendar software is the best I've found so far for wordpress to replace jevents I was using in joomla before I ditched joomla - there's still a lot of features I'd like to see added - like a search function and the ability to pull up a calendar with events from just one category and stuff like that - but at least I'm on my way now.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Hybrid 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.
|