/** * DBContent::connect() * create instace connection with database * @return object */ public static function connect() { // check if we connect with database before or not if (!isset(self::$_instace)) { // if not return new object self::$_instace = new DBContent(); } // if yes return this connection return self::$_instace; }
<?php require_once 'core/intit.php'; $link = new Link(); $db = DBContent::connect(); $allContent = $db->get('content'); ?> <!DOCTYPE html> <html dir="<?php getDir(); ?> "> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <meta charset="UTF-8"> <title><?php __('multilingual php library'); ?> </title> <link href="assets/css/bootstrap.css" type="text/css" rel="stylesheet"> <link href="assets/css/bootstrap.min.css" type="text/css" rel="stylesheet"> <link href="assets/css/heroic-features.css" type="text/css" rel="stylesheet"> <link href="assets/css/sweet-alert.css" type="text/css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->