SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trouble adding story with CMS

    I tried following this tutorial which is about creating a CMS and the only thing that doesn't work for me is the adding story part. When I try to add a story it doesn't display it and I have no idea why because I have primarily used the code that was provided. I really need help fast on this one because it has got to be finished today.

    editArticle.php:
    PHP Code:
    <?php include "templates/include/header.php" ?>
      
      <div id="adminHeader">
        <h2>Corvette Veterans' Admin</h2>
        <p>You are logged in as <b><?php echo htmlspecialchars$_SESSION['username']) ?></b>. <a href="admin.php?action=logout"?>Log out</a></p>
        </div>
      
      <h1><?php echo $results['pageTitle']?></h1>
      
      <form action="admin.php?action=<?php echo $results['formAction']?>" method="post">
        <input type="hidden" name="articleId" value="<?php echo $results['article']->id ?>"/>
        
      <?php if ( isset( $results['errorMessage'] ) ) { ?>
        <div class="errorMessage"><?php echo $results['errorMessage'?></div>
      <?php ?>
        
        <ul>
          
          <li>
            <label for="title">Story Title</label>
            <input type="text" name="title" id="title" placeholder="Name of the story" required autofocus maxlength="255" value="<?php echo htmlspecialchars$results['article']->title )?>" />
          </li>
          
          <li>
            <label for="summary">Story Summary</label>
            <textarea name="summary" id="summary" placeholder="Brief description of the story" required maxlength="1000" style="height: 5em;"><?php echo htmlspecialchars$results['article']->summary )?></textarea>
          </li>
          
          <li>
            <label for="content">Story Content</label>
            <textarea name="content" id="content" placeholder="The HTML content of the story" required maxlength="100000" style="height: 30em;"><?php echo htmlspecialchars$results['article']->content )?></textarea>
          </li>
          
          <li>
            <label for="publicationDate">Publication Date</label>
            <input type="date" name="publicationDate" id="publicationDate" placeholder="YYYY-MM-DD" required maxlength="10" value="<?php echo $results['article']->publicationDate date"Y-m-d"$results['article']->publicationDate ) : "" ?>" />
          </li>
          
          
        </ul>
        
        <div class="buttons">
          <input type="submit" name="saveChanges" value="Save Changes" />
          <input type="submit" formnovalidate name="cancel" value="Cancel" />
        </div>
        
        </form>
      
      <?php if ( $results['article']->id ) { ?>
      <p><a href="admin.php?action=deleteArticle&amp;articleId=<?php echo $results['article']->id ?>" onclick="return confirm('Delete This Article?')">Delete This Story</a></p>
      <?php ?>
      
      <?php include "templates/include/footer.php" ?>
    listArticles.php:
    PHP Code:
    <?php include "templates/include/header.php" ?>

          <div id="adminHeader">
            <h2>Corvette Veterans' Admin</h2>
            <p>You are logged in as <b><?php echo htmlspecialchars$_SESSION['username']) ?></b>. <a href="admin.php?action=logout"?>Log out</a></p>
          </div>

          <h1>All Stories</h1>

    <?php if ( isset( $results['errorMessage'] ) ) { ?>
            <div class="errorMessage"><?php echo $results['errorMessage'?></div>
    <?php ?>


    <?php if ( isset( $results['statusMessage'] ) ) { ?>
            <div class="statusMessage"><?php echo $results['statusMessage'?></div>
    <?php ?>

          <table>
            <tr>
              <th>Publication Date</th>
              <th>Story</th>
            </tr>

    <?php foreach ( $results['articles'] as $article ) { ?>

            <tr onclick="location='admin.php?action=editArticle&amp;articleId=<?php echo $article->id?>'">
              <td><?php echo date('j M Y'$article->publicationDate)?></td>
              <td>
                <?php echo $article->title?>
              </td>
            </tr>

    <?php ?>

          </table>

          <p><?php echo $results['totalRows']?> article<?php echo ( $results['totalRows'] != ) ? 's' '' ?> in total.</p>

          <p><a href="admin.php?action=newArticle">Add a New Story</a></p>

    <?php include "templates/include/footer.php" ?>

  2. #2
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't worry I fixed it.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •