Пример #1
0
function generatePage($siteid, $pageid)
{
    $_SESSION['site'] = $siteid;
    $menu = getMenu($siteid);
    $db = Database::obtain();
    $sql = "SELECT * FROM " . TABLE_WEBSITES . "\n\t\t\t\t\tWHERE `id` =" . $siteid . "";
    $websitedata = $db->query_first($sql);
    $website_template = $websitedata['website_template'];
    $site_email = $websitedata['website_email'];
    $site_name = $websitedata['website_name'];
    $sql = "SELECT * FROM " . TABLE_PAGES . "\n\t\t\t\t\tWHERE `id` =" . $pageid . "";
    $page = $db->query_first($sql);
    $page_title = $page['page_title'];
    if (!isContactPage(0, $page_title)) {
        $content = $page['content'];
    } else {
        $content = contactPage($site_email, $site_name);
    }
    $base_template = 'templates/' . $website_template . '/main.php';
    $output_page = file($base_template);
    $target_content = '';
    foreach ($output_page as $id => $line) {
        if (strlen(strstr($line, 'WEBSITE_CONTENT')) > 0) {
            $target_content .= str_replace('WEBSITE_CONTENT', $content, $line);
        } elseif (strlen(strstr($line, 'WEBSITE_MENU')) > 0) {
            $website_menu = $menu;
            $menu_file = file('templates/' . $website_template . '/menu.php');
            $menu_page = '';
            $menu_page_string = '';
            foreach ($menu_file as $id => $mline) {
                $menu_page_string .= $mline;
            }
            foreach ($website_menu as $id => $menu_link) {
                if ($id == '0') {
                    $menu_link_page = $menu_link['title'];
                    $menulink = 'index.html';
                } else {
                    $menu_link_page = $menu_link['title'];
                    if (isContactPage(0, $menu_link['title'])) {
                        $menulink = underscoreAdd(strtolower($menu_link_page)) . '.php';
                    } else {
                        $menulink = underscoreAdd(strtolower($menu_link_page)) . '.html';
                    }
                }
                $menu_entry = str_replace('WEBSITE_MENU_ITEM_LINK', $menulink, $menu_page_string);
                $menu_page .= str_replace('WEBSITE_MENU_ITEM', $menu_link_page, $menu_entry);
            }
            $website_menu = $menu_page;
            $target_content .= str_replace('WEBSITE_MENU', $website_menu, $line);
        } else {
            $target_content .= replaceWebsiteValues($line, $siteid, $page_title);
        }
    }
    $target_content = fixFolderPaths($target_content);
    return $target_content;
}
Пример #2
0
            $page = "<h2><a href='" . $channel->link . "' target='_blank'>" . $channel->title . "</a></h2>";
            $page .= "<br />";
            // Feed items laten zien
            foreach ($feed->getItems() as $val) {
                $page .= "<p>";
                $page .= $val->title;
                $page .= "<br />";
                $page .= $val->description;
                $page .= "</p>";
            }
            break;
        case "educations":
            $page = educationsPage();
            break;
        case "contact":
            $page = contactPage();
            break;
        default:
            $top = true;
            $middle = true;
            $page = homePage();
            break;
    }
} else {
    $top = true;
    $middle = true;
    $page = homePage();
}
if ($top == true) {
    echo '<section class="top"><a href="https://app.studielink.nl/front-office/?brinCode=22EX" class="button">Direct aanmelden via Studielink</a></section>';
}