Date and time in (current language in) header.php theme file

Post modules, themes or any other code you want to share with the community.

Moderator: Developers

molski
Posts: 70
Joined: Mon Apr 26, 2004 8:10 pm

Date and time in (current language in) header.php theme file

Postby molski » Sat Oct 27, 2007 8:49 am

All,

I adjusted the header.php, the part were you normally see "logged in as" is nou modified to shee the name of the person that's logged in and then the date:

Code: Select all

$row = new table_row();
$cell = new table_cell($strLoggedInAs.' '.htmlspecialchars($_SESSION['GO_SESSION']['name']).'  -  '.date('l, d F Y, G:i'));
$cell->set_attribute('style', 'width:15%');
$row->add_cell($cell);
But right now date and time is always in English, I want to adjust this so that it uses the current language.
In the (for me) nl.inc file I noticed this:

Code: Select all

$months[0]='Januari';
$months[1]='Februari';
$months[2]='Maart';
$months[3]='April';
$months[4]='Mei';
$months[5]='Juni';
$months[6]='Juli';
$months[7]='Augustus';
$months[8]='September';
$months[9]='Oktober';
$months[10]='November';
$months[11]='December';
$full_days[0]='Zondag';
$full_days[1]='Maandag';
$full_days[2]='Dinsdag';
$full_days[3]='Woensdag';
$full_days[4]='Donderdag';
$full_days[5]='Vrijdag';
$full_days[6]='Zaterdag';
How can I adjust the "logged in as" part so that it uses the months and full_days from the language file?


Best regards,

Molski
molski
Posts: 70
Joined: Mon Apr 26, 2004 8:10 pm

Done!!

Postby molski » Sat Oct 27, 2007 11:34 am

I changed:

Code: Select all

$cell = new table_cell($strLoggedInAs.' '.htmlspecialchars($_SESSION['GO_SESSION']['name']).'  -  '.date('l, d F Y, G:i'));
into:

Code: Select all

$cell = new table_cell($strLoggedInAs.' '.htmlspecialchars($_SESSION['GO_SESSION']['name']).'  -  '.$full_days[date('w')].date(', d ').$months[date('m')-1].date(' Y, G:i'));
Checked it with Dutch and English language, works great!
Okay maybe the code can be a bit "cleaner" but I am no PHP Scripter ;)
User avatar
dkittell
Site Admin
Site Admin
Posts: 808
Joined: Tue May 25, 2004 10:32 pm
Location: Michigan, USA
Contact:

Postby dkittell » Sun Oct 28, 2007 10:34 am

Not to discourage creativity but why rewrite it when it's in the Summary module?
David Kittell
Owner / Developer
Kittell.net
molski
Posts: 70
Joined: Mon Apr 26, 2004 8:10 pm

Postby molski » Sun Oct 28, 2007 10:51 am

Maybe not everyone is using the Summary Module ;)

And also in the Summary Module you'll see only the date in the right upper corner.


Regards,

Molski
User avatar
dkittell
Site Admin
Site Admin
Posts: 808
Joined: Tue May 25, 2004 10:32 pm
Location: Michigan, USA
Contact:

Postby dkittell » Sun Oct 28, 2007 10:53 am

I was mainly refurring to taking time to write a way to do it when you could take it from the summary page
David Kittell
Owner / Developer
Kittell.net
molski
Posts: 70
Joined: Mon Apr 26, 2004 8:10 pm

Postby molski » Sun Oct 28, 2007 11:26 am

Yeah I also checked out the Summary Page, Calendar page...but hey, I am absolutely not a PHP Scripter and if a little copy&paste options don't work 100%, I am looking for some alternatives and that is the code I have right now ;)

If you know a better way to do it, please be my guest :)
I would love to see some alternative ways to achieve what I have right now.
User avatar
dkittell
Site Admin
Site Admin
Posts: 808
Joined: Tue May 25, 2004 10:32 pm
Location: Michigan, USA
Contact:

Postby dkittell » Sun Oct 28, 2007 12:29 pm

Take a look at http://www.group-office.com/forum/viewt ... 2720#12720

This is a face lift to the theme as well but has what you are going for
David Kittell
Owner / Developer
Kittell.net

Who is online

Users browsing this forum: No registered users and 1 guest

cron