Page 1 of 1

Server dategroup.date out of sync

Posted: Wed Aug 23, 2006 4:17 am
by bdconnolly
<div style="font-size: xx-small; text-align: center">{$dategroup.date|@formatTime:'%A, %B %d, %Y'}</div>

Code above give "Wednesday, August 16, 2006." Server is synced to Tue Aug 22 20:56:16 2006

What’s that??

Re: Server dategroup.date out of sync

Posted: Wed Aug 23, 2006 10:40 am
by garvinhicking
Hi!

What do you mean? For entries from 2006-08-16 you see entries that are dated to 2006-22-08?

The dategroup date depends on the date of an entry you posted. The date of an entry might be influenced by a Server Timezone Offset you configured.

Best regards,
Garvin

Posted: Wed Aug 23, 2006 1:43 pm
by bdconnolly
Okay Garvin... this is where patience with the feeble is important. :)

I am just trying to get the current time/date to display in the template header.

I now understand that I was using the wrong smarty code and need to roll my own. Here's a stab at it.

Edited a config.inc.php file for the template to include:

Code: Select all

<?php
$serendipity['smarty']->register_function('time');
function time($smarty) {
  return '%A, %B %d, %Y';
}
?>
Tried to add {$time} to the index.tpl.

?

Posted: Wed Aug 23, 2006 3:09 pm
by garvinhicking
Hi!

When you register a function, you must call it like a function: {time} and not {$time}. :)

Then it should work, I guess! :)

Best regards,
Garvin

Posted: Wed Aug 23, 2006 4:17 pm
by bdconnolly
Nope.

But another dead end chasing minutia.

:cry:

Posted: Wed Aug 23, 2006 9:35 pm
by bdconnolly
Don't suppose you know of anyone in the HISTORY OF SERENDIPITY who put the current date and time in the header.

?

Can't find it anywhere. Seems pretty basic.

Posted: Wed Aug 23, 2006 10:14 pm
by bdconnolly
config.inc.php in template folder:

Code: Select all

$serendipity['smarty']->register_function('date_now', 'print_current_date');

function print_current_date($params)
{
    $format = $params['format'];
    return strftime($format,time());
  }
This in index.tpl:

Code: Select all

{date_now format='%A, %B %d, %Y'}
Done.

Posted: Thu Aug 24, 2006 11:34 am
by garvinhicking
Hi!

Excellent work! I knew you could do it. :-)

Best regards,
Garvin