Jump to content

cms error messages


cactus

Recommended Posts

Hi,

 

I am creating a cms using php and my sql for my website. I have managed to create the majority of it but am having trouble added a menu on each page.

 

It appears on the homepage with the following code:

 

      <ul id="headlines">

 

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

 

        <li>

          <h2>

<a href=".?action=viewArticle&articleId=<?php echo $article->id?>"><?php echo htmlspecialchars( $article->title )?></a>

          </h2>

        </li>

 

<?php } ?>

 

      </ul>

 

Once I click on a selection from the menu it takes me to the correct article but there is no menu now.

 

If I try to copy and paste the code from homepage into my viewArticle file it gives me the error messages 'undefined index articles on line 6' and 'invalid argument supplied for for each'.

 

This is the viewArticle code after I pasted in the code from homepage:

 

      <ul id="headlines">

 

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

 

        <li>

          <h2>

<a href=".?action=viewArticle&articleId=<?php echo $article->id?>"><?php echo htmlspecialchars( $article->title )?></a>

          </h2>

        </li>

 

<?php } ?>

 

      </ul>

 

      <h1 style="width: 75%;"><?php echo htmlspecialchars( $results['article']->title )?></h1>

      <div style="width: 75%;"><?php echo $results['article']->content?></div>

 

 

I would really appreciate anybody helping me figure out how I can add the menu onto the viewArticle page.

 

Thanks in advance :)

Link to comment
https://forums.phpfreaks.com/topic/230340-cms-error-messages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.