diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 58a2981d2da..417484c2269 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -91,6 +91,18 @@ if (empty($action)) $action='preview'; $object=new Website($db); $objectpage=new WebsitePage($db); +$object->fetchAll(); // Init $object->records + +// If website not defined, we take first found +if (empty($website)) +{ + foreach($object->records as $key => $valwebsite) + { + $website=$valwebsite->ref; + break; + } +} + if ($website) { $res = $object->fetch(0, $website); @@ -262,7 +274,6 @@ if ($action != 'preview' && $action != 'editcontent') $style=' margin-bottom: 5p print '