Jump to content

[SOVLED] how do i execute code if page has no children


picarica
 Share

Recommended Posts

so i have very dirty setup, i want to use one template for all pages except homepage

so far i have it like this

    if ($page->title == 'Kontakt') {
        echo "iframe of map goes here";
    } elseif ($pages->count("parent.title=galeria1 kontakt realizacia ")) {
// do some code please
} elseif ()

and so one like 3-4 conditions, and i tried what is already in there using the parent.title function but i dont think i understand it. it doesnt show the code when the page i already am doesnt have any more children.

what i am trying to do is to have

execute code when you have children

execute code when you dont have any children (this is so called individiual product page for me)

execute some code for pages like contact gallery individual stuff, this could be done using title or ID right now i have it like

$page->id != 1028 xor $page->id != 1077 xor $page->id != 1084

 

is this somehow possible ? one template, all have same field, i am even using repeaters which is totally new for me

sorry for my faulty english i am not a native speaker

Link to comment
Share on other sites

11 minutes ago, huseyin said:

Hello,

if i understand right, this should solve your problem;

if($page->hasChildren()) { // code for page with children } else { // code for page without children }

oh yeah yo u are right i tried finding difficult solution to a simple problem sorry ill mark this as solved

  • Like 1
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...