Jump to content

Out putting elements depending on page


Wafiq
 Share

Recommended Posts

Hi i am just trying to get to grips with processwire so i apologise for the newbie question.

Can i do this to prevent output from specified pages because its not working, i assume im doing it wrong.

if(!$page->id == 10){

   echo "blah blah blah";

}
Link to comment
Share on other sites

Once pw gets to this code there is for sure a page name. To say differently a page requires a name actually to even exist. It's the only one required apart from id. So let us know what you want to do and somebody will tell.

Link to comment
Share on other sites

basically i have an include that is in every page but a block in the include i don't want showing up in say 2 pages

if ($page->id !== 1001 || $page->id !== 1011){ 
echo"block"; 
} 

Now this is not working for both but will for one. why? is my php syntax wrong?

Link to comment
Share on other sites

No the syntax is right, just the logic is wrong and will never be both "false" it's a double or false trap.

Just use PW way

if (!$page->is("id=1001|1003")){
    echo "block";
}

Cool thanks Soma...

i hadn't seen this one whilst glancing over the API.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...