Part of the EllisLab Network
   
 
Yet another Blog tutorial question
Posted: 15 August 2007 08:17 AM   [ Ignore ]  
Summer Student
Total Posts:  4
Joined  08-14-2007

hi all,

re. the video tutorial

having searched the forum extensively !, my output consists of 4 lines, literally ______________________
______________________
______________________
______________________

I have 4 records in my entries table.

It seems to be nearly working, but instead of passing the actual posts it is outputting these lines....

CONTROLLER

<?php
class blog extends Controller {

function blog()
{
parent::Controller();
$this->load->database();

}

function index()
{
$data['title'] = "My Blog Hell";
$data['heading'] = "Load of Blog";
$data['query'] = $this->db->get('entries');

$this->load->view('blog_view', $data);
}
}
?>

VIEW:

<html>
<head>
<title><?php echo $title; ?></title>

</head>
<body>
<h1><?php echo $heading; ?></h1>

<?php foreach($query->result() as $row): ?>

<h3><?php $row->title ?></h3>
<p><?php $row->body ?></p>

<hr>

<?php endforeach;?>

</body>
</html>

any pointers grafully appreciated.

Profile
 
 
Posted: 15 August 2007 08:54 AM   [ Ignore ]   [ # 1 ]  
Grad Student
Rank
Total Posts:  84
Joined  07-24-2007

Change

<h3><?php $row->title ?></h3>
<
p><?php $row->body ?></p>

to

<h3><?php echo $row->title; ?></h3>
<
p><?php echo $row->body; ?></p>

or if you want to use the shortened syntax

<h3><?=$row->title?></h3>
<
p><?=$row->body?></p>

Profile
 
 
Posted: 15 August 2007 08:56 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  119
Joined  04-05-2007

<h3><?php $row->title ?></h3>
<
p><?php $row->body ?></p>

is the problem, your not echoing anything.

The lines are the hrs

<h3><?=$row->title;?></h3>
<
p><?=$row->body;?></p>

or

<h3><?php echo $row->title; ?></h3>
<
p><?php echo $row->body; ?></p>

They mean the same thing <?= is the short way of writing <?php echo

Edit deviant beat me to it…

Profile
 
 
Posted: 15 August 2007 09:08 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  4
Joined  08-14-2007

Thanks, guys.

i AM willing to look stupid in order to learn this thing ;>

POC

Profile
 
 
Posted: 16 August 2007 09:17 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  2
Joined  07-15-2007

One of the things I love about the CI community is that there is no such thing as a stupid or silly question. Everyone is willing to extend a helping hand to those who need it. grin

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 61058 Total Logged-in Users: 20
Total Topics: 73867 Total Anonymous Users: 0
Total Replies: 398461 Total Guests: 340
Total Posts: 472328    
Members ( View Memberlist )
Newest Members:  tanjadebieSan2kakifemreSchottec2kmeenazterjinFuadgeorge_k_alliskhalidmhamood