Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 15:31

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[php] Öffnungszeitenscript

Discussion on [php] Öffnungszeitenscript within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
Undaground's Avatar
 
elite*gold: 5
Join Date: Dec 2009
Posts: 1,474
Received Thanks: 1,421
[php] Öffnungszeitenscript

Hallo Com,

ich habe hier ein Öffnungszeitenscript und ein dazugehöriges Problemchen.
Ich möchte die Öffnungszeiten von Montag bis Samstag nicht bis 21:00 ausgeben sondern bis 21:30, wäre nett wenn jemand ein Tipp geben könnte, danke lg


PHP Code:
 <?php

//Öffnungszeiten definieren
$oeffnungszeiten = array
(
    
=> array('tag' => 'Montag''start' => 10'end' => 21),
    
=> array('tag' => 'Dienstag''start' => 10'end' => 21),
    
=> array('tag' => 'Mittwoch''start' => 10'end' => 21),
    
=> array('tag' => 'Donnerstag''start' => 10'end' => 21),
    
=> array('tag' => 'Freitag''start' => 10'end' => 21),
    
=> array('tag' => 'Samstag''start' => 10'end' => 21),
    
=> array('tag' => 'Sonntag''start' => 12'end' => 21)
);


//Öffnungszeiten auslesen
foreach($oeffnungszeiten as $day => $info)
{
    
//Prüfen, ob der Tag stimmt und fett machen
    //Das N gibt den Tag der Woche als Zahl aus, d.h. 1 = Montag; 7 = Sonntag
    
if($day == date('N') && $info['start'] <= date('H') && $info['end'] > date('H'))
    {
        echo 
'<strong>'.$info['tag'].' '.$info['start'].':00 - '.$info['end'].':00 Uhr</strong><br />';
    }
    
//Wenn Tag nicht stimmt, nicht fett machen
    
else
    {
        echo 
$info['tag'].' '.$info['start'].':00 - '.$info['end'].':00 Uhr<br />';
    }
}

?>
Undaground is offline  
Old 03/20/2015, 13:33   #2
dotCom
 
Devsome's Avatar
 
elite*gold: 9842
The Black Market: 107/0/0
Join Date: Mar 2009
Posts: 16,866
Received Thanks: 4,685
Warum in dem Array dann nicht nur die Stunden sondern auch Minuten speichern ?
Code:
1 => array('tag' => 'Montag', 'start' => 10:30, 'end' => 21:33),
und beim echo nicht $info['start']. ':00' sondern einfach nur deine Variable.
Devsome is offline  
Thanks
1 User
Old 03/20/2015, 15:14   #3
 
MrDami123's Avatar
 
elite*gold: 56
Join Date: Oct 2010
Posts: 3,409
Received Thanks: 1,219
Gibt doch bestimmt Funktionen dafür.
MrDami123 is offline  
Reply




All times are GMT +1. The time now is 15:32.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.