vraag over array

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Thomas Berm

Thomas Berm

23/04/2015 12:03:23
Quote Anchor link
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
$path
= $_SERVER['DOCUMENT_ROOT'] . '/bestand.php';
require_once($path);
$hours = array(
      'mon' => array('08:00-21:00'),
      'tue' => array('08:00-21:00'),
      'wed' => array('08:00-21:00'),
      'thu' => array('08:00-21:00'), // Open late
      'fri' => array('08:00-21:00'),
      'sat' => array('08:00-21:00'),
      'sun' => array('12:00-18:00'),
    );


  // OPTIONAL
  // Add exceptions (great for holidays etc.)
  // MUST be in format month/day
  // Do not include the year if the exception repeats annually

  $exceptions = array(
);

  // OPTIONAL
  // Place HTML for output below. This is what will show in the browser.
  // Use {%hours%} shortcode to add dynamic times to your open or closed message.


?>


In de $template array(
'open' => "<h3>open {%hours%} uur.</h3>",
'closed' => "<h3>dicht {%hours%} uur.</h3>",
);
moet ook de mon.tue.wed,thu,fri,sat,sun array worden opgenomen onder 'open' => en 'closed'
is dit mogelijk enzo ja hoe, dit is een grote stap voor mijn learning curve.
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
   $template
= array(
    'open' => "<h3>open {%hours%} uur.</h3>",
    'closed' => "<h3>dicht {%hours%} uur.</h3>",
    'closed_all_day' => "<h3>Gesloten</h3>",
    'separator' => " - ",
    'join' => " and ",
    'format' => "G:i", // options listed here: http://php.net/manual/en/function.date.php
    'hours' => "{%open%}{%separator%}{%closed%}"
  );

  // Instantiate class and call render method to output content
    $store_hours = new StoreHours($hours, $exceptions, $template);
    $store_hours->render();
    ?>


Edit:
UBB-codes even gefixed met code en php-tags
Gewijzigd op 23/04/2015 12:14:17 door - Ariën -
 
PHP hulp

PHP hulp

27/04/2024 03:24:11
 
Frank Nietbelangrijk

Frank Nietbelangrijk

23/04/2015 12:22:06
Quote Anchor link
Google eens op two dimensional arrays. Als dat niet voldoende is dan kan ik of iemand anders nog wat uitleg geven.
Tip: gebruik
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
<?php
Echo '<pre>';
Print_r ($array);
?>
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.