Sekcje

2011-07-12 20:39:08 Post #1 user76

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class Sections {
public 
$dataGet = array();
var 
$errors = array();
public function 
__construct(){
$this->dataGet = ($_POST);
//print $this->dataPost['subject'];
}
  public function 
sectionShow($section){
if(!empty(
$section)){
  switch(
$section){
    case 
'clients':{
    print 
"klienci";
    }
    break;
    case 
'levels':{
       print 
"poziomy";
    }
    break;
   default:{
       print 
"domyslnie";
    }
    break;
  }
}else { 
  print 
"Wybierz sekcje"
  }
}
};
$show = new Sections;
$show->sectionShow('levels'); 




Czy nie powinn oto wyglądać inaczej, niż switch ?
Dodam, że sekcje mam statyczne i do tego panel administracyjny, nie tworzę cms-a.

2011-07-13 10:26:58 Post #2 nospor

 
switch jest ok.
W case nie musisz dawać {...}

Odpowiedz