excii
asked on
PHP - Does php have "Select case" like asp has?
Ok, this is how I have done this in ASP:
************************** ********** ********** ********** **
functions.asp
<%
SELECT CASE Request.Querystring("link" )
CASE "frontpage":
%><!--#include file="frontpage.asp"--><%
CASE "aboutme":
%><!--#include file="aboutme.asp"--><%
CASE Else:
%><!--#include file="frontpage.asp"--><%
End SELECT
%>
************************** ********** ********** ********** **
index.asp
<TABLE BORDER="1">
<TR>
<TD><A HREF="index.asp?link=front page">Fron tpage</A> <BR>
<A HREF="index.asp?link=about me">aboutm e</A> <BR></TD>
<TD><BR><!--#include file="functions.asp"--></T D>
</TR>
</TABLE>
************************** ********** ********** ********** **
So when I click the link "aboutme", in functions.asp the page will change to aboutme.asp
And whole site will not load again, only the center, the main thing where all stuff is.
All links and banners loads just once. Understand? Good.
Now do it on PHP.
Thanks
Regards, excii
**************************
functions.asp
<%
SELECT CASE Request.Querystring("link"
CASE "frontpage":
%><!--#include file="frontpage.asp"--><%
CASE "aboutme":
%><!--#include file="aboutme.asp"--><%
CASE Else:
%><!--#include file="frontpage.asp"--><%
End SELECT
%>
**************************
index.asp
<TABLE BORDER="1">
<TR>
<TD><A HREF="index.asp?link=front
<A HREF="index.asp?link=about
<TD><BR><!--#include file="functions.asp"--></T
</TR>
</TABLE>
**************************
So when I click the link "aboutme", in functions.asp the page will change to aboutme.asp
And whole site will not load again, only the center, the main thing where all stuff is.
All links and banners loads just once. Understand? Good.
Now do it on PHP.
Thanks
Regards, excii
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Question tidied as requested in https://www.experts-exchange.com/questions/20561679/Delete-remarks.html
Chmod
Community Support Moderator @Experts Exchange
Chmod
Community Support Moderator @Experts Exchange
ASKER
what is that "break;" meaning?
Via the Manual: Break ends execution of the current for, foreach while, do | while or switch structure. Break accepts an optional numeric argument which tells it how many nested enclosing structures are to be broken out of.
{
case 'frontpage':
?>frontpage<?
break;
case 'aboutme':
?>aboutme<?
break;
default:
?>other<?
break;
}