Link to home
Start Free TrialLog in
Avatar of excii
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=frontpage">Frontpage</A> <BR>
            <A HREF="index.asp?link=aboutme">aboutme</A> <BR></TD>

     <TD><BR><!--#include file="functions.asp"--></TD>
    </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

Avatar of wide_awake
wide_awake

switch($var)
{
case 'frontpage':
     ?>frontpage<?
     break;
case 'aboutme':
     ?>aboutme<?
     break;
default:
     ?>other<?
     break;
}
ASKER CERTIFIED SOLUTION
Avatar of Kriek
Kriek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Question tidied as requested in https://www.experts-exchange.com/questions/20561679/Delete-remarks.html

Chmod
Community Support Moderator @Experts Exchange
Avatar of excii

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.