これは、ブラウザゲームで使用するコードです。表現は少し変更されていますが、コード自体はうまく機能しています。すべてのphpコードは、「print」を使用した「if」ステートメント内に配置できます。
///---Various Navigation & Functions Depending on Current Page---///
$findpage = strrpos($_SERVER['PHP_SELF'],'/');
$currentpage = substr($_SERVER['PHP_SELF'],$findpage);
if ($currentpage == '/home.php'){
print "This message is displayed when the client is on the 'home' page.";
print "If you so chose, you can put the entire 'home' page code in here.";
print "While keeping this the only code being executed.";}
if ($currentpage == '/features.php'){
print "This message is displayed when the client is on the 'features' page.";
print "If you so chose, you can put the entire 'features' page code in here.";
print "While keeping this the only code being executed.";}
if ($currentpage == '/menu.php'){
print "This message is displayed when the client is on the 'menu' page.";
print "If you so chose, you can put the entire 'menu' page code in here.";
print "While keeping this the only code being executed.";}
if ($currentpage == '/store.php'){
print "This message is displayed when the client is on the 'store' page.";
print "If you so choose, you can put the entire 'store' page code in here.";
print "While keeping this the only code being executed.";}