Sorry, this page is only available in one language

gotochild

Suggested dropletname: gotochild

Published by: Dev4me

This droplet can be used to redirect the page to the first childpage.

Normally done using a menu_link, but sometimes it is hard to change an existing page to a menu_link.

global $database;
$shorturl = false;  // change to true when shorturl is used!

$link = $database->get_one("select link FROM `".TABLE_PREFIX."pages` WHERE `parent` = '".PAGE_ID."' ORDER BY POSITION LIMIT 1");
if($link) {
  if(!$shorturl) {
    header("Location: ". WB_URL . PAGES_DIRECTORY . $link . PAGE_EXTENSION );
  } else {
    header("Location: $link/");
  }
}
return true;
Example: [[gotochild]]

| Overview | Next droplet »