PHP if / else条件

I'm using Perch CMS and I'd like to try and minimise the number of templates I've used.

I'd like to be able to show and hide sidebar content depending on which page is being viewed.

Let's say my sidebar has three modules:

Module-A
Module-B
Module-C

and I have three pages

/home
/about
/blog

I think I need to write a 'else if' statement, how would I write the following in PHP?

If on home page show Module-A
If on about page show Module-B
If on any other page show all Modules

Do you know that a lot of little and easy to use CMS are free and open source ?

I don't know how you must include your modules, but to filter you can use switch (better than elseif)

switch($page){
  case '/home':
  include(Module-A);
  break;

  case '/about':
  include(Module-B);
  break;

  case '/blog':
  include(Module-C);
  break;
}

This isn't a proper answer, as I don't know how Perch works, but this should give you the general idea of how conditional statements work.

$page = ''; // Page name here, I don't know how you set that in Perch

if($page == 'home_page'){
    echo $modulea;
}elseif($page == 'about'){
    echo $moduleb;
}else{
    echo $modulea . $moduleb . $modulec;
}
currentpage->assign('basename',basename($_SERVER['SCRIPT_URI']));

then do if statements based on the contents of that string, however your page is set up