//================================= // Load in meta data script // // Load in the basic meta tags on first enter or if the page and/or subpage are not set. // If page and/or subpage are set: load in the meta tags of the page selected. //================================= function getMeta($con) { //Get the general meta tags. Always needed to build the page title $metaq = mysqli_fetch_assoc(mysqli_query($con, "SELECT * FROM general")); //Set a false query. Returns 0. Used in a check later in the script. $meta_dataq = mysqli_query($con, "SELECT 1 FROM dual WHERE false"); //Check if page isset if(isset($_GET['page']) && !empty($_GET['page'])) { //Check if subpage isset if(isset($_GET['subpage']) && !empty($_GET['subpage'])) { //Set query to get subpage meta tags $sql = "SELECT * FROM pages WHERE page_title='" . mysqli_real_escape_string($con, $_GET['subpage']) . "' AND bovenliggendID=(SELECT page_id FROM pages WHERE page_title='" . mysqli_real_escape_string($con, $_GET['page']) . "' LIMIT 1)"; } else { //Set query to get page meta tags $sql = "SELECT * FROM pages WHERE page_title='" . mysqli_real_escape_string($con, $_GET['page']) . "'"; } //Execute query $meta_dataq = mysqli_query($con, $sql); //<-- Overwrites the empty query executed in the start of the script. } //Check if the query has a result. If not and the empty query result is also not executed there will occur an error. if(mysqli_num_rows($meta_dataq) != 0) { //Fetch the query $meta = mysqli_fetch_assoc($meta_dataq); //Check if the page has its own title else set the GET value of page if(empty($meta['page_meta_title'])) { $title = $_GET['page']; } else { $title = $meta['page_meta_title']; } //Check if the page has a description else set the general description if(empty($meta['page_meta_description'])) { $desc = $metaq['general_meta_description']; } else { $desc = $meta['page_meta_description']; } //Check if the page has keywords else set the general keywords if(empty($meta['page_meta_keywords'])) { $keys = $metaq['general_meta_keywords']; } else { $keys = $meta['page_meta_keywords']; } //Show the meta tags ?>
De praktijk blijft gehuisvest binnen bedrijvengebouw Terra.