Johan Broddfelt
/* Comments on code */

Administration pages

We now have pages like post list and post item. We also have pages for subscribers, mail, comments and users that we might want to get a better overview of. And as we extend the system with new functionallity we want to be able to access those views without having to type the url every time. So we start by rewriting the login page, so that it redirect you when you login.

// Add table topic
<?php// views/user/login.php
    if ($ad->user->id > 0) {
        switch ($ad->user->status) {
            case 1: Http::redirect('./');
            case 2: Http::redirect('./');
            case 3: Http::redirect('/menu-admin');
        }
...

Let's also make sure that admin-menu link is shown in our menu.

// views/start/menu.php
                <?php if ($ad->user->status > 2) { ?>
                <a href="menu-admin"><span class="typcn typcn-key"></span> Admin</a>
                <?php } ?>

And now we can fill some links into our menu.

// views/admin/menu.php
        <nav id="sub_menu_post">
            <div id="" class="large_menu">
                <a href="index.php?module=post&view=list"><span class="typcn typcn-clipboard"></span> Posts</a>
                <a href="index.php?module=comment&view=list"><span class="typcn typcn-pen"></span> Comments</a>
                <a href="index.php?module=subscription&view=list"><span class="typcn typcn-mail"></span> Followers</a>
                <a href="index.php?module=unit&view=test"><span class="typcn typcn-puzzle"></span> Unittest</a>
                <a href="index.php?module=settings&view=list"><span class="typcn typcn-weather-snow"></span> Settings</a>
            </div>
        </nav>

Now we can add all the links we want to all sub views we like. I only added some of the ones we have created so far.

- Framework, PHP, Menu

Follow using RSS

<< Topics to categorize posts Image and video in posts >>

Comment

Name
Mail (Not public)
Send mail uppdates on new comments
2 comments
2022-11-06 17:28:50 - Hegemon
2022-11-06 17:27:56 - Hegemon