The following warnings occurred: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
|
Test if page has children - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: Test if page has children (/showthread.php?tid=3127) |
Test if page has children - Cerulean - 2012-04-27 Can anyone suggest a PHP snippet that will test if the current page has children? My aim is to make a section of my template conditional on the page having children: if has children ...some content else ...some other content Thanks. Test if page has children - Cerulean - 2012-04-27 The below works, but would be interested to hear if there's a better way. I'm a PHP beginner. Code: <?php Test if page has children - Carlos - 2012-04-27 Code: <?php if (count(getChildren(return_page_slug())) > 0) { ?> (for GS 3.1+) Test if page has children - Cerulean - 2012-04-27 Thanks Carlos, that's tidier. Test if page has children - Carlos - 2012-04-27 Your way is also valid, I hadn't seen your post. :-) |