31
Requested additions / Re: trade centre open at a certain time and also the bank
« on: June 06, 2007, 12:44:54 am »
This shouldn't be too hard to code. php has a built in date function that allows you to extract the current date. You can use that, along with an if-statement, to not show any bank functions if the time isn't right. In shop-bank.php find
and add
and add the end add
A couple of examples of how your if statement might work:
Taking the Sabbith(bank closed on sunday)
Only weekends:
Only open 9-5
Of course, there are many many other things you can do. Look here for how the date function works:
http://us.php.net/date
Edited by Daniel15: Fixed formatting
Code: [Select]
isAllowedTo('shop_bank');
and add
Code: [Select]
if (//put your time frame here. Google the php date function to find how this works) {
and add the end add
Code: [Select]
}
else {
$context['shop_buy_message'] = 'You are not allowed to access the bank at this time';
// Set the page title
$context['page_title'] = $txt['shop'] . ' - ' . $txt['shop_bank'];
// Use the 'message' template
$context['sub_template'] = 'message';
}
A couple of examples of how your if statement might work:
Taking the Sabbith(bank closed on sunday)
Code: [Select]
if (date('w') != 0) {
Only weekends:
Code: [Select]
if (date('w') == 0 || date('w') == 6) {
Only open 9-5
Code: [Select]
if (9 <= date('G') < 17) {
Of course, there are many many other things you can do. Look here for how the date function works:
http://us.php.net/date
Edited by Daniel15: Fixed formatting