Greetings everyone,
My site is at:
http://www.tapanime.com/cms/
I’m trying to get a news feed to work on MODx I don’t know if I can do it the way I’m trying or if there is something else I have to do. I use to just run the code on my php page in an iframe on my regular site and of course I’m switching over to MODx once I learn and install what I need to make it work.
To the point here is the code as I have it now:
// Connect to database
$mysql_connection = mysql_connect("localhost", "tapanime_newstes", "yes");
if (!$mysql_connection) die("mysql_connect() failed");
if (!mysql_select_db("tapanime_newstest", $mysql_connection))
die("mysql_select_db() failed");
// Fetch the stored news
$result = mysql_query("SELECT * FROM annNews");
if (!$result) die(mysql_error());
$annNews = mysql_fetch_array($result);
// If the news were last updated more than one hour ago, re-update them
if ($annNews['last_query'] < time() - 3600 or trim($annNews['news']) == "")
{
// Fetch the news from ANN
// You need to put your own username and password here
$a = file("http://animenewsnetwork.com/newsfeed/getnews.php?u=jinto76&p=newstest");
$n = addslashes(trim(implode("", $a)));
// Save the news to the database
$query = "UPDATE annNews SET last_query=UNIX_TIMESTAMP()";
if ($n)
{ $query .= ", news='$n'";
$annNews['news'] = stripslashes($n);
}
mysql_query($query);
}
// Display the news
echo $annNews['news'];
Originally on my current site it has the: <? ?> If I keep those in I get this error:
Parse error: parse error, unexpected '<' in /home/tapanime/public_html/cms/manager/includes/document.parser.class.inc.php(705) : eval()'d code on line 1
The call I’m using on the index.php is: [!ann-news!] so it is uncached.
In the source cache section I see this I don’t know if it means anything:
<?php die('Unauthorized access.'); ?>
I don’t see why it would since my current site still pulls the news.
Any thoughts on how to get this to work in MODx?
INFO
Webserver:
PHP version - 4.3.11
MySQL version - 4.1.21-standard
Operating System and version - Linux and Apache 1.3.33
Browser name and version - FireFox 1.5.0.7
Operating System and version - Windows XP Home and added SP1
Website:
http://www.tapanime.com
MODx Test Site:
http://www.tapanime.com/cms/