MyBB Community Forums

Full Version: Display current month on index
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I display the current month (i.e. December) on the forum index? Do I need a plugin?
(2012-12-05, 02:50 PM)wils172 Wrote: [ -> ]How can I display the current month (i.e. December) on the forum index? Do I need a plugin?

You could use a Javascript clock if you wanted.
(2012-12-05, 02:52 PM)markwesley Wrote: [ -> ]
(2012-12-05, 02:50 PM)wils172 Wrote: [ -> ]How can I display the current month (i.e. December) on the forum index? Do I need a plugin?

You could use a Javascript clock if you wanted.

I was wanting to do it with a condition if possible.. like {$month}
You could do it with HTML5?

Or you could not do that because I misunderstood what you wanted. Sad
(2012-12-05, 03:32 PM)Xanth Wrote: [ -> ]You could do it with HTML5?

That would be javascript, not HTML5.
$month = date('F');

You'd either need to modify a core file (e.g. global.php or index.php) or use the above code in a plugin. Then use {$month} in your template.
You don't need a plugin if you want to make a simple edit to global.php and add one line:

find:
eval("\$headerinclude = \"".$templates->get("headerinclude")."\";");

and insert above it:
$month = (THIS_SCRIPT == 'index.php' ? my_date('F', TIME_NOW, '', false) : '');

and then put {$month} in the template you want and it will only show on the index page. FYI, I put it in global.php so that it can be used in the header and related templates
Thanks paveman that worked great!