Page 1 of 1

Stupid Error

Posted: Mon Mar 12, 2007 8:56 am
by latour
I get this error everytime I include a PHP File.

string(59) "Smarty error: unable to read resource: "content:content_en""

I'm including the same PHP file on another CMS install and it works fine.

yes, i'm using the literal tags
yes, i have php tags enabled in cfg

Re: Stupid Error

Posted: Mon Mar 12, 2007 10:42 am
by cyberman
Are you get the same result with udt?

Re: Stupid Error

Posted: Tue Mar 13, 2007 7:02 am
by latour
yes

Re: Stupid Error

Posted: Tue Mar 13, 2007 7:35 am
by cyberman
Can you post php snippet here?

Re: Stupid Error

Posted: Thu Mar 15, 2007 9:33 pm
by latour
it's latest_posts.php, forum mod - BUT IT HAPPENS WITH ALL PHP INCLDUES NOT JUST THIS ONE


/*
This will display the time interval between posts
Example: posted 3 minutes ago
Example: posted 2 hours and 3 minutes ago
Example: 1 day, 5 hours ago
*/

//OR display date only
// The following 2 lines can be changed to however you want the date and time to be displayed. 
// Default date: dd month year
// Default time: hh:mm ampm TIMEZONE (12 hour time)
// For more information on how the next 2 lines can be changed, please reference the README file.
// If you elect to show the date and time it was posted instead of the way shown above ONLY, change the $showtime variable to 1.
$showtime = 0;
$datedisplay = 'd F Y';
$timedisplay = 'h:i A T';

//////////////
// Required //
//////////////

require "ips_kernel/class_db_mysql.php";
require "conf_global.php";

//////////////
// Database //
//////////////

$db = new db_driver;
$db->obj['sql_database']    = $INFO['sql_database'];
$db->obj['sql_user']        = $INFO['sql_user'];
$db->obj['sql_pass']        = $INFO['sql_pass'];
$db->obj['sql_host']        = $INFO['sql_host'];
$db->obj['sql_tbl_prefix']  = $INFO['sql_tbl_prefix'];

// Connect to DB
$db->connect();

// Query the DB with the supplied user inputted variables.
$getposts = $db->query("SELECT posts, last_poster_name, last_poster_id, title, tid, forum_id, last_post FROM ibf_topics WHERE (forum_id NOT IN ($forumexclude)) ORDER BY last_post DESC LIMIT $posts");

// Format and display the results.
while ($post = $db->fetch_row($getposts)) {

$post[full_title] = $post[title];
if ($showtopiclength == 1 AND strlen($post[full_title]) > $topiclength) {
$post[short_title] = substr($post[full_title],0,$topiclength);
$post[short_title] = $post[short_title]."...";
}
else {
$post[short_title] = $post[full_title];
}

$posted_on = date($datedisplay, $post[last_post]); // Need to change mySQL timestamp to something more human readable.
$today_date = date($datedisplay, time()); // Grab today's date so we can compare it against the posted date

if ($showtime == 0) {
$showtimediff =  timediff($interval,time(),$post[last_post]);
$datefield = $showtimediff;
}
else {

// If it was posted today, we want to display "Today, hh:mm AMPM"
If ($posted_on == $today_date) {
$datefield = "Today";
$datefield = $datefield . ", " . date($timedisplay, $post[last_post]);
}

// If it was posted yesterday, we want to display "Yesterday, hh:mm AMPM"
elseif (date('d F Y',strtotime("-1 day")) == $posted_on) {
$datefield = "Yesterday";
$datefield = $datefield . ", " . date($timedisplay, $post[last_post]);
}

else {
$datefield = $posted_on;
}
}

echo
/////////////////
// Post Format //
/////////////////
// Between the EOD markers you can put whatever you want in HTML format.  Just ensure that the link stays somewhat the same.
$post[short_title]

EOD;
}

function timediff($interval, $starttime, $endtime) {

$timediff = $starttime - $endtime;
$days=intval($timediff/86400);
$remain=$timediff%86400;
$hours=intval($remain/3600);
$remain=$remain%3600;
$mins=intval($remain/60);
$secs=$remain%60;

$pluraldays = ($days 1) {
// If a post is older than Yesterday we want to display the the date and time it was created rather than how long ago.
// This makes it easier to display rather than having it say 3 days, 5 hours ago, for example.
$timediff = $posted_on;
}
elseif ($days == 1) {
// The post is within 1 day old.  In this case, I've decided it may be best to show only 1 day, 5 hours ago, for example.
$timediff = "posted ".$days." day and ".$hours.$pluralhours." ago";
}
else {
// Less than 1 day has passed and here we use the interval that was set above.

if ($interval == 0) { $timediff = "posted ".$days.$pluraldays." ago";} // show only days
elseif ($interval == 1) { $timediff = "posted ".$hours.$pluralhours." ago";} // show only hours
elseif ($interval == 2) { $timediff = "posted ".$mins.$pluralmins." ago";} // show only minutes
elseif ($interval == 3) { $timediff = "posted ".$secs.$pluralsecs." ago";} // show only seconds

elseif ($interval == 4) { // show hours and minutes
if ($hourcount) { $timediff = "posted ".$mins." ".$pluralmins." ago"; }
else if ($minscount) { $timediff = "posted ".$hours." ".$pluralhours." ago"; }
else { $timediff = "posted ".$hours.$pluralhours." and ".$mins." ".$pluralmins." ago"; }
}
elseif ($interval == 5) { // show hours and seconds
if ($hourscount) { $timediff = "posted ".$secs." ".$pluralsecs." ago"; }
else if ($secscount) { $timediff = "posted ".$hours." ".$pluralhours." ago"; }
else { $timediff = "posted ".$hours.$pluralhours." and ".$sec." ".$pluralsecs." ago"; }
}
elseif ($interval == 6) { // show minutes and seconds
if ($minscount == 1) { $timediff = "posted ".$secs." ".$pluralsecs." ago"; }
else if ($secscount == 1 ) { $timediff = "posted ".$mins." ".$pluralmins." ago"; }
else { $timediff = "posted ".$mins.$pluralmins." and ".$secs." ".$pluralsecs." ago"; }
}
else { // show hours, minutes and seconds
$timediff = "posted ".$hours.$pluralhours.", ".$mins." ".$pluralmins." and".$secs." ".$pluralsecs." ago";
}
}

return $timediff;

}
?>

Re: Stupid Error

Posted: Fri Mar 16, 2007 7:57 am
by cyberman
Hmm, cant reproduce your error with this snippet. I've putted in a udt and see only errors which missed required files.

I see your snippet works with index.php too - maybe there are some problems.