Jump to content

Recommended Posts

Posted

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";

}
Posted

oh yeah just one more thing is it possible to simply put .

!$page->page_name

page_name being the actual name of a page just like how i can point to the field name

Posted

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.

Posted

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?

Posted

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";
}
  • Like 4
Posted

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.

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
×
×
  • Create New...