 |
phpNuke Theme Tip |
 |
Over the past few months I have been removing as much as possible from the themes to make them load as fast and smooth as possible.
Here is a tip I will leave everyone that I use when building all my site themes that helps save on bandwidth.
Javascript is a great thing when used sparingly and wisely. It definitely has it place when it comes to web development. However one place I fail to see it's use is in the display of the date, that is so popular with all sites, when phpNuke already uses PHP to generate the pages.
Here is what I use in my theme to replace the javascript date method.
File: YourTheme/theme.php
At the start of the theme.php add:
global SITE_DATE;
$SITE_DATE = gmdate("M.d,Y");
// Formated Site Date - M = Short Month - F = Long Month - S = 1st, 2nd, 3rd
Replace the "Array ofmonth Names" Javascript with the global variable $SITE_DATE and you are set.
The php gmdate(); function is very flexible and can easily format your date to anything you like. With a little creative thinking you could code up a small function and easily add language changes.
Some of the more useful characters are recognized in the format string:
Y - year, numeric, 4 digits
y - year, numeric, 2 digits
F - month, textual, long; i.e. "January"
M - month, textual, 3 letters; i.e. "Jan"
m - month, numeric
z - day of the year, numeric; i.e. "299"
d - day of the month, numeric
l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"
D - day of the week, textual, 3 letters; i.e. "Fri"
w - day of the week, numeric, 1 digit
H - hour, numeric, 24 hour format
h - hour, numeric, 12 hour format
i - minutes, numeric
s - seconds, numeric
A - "AM" or "PM"
a - "am" or "pm"
S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"
|
|
|
|
|
Posted on Thursday, September 27, 2001 @ 3:33 AM CDT by NukeResources |
|
|
|
 |
Multi-Site Search
|
 |
 |
Sponsor Links
|
 |
|
| |
 |
Related Links |
 |
|
 |
Article Rating |
 |
Average Score: 5 Votes: 2

|
|
|
|
|
 |
Options |
 |
|
|