in reply to Re^3: loop through file checking for session variable
in thread loop through file checking for session variable

Here is my current subroutine, I would like to use a file instead of an if then structure, so if I go on vacation, someone can just add sitecodes to the file. This works, but adding a file would make it better, I could change the sub depending on the match to call this or the other sub
sub MLX40Tutorials { my $str = ""; $str .= mLeftIndex(); my $xml = xmlFileData(Content", "Sitelist40.xml", "MLX40Tutorials()") +; if ($Request->item("DocID")->item()) { my $id = $Request->item("DocID")->item(); $xml =~ /(<tut id=\"$id\".*?\/>)/s; $str .= $1; } else { $xml =~ /(<mlxchange40.*?<\/mlxchange40>)/s; $str .= shadowBox("Mlxchange Tutorials", "<tutorials>".$1."</tut +orials>", ($g_docWidth/5*4-(2*$g_docSpace))); } return $str; }
Sub 2 trying to break into 2 seperate routines..
sub mTutorials { if ($Session->{'usrSystem'} eq "MRT") { my $str=""; $str.=mLeftIndex(); my $xml=xmlFileData("Content", "Sitelist40.xml", "MLX40Tutorials()") +; if ($Request->item("DocID")->item()) { my $id = $Request->item("DocID")->item(); $xml =~ /(<tut id=\"$id\".*?\/>)/s; $str .= $1; } else { $xml =~ /(<mlxchange40.*?<\/mlxchange40>)/s; $str .= shadowBox("MLXchange Tutorials &amp; Demos", "<tutorials +>".$1."</tutorials>", ($g_docWidth/5*4-(2*$g_docSpace))); #$xml =~ /(<mlxchange.*?<\/mlxchange>)/s; #$str .= shadowBox("MLXchange 3.0 Tutorials", "<tutorials>".$1." +</tutorials>", ($g_docWidth/5*4-(2*$g_docSpace))); } return $str; } if ($Session->{'usrSystem'} eq "RMLS") { my $str=""; $str.=mLeftIndex(); my $xml=xmlFileData("Content", "Sitelist40.xml", "MLX40Tutorials()") +; if ($Request->item("DocID")->item()) { my $id = $Request->item("DocID")->item(); $xml =~ /(<tut id=\"$id\".*?\/>)/s; $str .= $1; } else { $xml =~ /(<mlxchange40.*?<\/mlxchange40>)/s; $str .= shadowBox("MLXchange Tutorials &amp; Demos", "<tutorials +>".$1."</tutorials>", ($g_docWidth/5*4-(2*$g_docSpace))); #$xml =~ /(<mlxchange.*?<\/mlxchange>)/s; #$str .= shadowBox("MLXchange 3.0 Tutorials", "<tutorials>".$1." +</tutorials>", ($g_docWidth/5*4-(2*$g_docSpace))); }return $str; } else { if ($Session->{'usrSystem'} eq "BAR") { my $str=""; $str.=mLeftIndex(); my $xml=xmlFileData("Content", "Sitelist40.xml", "MLX40Tutorials()") +; if ($Request->item("DocID")->item()) { my $id = $Request->item("DocID")->item(); $xml =~ /(<tut id=\"$id\".*?\/>)/s; $str .= $1; } else { $xml =~ /(<mlxchange40.*?<\/mlxchange40>)/s; $str .= shadowBox("MLXchange Tutorials &amp; Demos", "<tutorials +>".$1."</tutorials>", ($g_docWidth/5*4-(2*$g_docSpace))); #$xml =~ /(<mlxchange.*?<\/mlxchange>)/s; #$str .= shadowBox("MLXchange 3.0 Tutorials", "<tutorials>".$1." +</tutorials>", ($g_docWidth/5*4-(2*$g_docSpace))); } return $str; } else { my $str = ""; $str .= mLeftIndex(); my $xml = xmlFileData("Content", "Tutorials.xml", "mTutorials()"); if ($Request->item("DocID")->item()) { my $id = $Request->item("DocID")->item(); $xml =~ /(<tut id=\"$id\".*?\/>)/s; $str .= $1; } else { $xml =~ /(<mlxchange.*?<\/mlxchange>)/s; $str .= shadowBox("MLXchange Tutorials &amp; Demos", "<tutorials +>".$1."</tutorials>", ($g_docWidth/5*4-(2*$g_docSpace))); $xml =~ /(<general.*?<\/general>)/s; $str .= shadowBox("General PC Tutorials", "<tutorials>".$1."</tu +torials>", ($g_docWidth/5*4-(2*$g_docSpace))); } return $str; } } }