• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI3 - having problem with News tutorial

#1
Hi everyone,

Im really excited about CI and hope to become good enough with it one day that I may contribute in some way.

Meantime, I was following along the New tutorial

(a) The link did not wrk -- it just stays on the same page
(b) The index file seems to have an error ...

The tutorial page says to code index.php as ...

<h2><?php echo $title; ?></h2>
<?php foreach ($news as $news_item): ?>
       <h3><?php echo $news_item['title']; ?></h3>
       <div class="main">
               <?php echo $news_item['text']; ?>
       </div>
       <p><a href="<?php echo site_url('news/'.$news_item['slug']); ?>">View article</a></p>
<?php endforeach; ?>




but I coded it ...

<h2><?php echo $title; ?></h2>
<?php foreach ($news as $news_item): ?>
        <h3><?php echo $news_item['title']; ?></h3>    <div class="main">
        <?php echo $news_item['slug']; ?>
    </div>
    <p><a href="<?php echo site_url('news/'.$news_item['slug']); ?>">View</a>   
<?php endforeach; ?>

My reasoning is ...

The title of the news is to be displayed along with the slug below t (which is a brief summary).
Then... after the person clicks on the link, the text of the news will be displayed.

As it is taught, the title and the full text displays.

Please correct me if I am wrong.
I really want to learn CI and so I welcome all corrections and suggestions.

FINALLY ....


Except for that one line I indicated above, the link does not work.
Even if I leave that one line of code as indicated, the link still does not work ... t simply stays on the same line.

Any help will be appreciated.

Thank You in advance.
-------------------------------------------------
CI is the best framework for me - period
------------------------------------------------
Reply

#2
One thing at a time!! if you want to make changes to the tutorial then submit them separately.

otherwise if you are having a problem -- then focus and get right to the point with specifics.
saying the link does not work is not going to help you get an answer. edit this post down to what your problem is -- what kind of error do you get?
what is displayed when you echo out $news_item['slug']) ?
Reply

#3
Hi again,

Here are the specific issues I ran into:

()it displays news Title and New Text with link to read more (it should be title an slug)

()the read more link does nothing, it stays on same page (without reloading)

these issues I would like to resolve before moving forward.

Thank you in advance (and thanks for the posting tip)
-------------------------------------------------
CI is the best framework for me - period
------------------------------------------------
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.