note 28939 rejected from control-structures.switch by victor

From: Date: Tue, 28 Jan 2003 18:23:59 +0000
Subject: note 28939 rejected from control-structures.switch by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-42942@lists.php.net to get a copy of this message
Hi, I used this code to parse through a template html file .. I just want to get displayed an other template, if the switch changes. With this script i just get viewed the first case. No matter what $cmd here is, i always get the template output for "news".. even if i delete or comment the "default" part. Can anybody tell me whats going wrong here? ------ $template = "templates/index.html"; $output = implode(" ", file($template)); switch ($cmd) { case news: $ext_template = "templates/news.html"; $ext_output = implode(" ", file($ext_template)); $output = str_replace('{Module_Body}', $ext_output, $output); break; case member: $ext_template = "templates/member.html"; $ext_output = implode(" ", file($ext_template)); $output = str_replace('{Module_Body}', $ext_output, $output); break; default: $ext_template = "templates/news.html"; $ext_output = implode(" ", file($ext_template)); $output = str_replace('{Module_Body}', $ext_output, $output); break; } echo $output;

« previous php.notes (#42942) next »