PDA

View Full Version : Integrating into a Page?


SusanN
09-25-2007, 09:53 PM
Is it possible to integrate this calendar into a Page in Wordpress? If so, how would it be done? I tried creating a Page template and placing the required code inside, but it didn't work for me. Help?

Brian
09-26-2007, 12:10 AM
Did you try search the forums for "wordpress"? There's a lot of information where people have posted steps to make this work.

Example:

http://www.easyphpcalendar.com/forums/showthread.php?t=5443&highlight=wordpress

SusanN
09-26-2007, 07:31 AM
Yes, I searched the forums before posting my question. Everything I found was about placing the calendar in the sidebar. I actually need it to go on a Page. If you're not familiar, a Page (capital P) in Wordpress is different from just any old page (lower case p). I installed runPHP (a plugin that allows you to use PHP right in the Page), but it still didn't work for me. I'm stumped.

SusanN
09-26-2007, 02:03 PM
Just wanted to update and say I got it working. I embedded the code for the calendar into a page template.

SusanN
09-26-2007, 03:55 PM
An update: it's displaying now, but if I try to move to a different month or something like that, it doesn't work. To see what I mean:

hid denpoi nteon th ela ke.org/planner

When I had it in the sidebar, everything worked perfectly. So, I'm assuming it's not a problem with my server. I am stumped.

And while I'm here, how can I increase the space in which the month and year is written in the dropdown at the top?

Thanks for any help!

SusanN
09-26-2007, 08:45 PM
Sorry, me again. I've yet another strange thing happening that I thought I'd bring up in case someone else has had the same thing happen. I want to name this Page the calendar is on something like Calendar, Schedule of Events, Event Planner, Monthly Planner, etc. If I have the word calendar, events, or monthly in there, it doesn't work. I've only gotten Planner to work so far and that's just not a good enough name, imo. Help?

ve9gra
09-26-2007, 09:41 PM
You are having problems navigating because of how Wordpress works. Try adding $thisPage="/planner"; to the page your created.

About your problem with naming your page, that is totally out of our realm and should be dealt with on Wordpress' forums.

SusanN
09-26-2007, 10:09 PM
Thanks for your help. I don't know yet how I will add that code to the page since the pages are generated by Wordpress, but I'll ask over at the Wordpress forums.

ve9gra
09-27-2007, 08:54 AM
Add it to the same spot where you added the code to make the calendar appear....

That last require("calendar/calendar.php"); line.... put the $thisPage just before that but inside of the <?php tag.

SusanN
09-27-2007, 09:03 AM
It still isn't working (the navigation). This is what I have:

<div id="easyCalender">
<!-- ADD EASY PHP CALENDAR -->
<?php
$thisPage="/planner";
$TOC=1;
require ("calendar/calendar.php");
?>
<!-- END CALENDAR -->
</div>


Did I do it wrong?

ve9gra
09-28-2007, 10:30 AM
Sorry.... brain fart..... $thisFile.... not $thisPage.

SusanN
09-28-2007, 03:46 PM
That did it! I can't thank you enough!! :clap:

jazbek
10-12-2007, 07:15 AM
For what it's worth, the easiest way that I found to integrate Easy PHP Calendar into a page was to use an iframe. That way the URLs of the calendar don't conflict with the URLs in wordpress when you switch between months, for example. I can post some code here if anyone is interested.

redcrew
10-22-2007, 02:47 PM
I'm also trying to setup EasyPHPCalendar on a WordPress Page. I'm interested in knowing how Susan resolved all her issues.

Jazbek, I accept your offer to post the code for integrating Easy PHP Calendar into the page with an iframe. Can you post?

Also, is there an example online, either Susan's or Jazbek's that shows the calendar integrated into a WordPress Page?

SusanN
10-22-2007, 05:00 PM
I received your email, redcrew, and just replied. I thought I'd also come here and state two things that might help others in the future.

1. For some reason, there was a conflict with other Wordpress elements (not sure which) that made naming the page Calendar impossible for me. If someone else is successful in doing so, I'd love to know. But I finally got it to work by naming it Community Calendar.

2. The KEY to making this work within a Wordpress Page is this line:

$thisFile="/community-calendar"; (where community-calendar is your actual page name)

The whole of it is:

<div id="easyCalender">
<!-- ADD EASY PHP CALENDAR -->
<?php
$thisFile="/community-calendar";
$TOC=1;
require ("calendar/calendar.php");
?>
<!-- END CALENDAR -->
</div>And then don't forget to add this to header.php:

<?php $CSS=1; require("calendar/calendar.php"); ?> Hope this helps! I do have it working online, but it's password-protected and I can't post access online. Sorry!

Editing to add: I forgot to say you have to include this line right before <body>:

<?php $OL=1; require("calendar/calendar.php"); ?>

redcrew
10-25-2007, 08:29 AM
After spending numerous hours trying to get easy php calendar working correctly in WordPress, I finally uninstalled the code.

I was trying to accomplish what Susan did on her site. I believe the issue with the naming fix proposed, is that the Page (in WordPress) is named "Calendar" and the installed code for easy php calendar is in a folder named "calendar".

Correct me I'm wrong, but I believe if pretty urls are set up in WordPress, the location of the folder for the easy php calendar files overrides the setting for pretty urls, and the fix of $thisPage="/planner"; is required.

SusanN
10-25-2007, 09:59 AM
Correct me I'm wrong, but I believe if pretty urls are set up in WordPress, the location of the folder for the easy php calendar files overrides the setting for pretty urls, and the fix of $thisPage="/planner"; is required.

Actually, it's $thisFile="/planner"; . When it was $thisPage, the calendar navigation did not work. Using $thisFile solved everything for me.

And the page my calendar is on looks something like this: www.mysite.com/community-calendar. I'm using Wordpress Pages as a mini-CMS.

redcrew
10-25-2007, 10:11 AM
Hi Susan,

My apologies, I did type the variable incorrectly. Thanks for the catch.

redcrew
10-26-2007, 08:14 AM
Hi Susan,

Thanks again for the help in getting the calendar setup, and explaining the steps about the template and code includes.

Based on your information and searching the forums, I used the following steps to include the calendar on a WordPress Page named "Calendar", keep the name "Calendar" in the navigation, and allow month-to-month navigation to work on the Page.

Create a Page named "Calendar" in WordPress
Create a page template named "schedule" in WordPress
Assign the Page named "Calendar" to use the "schedule" page template in WordPress
Install easy php calendar into a folder at the same level as wp-admin. Do not name the directory "calendar". Name the folder something like "thecalendar".
Once the calendar is installed, update the options in the easy php calendar Setup Manager with your config settings for using a database, etc.
Don't secure the calendar.php file yet.
In the "thecalendar" folder, open the calendar.php file that is located in the "calendar" folder. Use a text editor to open the file.
Look for the following lines in the 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']);

}
Replace those lines with the following:
// DETERMINE NAME OF CURRENT FILE
if (!isset($thisFile) || (isset($_GET['thisFile']) || isset($_POST['thisFile']))) {
$thisFile = "";
}
Secure the calendar.php file (change permissions)
In the WordPress "schedule" template you created in step 2 above, add the following lines to the area on the page you want to include the calendar (this is the text on calendar mode):
<div id="easyCalender">
<!-- ADD EASY PHP CALENDAR -->
<?php
$TOC=1;
require("thecalendar/calendar/calendar.php");
?>
<!-- END CALENDAR -->
</div>
Note: the reference to "thecalendar" in the require tag may be different, depending on what you named your installation folder in step 4.
In the header.php file of WordPress, include the following line in the <head> of the code:

<?php $CSS=1; require("thecalendar/calendar/calendar.php"); ?>
Note: the reference to "thecalendar" in the require tag may be different, depending on what you named your installation folder in step 4.
In the header.php file of WordPress, include the following line immediately after the opening <body> tag:
<?php $OL=1; require("thecalendar/calendar/calendar.php"); ?>
Test out your calendarHope this helps.

SusanN
10-26-2007, 08:57 AM
Wow, thanks for posting such clear instructions! This post should be stickied for future reference. :clap:

redcrew
10-26-2007, 09:10 AM
Susan,

The congrats should go to you for all your support and email messages to me about the calendar. :clap:

Again, thanks!

Regards,

Deborah

msweeney
11-01-2007, 11:56 PM
OK, I have officially run out of ideas.

I followed redcrew's instructions and was able to get the TOC calendar to work fine. I then switched it over to Blog mode and that works fine. When I try to include the plug ins Filter and Legend though, I get nothing. The page parses out up until that point and then stops.

To call the two plug ins I'm using the following code in the Page Template that I created. These commands worked fine in demo.php, so I'm fairly confident that I didn't screw that up.

<?php
$epcMultiCatShow=1;
require("calendar/plugins/legend.php");
?>


<?php require("calendar/plugins/filter.php"); ?>

(I've changed my actual folder names back to 'calendar' for clarity's sake)

Does anyone have any ideas on how I could get the plug ins to work? Any help is appreciated. Thanks.

Brian
11-02-2007, 01:01 AM
<?php
$epcMultiCatShow=1;
require("calendar/plugins/legend.php");
?>

There's a lot of code missing to make this work. Please see the plugins documentation for the muti-calendar and add the other required lines of code.

ve9gra
11-02-2007, 07:07 AM
Brian, need some sleep? :) $epcMultiCatShow... not $MULTI ;)

Are you sure you have the correct relative path for where you've installed the calendar?

Just to figure if it's that it can't find the plugin, change the require for an include, so

include("calendar/plugins/filter.php");

msweeney
11-02-2007, 11:19 AM
Changing the require to an include had the same result. The page is created up until the point of the include and then nothing after that.

Brian
11-02-2007, 11:47 AM
Can you attach the source code of your page?

msweeney
11-02-2007, 12:01 PM
The page template is attached in its raw form. 'shows' is the name of the folder where the application resides. By commenting out the two requires that call the plugins the page loads with out any problems.

Sorry if this looks a bit ugly. I'm a SQL developer not a web guy.

ve9gra
11-02-2007, 06:49 PM
Your code is correct.

What's happening is that the templating engine is not giving access to the variables required to make the plugins work.

The way they are coded is that if it can't find the $epcCategories, it just exits (but doesn't exit only the plugin - it quits the whole page).

Let's try something.. right before $epcMultiCatShow=1; add this

require("shows/config.inc.php");

msweeney
11-02-2007, 08:59 PM
Looks like that did it.

The legend is popping up and the filter appears to work. I can also move back and forth between months.

Thanks a lot for your help!

FrozenBlues
11-30-2007, 12:46 PM
Hi Susan,

Thanks again for the help in getting the calendar setup, and explaining the steps about the template and code includes.

Based on your information and searching the forums, I used the following steps to include the calendar on a WordPress Page named "Calendar", keep the name "Calendar" in the navigation, and allow month-to-month navigation to work on the Page.

Create a Page named "Calendar" in WordPress
Create a page template named "schedule" in WordPress
Assign the Page named "Calendar" to use the "schedule" page template in WordPress
Install easy php calendar into a folder at the same level as wp-admin. Do not name the directory "calendar". Name the folder something like "thecalendar".
Once the calendar is installed, update the options in the easy php calendar Setup Manager with your config settings for using a database, etc.
Don't secure the calendar.php file yet.
In the "thecalendar" folder, open the calendar.php file that is located in the "calendar" folder. Use a text editor to open the file.
Look for the following lines in the 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']);

}
Replace those lines with the following:
// DETERMINE NAME OF CURRENT FILE
if (!isset($thisFile) || (isset($_GET['thisFile']) || isset($_POST['thisFile']))) {
$thisFile = "";
}
Secure the calendar.php file (change permissions)
In the WordPress "schedule" template you created in step 2 above, add the following lines to the area on the page you want to include the calendar (this is the text on calendar mode):
Note: the reference to "thecalendar" in the require tag may be different, depending on what you named your installation folder in step 4.
In the header.php file of WordPress, include the following line in the <head> of the code:

<?php $CSS=1; require("thecalendar/calendar/calendar.php"); ?>
Note: the reference to "thecalendar" in the require tag may be different, depending on what you named your installation folder in step 4.
In the header.php file of WordPress, include the following line immediately after the opening <body> tag:
<?php $OL=1; require("thecalendar/calendar/calendar.php"); ?>
Test out your calendarHope this helps.
redcrew -- Kudos for posting your instructions! I had to play around trying to figuring out the correct path to put in the require() statement for my server though, and have a suggested tweak: If easyphpcalendar is installed a folder named for instance "thecalendar" within the folder holding WordPress, then the following statement works more flexibly and reliably...
require(ABSPATH."thecalendar/calendar.php");
that statement is machine-independent and won't break if you move WordPress (and your thecalendar folder along with it) to another folder, subdomain, etc. because WordPress stores the ABSPATH constant for you.

redcrew
11-30-2007, 01:06 PM
FrozenBlues,

Glad the tutorial helped you out! And thanks for the update to the instructions.

mreasyphp
02-10-2008, 09:00 PM
Hi All,

I followed the instruction to the tee and can not get it to work. When I add the following code right after the body tag:

<?php $OL=1; require("thecalendar/calendar/calendar.php"); ?>

My website becomes TOTALLY BLACK SCREEN.

Any ideas?

Thanks a lot!

ve9gra
02-10-2008, 11:02 PM
You have to match the path to where you've installed your calendar.

I've always simply installed the calendar directly in the WP folder and used the regular require command:

require("calendar/calendar.php");

michelbites
03-05-2008, 05:17 PM
I am trying to intergrate the TOC version of EPC into wordpress. I got the normal AJAX version working with no problem. I just need to get the TOC working.

Oh and I am using Exec-PHP plugin for Wordpress. It works great.

This is the code I have in the POST:

<?php
$TOC=1;
require ("../calendar/calendar.php");
?>

The page is here.
http://www.spirithollow.org/wordpress/?page_id=168

As you can see from the page above the TOC is malformed. I can't seem to fix it. Please help. Thanks...

ve9gra
03-05-2008, 06:21 PM
Quick assumption here... I'm guessing that Exec-PHP doesn't allow for FORM elements. The better way is by using a page template that has the EPC code in it and create a new page using that template - even if there is no content (post) being provided. It might be a bit harder to implement, but it's much more solid.

beccawitz
03-12-2008, 07:30 AM
I read the whole thread and have the call to the filter and the calendar in my template. The calendar works fine, but the filter doesn't. I installed EPC on my root directory on not at the same level as wp-admin. Do you think this is why the filter doesn't work?

Thanks!
Rebecca

ve9gra
03-12-2008, 03:31 PM
I don't think that's allowed by most hosts as it ends up being outside of the <getting a blank here - I'm sick and my brain is not working> something like run path, or execute path...

Move the calendar installation to where it's been tested and try again.

beccawitz
03-17-2008, 11:57 AM
Thanks for your help! I got the filters to work using the call to the config. However, like, Susan, I am having trouble with the navigation of the months. My permalinks are set up with %postname%.
The name of the page is "find-shiurim". The name of the template that it is linked to is called "shiurim". I tried the $thisFile with both /shiurim and /find-shiurim and neither worked. Any ideas?

Thanks so much!

ve9gra
03-17-2008, 12:10 PM
Certain Permalinks totally break navigation. There's really no way around it. That's why in the steps it says to use the regular permalinks eg: ?page=xx&... Those are the only ones that play nice with the calendar.

beccawitz
03-17-2008, 12:49 PM
I changed it to regular p=# but the navigation between months still doesn't work. here's the link http://shiurtimes.com/wordpress/?page_id=9

Is it because I have the small version of the calendar in the sidebar?

beccawitz
03-17-2008, 02:46 PM
Has anyone set up an RSS feed for their EPC calendar using Wordpress?
I would love if someone could help me set this up. I saw the sticky about how to set up a RSS in general, but I'm not sure how/where this plays in when using wordpress.
THanks in advance :)

ve9gra
03-18-2008, 08:51 AM
In the same bit that you've added your $OL to, add $thisFile="";