I’m a php newbie and am looking for some reassurance or advice. Php is turned on for my forum templates (I’m using them for registration and member profiles too, rather than the member templates) and I’ve added some conditional code in one of the global templates (page header) to change out a graphic depending on the url of the page. I’m using global variables defined in my path.php file as per the following snippet.
$segs = explode("/", $_SERVER['PATH_INFO']);
$global_vars = array(
"seg_1" => $segs[1],
"seg_2" => $segs[2],
"seg_3" => $segs[3],
"seg_4" => $segs[4],
"seg_5" => $segs[5],
"seg_6" => $segs[6],
"seg_7" => $segs[7],
"seg_8" => $segs[8],
"seg_9" => $segs[9]
);Does the php hack below (which seems to be working - “crosses fingers” ) check out in terms of safe php syntax, proper use of quotation marks and such? Is there a cleaner/smarter way to handle it? I’m using the input class function…
<?php
global $IN;
if ($IN->global_vars['seg_3'] == "profile")
{ echo 'http://www.creducation.org/themes/forum_themes/developer/images/forumprofilelogo.gif';
} elseif ($IN->global_vars['seg_4'] == "profile")
{ echo 'http://www.creducation.org/themes/forum_themes/developer/images/forumprofilelogo.gif';
}
elseif ($IN->global_vars['seg_3'] == "register")
{ echo 'http://www.creducation.org/themes/forum_themes/developer/images/forumregisterlogo.gif';
}
elseif ($IN->global_vars['seg_3'] == "login")
{ echo 'http://www.creducation.org/themes/forum_themes/developer/images/forumloginlogo.gif';
}
else { echo '<a href="http://www.creducation.org/cre/forum/" title="CRE Forums">http://www.creducation.org/themes/forum_themes/developer/images/forumlogo.gif</a>';
}
?>A related question I’m also working through has to do with problems with “page not found errors” after people login or register to the site using my forum templates. Any advice on how to fix this would be welcomed as well. I’m not sure if the “return=” parameter is workable within my forum templates. Adding it did not seem to remedy the problem
I’m running ExpressionEngine 1.6.0 Build: 20070621
Thanks in advance…