PDA

View Full Version : Need Help. Mixing easphp script with another php script


flump
11-25-2007, 12:57 AM
Guys, a pretty straight forward question/problem here.

Bought 2 licenses of the program and I love it!

I have easy php calendar loaded on my root page (index.php) and its working great!

However, I also have a news script ("news script") that is embedded in a table below the "blog layout" of the easy php calendar.

Initially, they both work great, but when you change any date on the calender, the calendar does what it is supposed to do and takes you to that day's events...however my news script (underneath) doesn't display the news.. Instead I get "article not found"

I'm asking whats the best way to fix this?

URL = www.panhandleumpires.com (http://www.panhandleumpires.com)

Thanks!

ve9gra
11-26-2007, 05:49 PM
Hard to guess what's going on without getting my hands dirty... Are you using the same database for both scripts? If not, you should. If you are, then I'm stumped.

My guess is that the news script tries to look for articles with any of the variables that are passed through the URL... I suppose we could destroy the variables after the calendar is displayed, but without knowing what the news script is looking for it might be a hit-or-miss thing.

flump
11-26-2007, 06:13 PM
Ok I'll try that. Makes sense. I didn't even think about that. I do have them in 2 separate databases. I'll just add a table to the calendar system.

That should take care of it hopefully?

ve9gra
11-26-2007, 07:05 PM
It is usually easier to add the calendar to whatever you are already using. The script can automatically create the table required. Just provide it with the database you want to use and the appropriate credentials. You could also move (export/import) the table you already have into the other database. The calendar uses a single table called epc_calendar.

flump
11-26-2007, 07:09 PM
I'm going to try to mess with it shortly. I'll probably just import the calendar like you said.

flump
11-26-2007, 07:33 PM
Ok buddy, I moved the calendar table to the same database as the news system (news_script) which btw only has 2 tables itself.

And its still a no go. Works initially, but when you click on a date the articles disappear.

The database "tab" under the admin control panel is also pointing at the news_script database now as well.

www.panhandleumpires.com

Where to go now you think?

flump
11-26-2007, 10:15 PM
In all honesty, I wouldn't mind just switch to a different news system. One that just allows ad, edit delete with a time/date stamp when the article was posted. A tinyMCE feature or similar is only a bonus.

Any suggestions?

Brian
11-27-2007, 09:10 AM
I'm pretty sure it's the $mo variable that's causing this. After the last calendar require, try adding:

<?php
unset($mo);
?>

flump
11-27-2007, 10:24 AM
A fellow Floridian sure does appreciate the help. I hope you guys don't get upset for posting the whole code, but here is what I have added so far. Still a no go. I feel its my amateur php skills or something simple I'm doing wrong. I'm sorry!!


My sql table looks like this as well...

Database:

news_scriptTables:

epc_calendar
n2s_article
n2s_settingI took out the css styles to make it smaller...



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<?php include './include.php'; ?>

<html>

<head>

<title>Panhandle Umpires</title>
<meta http-equiv="l" content="text/html; charset=iso-8859-1"/>

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

<style type="text/css">

</head>

<body>

<table width="800" border="1" align="center" cellpadding="10" cellspacing="0">
<tr>
<td colspan="2" align="center" valign="top" bgcolor="#006699"><img src="images/toplogo.jpg" alt="toplogo.jpg" width="800" height="80" border="0"><br>
<br>
<span class="style8"><a href="index.php" class="bottom_link">home</a><strong> :: </strong><a href="about_us.php" class="menu_link">about us</a><strong> :: </strong><a href="forms.php" class="menu_link">forms</a><strong> :: </strong><a href="links.php" class="menu_link">links</a><strong> :: </strong><a href="contact_us.php" class="menu_link">contact us</a><strong> :: </strong><a href="gallery/" class="menu_link">photo gallery</a><strong> :: </strong><a href="http://www.panhandleumpires.com/forums" target="_blank" class="menu_link">forums</a> <strong>:: </strong><a href="https://panhandle.assignby.net/" target="_blank" class="menu_link">assignbyweb</a><a href="assignbyweb.php" class="menu_link"></a></span></td>
</tr>
<tr>
<td width="205" align="center" valign="top" bgcolor="#FFFFFF">

<span class="local style12 style15"><a href="all_times_local.php" class="local">all times local</a></span><br>

<?php $EPCBLOG=1;

require("calendar/calendar.php");

?>

</td>
<td align="center" valign="top" bgcolor="#F2F2F2">

<?php

$EPCBLOG=2;
$template="blog.php";
$DF = "l, F j, Y";
require("calendar/calendar.php");

?>

<?php

unset($mo);

?>

</td>
</tr>
<tr>
<td colspan="2" align="center" valign="top" bgcolor="#FFFFFF"><div align="left">
<p><?php echo $n2s_output; ?></p>
<p>&nbsp;</p>
<p><br>
</p>
</div></td>
</tr>
<tr>
<td height="20" colspan="2" align="center" valign="top" bgcolor="#006699"><div align="left" class="style10"><span class="body_link"><span class="style11">design by <a href="design_by.htm" class="bottom_link">wposey</a> <strong>:: </strong>Copyright 2007 All Rights Reserved :: </span><span class="style12"><a href="admin.php" class="admin_link">admin</a></span></span></div></td>
</tr>
</table>

</body>
</html>

ve9gra
11-27-2007, 11:16 AM
Ok, how does the news script work? All I see where the news are is an echo... That leads me to believe that the code is generated way before that. Is it possible it's done in the include.php?

If you could somehow move where the news are generated to right after the unset($mo), that might work.

flump
11-27-2007, 11:23 AM
Ok, how does the news script work? All I see where the news are is an echo... That leads me to believe that the code is generated way before that. Is it possible it's done in the include.php?

If you could somehow move where the news are generated to right after the unset($mo), that might work.

Doing this just spits the news under the blog window

http://www.panhandleumpires.com/index2.php for example.

the include.php for the news script is (which is located in index.php directory...?) OR should the calendar be in the same directory as the new_script...or vis versa?

Should I maybe move include.php to the calendar's director?



<?php

/**
* GentleSource News Script
*
*/


define('N2S_ROOT', './news_script/');
define('N2S_FRONTEND_RESULT_NUMBER', 10);

require N2S_ROOT . 'news.php';


?>

Brian
11-27-2007, 08:27 PM
The directory shouldn't matter.

Try modifying the code at the top to this:

<?php
$moT = $_REQUEST['mo'];
unset($mo);
include './include.php';
$mo = $moT;
?>

flump
11-27-2007, 08:56 PM
The directory shouldn't matter.

Try modifying the code at the top to this:

<?php
$moT = $_REQUEST['mo'];
unset($mo);
include './include.php';
$mo = $moT;
?>

No unfortunately that doesn't work either.

ve9gra
11-27-2007, 11:28 PM
I looked a bit at how the script works and it simply looks at the Query String (at least in its default config). Since the calendar uses the query string to pass the day/month/year, it causes the news script to look for an article named ev=2454429&mo=11&yr=2007...

Change your configuration for the news script to use URL Parameter instead, that way it'll be looking for a parameter called "url" in the URL instead of just taking everything.

flump
11-27-2007, 11:58 PM
Not following you Ve9gra. Could you explain it a little more thorough?

flump
11-28-2007, 12:48 AM
anyone think that it may be something to do with the blog.php template files?

ve9gra
11-28-2007, 08:35 AM
Sorry... I'll explain. I read the installation guide for the news script and they say there's three modes you can run it under:

- URL Parameter
(http://www.example.com/news/?url=Article-Title-42.html)

- Query String (default setting)
(http://www.example.com/news/?Article-Title-42.html)

- .htaccess Mod Rewrite
(http://www.example.com/ news/Article-Title-42.html)

As you can see, under the Query String setting, it uses the whole URI, so will look for anything you put in the query to match a title. If you change that setting to be URL Parameter, then it will look only for the "url" variable in the query.

The fact that the news script isn't working has technically nothing to do with the calendar. If you were to use the news script inside of a CMS (ie: Joomla, PHP-Nuke, many others) it would break just the same.

I've tested it using a similar configuration to yours (blog mode with the news script below) and I can confirm that changing the configuration to use URL Parameter fixes it. Go to the admin section of News Script and under Configuration > General Settings > URL Handling = URL Parameter.

flump
11-28-2007, 01:38 PM
Did I ever mention you guys are pretty smart?

I felt it was something simple. I feel so dumb.

ve9gra (http://www.easyphpcalendar.com/forums/member.php?u=86) thank you so much for your help. I really appreciate the extra mile you went to fix this for me. It's not even your script. I really appreciate your effort and to all those who helped. Best $40 I've spent in a long time (2 x $20).

I will always use this script. I'll never even dream of buying another calendar system again.

Thanks a ton guys. That was the last thing until my site was ready for launch!