thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

User page not displaying #56

Closed Dave-robinson closed 10 years ago

Dave-robinson commented 10 years ago

Any help would be appreciated. I've been following the YouTube video's and they are amazing ...

I am up to number 55 - creating a user management page and everything else works but when i click users in the admin menu the page only displays till the end of the navigation - no further.

I'm running WAMP and in in Apache log it says: PHP Parse error: syntax error, unexpected end of file in C:\wamp\www\AtomCMS\admin\views\users.php on line 72.

This is my users.php page:

<h1>Users</h1>

<div class="row">
<div class="col-sm-3 col-md-3">

            <div class="list-group"> 

                <a class="list-group-item" href="?page=users">
                    <i class="fa fa-plus"></i> New User</a>

            <?php
                  $q = "SELECT * FROM users ORDER BY last ASC";
                  $r = mysqli_query($dbc, $q);

                  while($list = mysqli_fetch_assoc($r)){ 

                  $list = data_user($dbc, $list['id']);     
                 //  $blurb = substr(strip_tags($list['body']), 0, 160);    

                 ?>

                  <a class="list-group-item <?php selected($list['id'], $opened['id'], 'active') ?>" href="?page=users&id=<?php echo $list['id']; ?>">
                  <h4 class="list-group-item-heading"><?php echo $list['fullname_reverse']; ?></h4>
                  <!--<p class="list-group-item-text"><?php echo $blurb; ?></p> -->
                  </a>

            <?php } ?>

</div>
</div>
<div class="col-sm-9 col-md-9">

    <?php if (isset($message)) { echo $message; }  ?>

    <form role="form" action="?page=users&id=<?php echo $opened['id']; ?>" method="post">

        <div class="form-group">
            <label for="first">First Name:</label>
            <input class="form-control" type="text" name="first" id="first" value ="<?php echo $opened['first'];  ?>" placeholder="First Title">
        </div>

        <div class="form-group">
            <label for="last">Last Name:</label>
            <input class="form-control" type="text" name="last" id="last" value ="<?php echo $opened['last'];  ?>" placeholder="Last Title">
        </div>

        <div class="form-group">
            <label for="status">Status:</label>
            <select class="form-control" name="status" id="status">

                <option value="0" <?php if(isset($_GET['id'])) {selected('0', $opened['status'], 'selected'); ?>>Inactive</option>
                <option value="1" <?php if(isset($_GET['id'])) {selected('1', $opened['status'], 'selected'); ?>>Active</option>

            </select>
        </div>

        <div class="form-group">
            <label for="password">Password:</label>
            <input class="form-control" type="text" name="password" id="password" value ="" placeholder="Password">
        </div>

    <button type="submit" class="btn btn-default">Save</button>
    <input type="hidden" name="submitted" value="1">    
    <input type="hidden" name="id" value="<?php echo $opened['id']; ?>">    

    </form>

</div>

----------------------------------------------------------End -------------------------------------------

I'm afraid i seem to be a slow learner at this but any help would be brilliant. Thanks for your time.

Dave-robinson commented 10 years ago

I worked out where i had gone wrong. As i suspected with pretty much all of my problems it was syntactical ! I was missing the " } " curly bracket thing from :

<option value="0" <?php if (isset($_GET['id'])) { selected('0', $opened['status'], 'selected'); } ?>>Inactive</option>
                <option value="1" <?php if (isset($_GET['id'])) { selected('1', $opened['status'], 'selected'); } ?>>Active</option>