1 (edited by rexron 2007-10-03 00:04)

Topic: Date problem

I installed the miniportal mod.
Cool mod but I see a problem.
Follow this link to see what I mean.
www.forum.eterya.com

Under the lorum ipsum generated text there´s a box showing the most recent posts.
Now... I did not post these the year I was born wink

The header date says Thursday, 01 January 1970 nomatter what.
Beside the title it says 01.00. This is allso wrong.

Can someone help me with this? If so, I´d like to be able to generate the days in norwegian.

Sincerely
Ronny

Re: Date problem

There's probably an error in your code, can you post it?


Also by generating days in norwegian you mean Måndag instead of Monday and so on?

Re: Date problem

Not sure what code to post. Is it functions.php*? I believe I stumbeld over something there once.

About days. Exactly what I mean smile
However, it´s Mandag. I think Måndag swedish wink

Sincerely
RexRon

Re: Date problem

Check if there's actually anything in the timestamp DB fields.

Re: Date problem

I believe this is what generates the topics and date/time.
This is a section of index.php.

// Fetch $show topics
    $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
    $show_count = 0;
    if ( !$db->num_rows($result) ) return $output;
    while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) {
        $temp = '';
        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        if (pun_strlen($cur_topic['subject']) > $max_subject_length)
            $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
        else
            $subject_truncated = $cur_topic['subject'];
        $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a> - <em>Postet av '.$cur_topic['poster'].' kl. '.date('H:i', $cur_topic['Postet']).'</em><br>';
        // Group posts by date    
        $thisdate = date('l, d F Y', $cur_topic['postet']);
        if ($thisdate != $saveddate) 
 
        {
            if ($saveddate)
            {
                $temp .= "</div></div>";
            }
            $temp .= '<div class="block"><h2><span>'.$thisdate.'</span></h2><div class="box"><div class="inbox"><p>';
            $saveddate = $thisdate;
        }
        else {
            $temp .= '<div class="inbox"><p>';
        }
        $temp .= $newsheading.'</p><p>';
        $id = $cur_topic['id'];
        $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
            if ( !$db->num_rows($msg) ) continue;
        $cur_post = $db->fetch_assoc($msg);
        // Display first paragraph only (comment out next four lines to turn off)
        if ($truncate == 1)
        {
        $paragraph = preg_split("/s*n+/", $cur_post['message']);
            if (isset($paragraph[1])) {
                $cur_post['message'] = $paragraph[0] . "...";
            }
        }
        $cur_post['message'] = parse_message($cur_post['message'], 0);
        $temp .= $cur_post['message'];
        $temp .= "</p></div>";
        if (isset($output)) {
            $output .= $temp;
        }
        else {
            $output = $temp;
        }
        ++$show_count;

Do you see anything wrong here.
Date and time works for the rest of the forum.

RexRon

Re: Date problem

I believe there's a typo here

$thisdate = date('l, d F Y', $cur_topic['postet']);

Change to

$thisdate = date('l, d F Y', $cur_topic['posted']);

Re: Date problem

Thanks smile