Met onderstaand PHP script(je
) contoleer ik eerst op welk woord $location bevat, als dan $location == $name, dan bepaal ik welke class die moet pakken (buttonsnonactive voor niet active buttons, en buttons voor actieve buttons) het werkt zo wel, maar ik weet denk ik bijna zeker dat diet heel erg omslachtig is. weet iemand een betere manier om dit aan te pakken?
PHP:
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
| <? $name1 = "Home"; $title1 = "Introductie"; $name2 = "Computersopmaat"; $title2 = "Computers op maat"; $name3 = "Websites"; $title3 = "Websites"; $name4 = "Communicatie"; $title4 = "Communicatie"; $name5 = "Advies"; $title5 = "Advies"; $name6 = "Netwerken"; $title6 = "Netwerken"; $name7 = "Portfolio"; $title7 = "Portfolio"; $name8 = "LocatieenContact"; $title8 = "Locatie en contact"; $name9 = "Informatieaanvraag"; $title9 = "Informatie aanvraag"; $name10 = "Gastenboek"; $title10 = "Gastenboek"; $name11 = "dezemaand"; $title11 = "Deze maand!!!"; $activeclass = "buttons"; $nonactiveclass = "buttonsnonactive"; if ($name1 == "$location") { $class1 = "$activeclass"; } else { $class1 = "$nonactiveclass"; } if ($name2 == "$location") { $class2 = "$activeclass"; } else { $class2 = "$nonactiveclass"; } if ($name3 == "$location") { $class3 = "$activeclass"; } else { $class3 = "$nonactiveclass"; } if ($name4 == "$location") { $class4 = "$activeclass"; } else { $class4 = "$nonactiveclass"; } if ($name5 == "$location") { $class5 = "$activeclass"; } else { $class5 = "$nonactiveclass"; } if ($name6 == "$location") { $class6 = "$activeclass"; } else { $class6 = "$nonactiveclass"; } if ($name7 == "$location") { $class7 = "$activeclass"; } else { $class7 = "$nonactiveclass"; } if ($name8 == "$location") { $class8 = "$activeclass"; } else { $class8 = "$nonactiveclass"; } if ($name9 == "$location") { $class9 = "$activeclass"; } else { $class9 = "$nonactiveclass"; } if ($name10 == "$location") { $class10 = "$activeclass"; } else { $class10 = "$nonactiveclass"; } if ($name11 == "$location") { $class11 = "$activeclass"; } else { $class11 = "$nonactiveclass"; } echo " <tr> <td width='100%' valign='middle' height='35' class='$class1'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name1&title=$title1\">Start</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class2'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name2&title=$title2\">Computers</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class11'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name11&title=$title11\">Deze maand</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class3'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name3&title=$title3\">Websites</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class4'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name4&title=$title4\">Communicatie</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class5'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name5&title=$title5\">Advies</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class6'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name6&title=$title6\">Netwerken</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class7'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name7&title=$title7\">Portfolio</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class8'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name8&title=$title8\">Contact</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class9'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name9&title=$title9\">Info aanvraag</a></u></td> </tr> <tr> <td width='100%' valign='middle' height='35' class='$class10'>&#160;&#160;&#160; <u><a href=\"index.php?location=$name10&title=$title10\">Gastenboek</a></u></td> </tr> "; ?> |