That should work if $articles is a Zend_Db_Table_Row object and "bodyText" is the name of the column.
You might want to be careful with substr() on HTML strings. There's a good chance you'll end up with broken HTML.
-Hector
On Wed, Dec 24, 2008 at 3:06 AM, Erdal YAZICIOGLU <erdal.yazicioglu@gmail.com> wrote:
Hello all,
I am trying to put up my personal blog site. I want to display title and an
instroduction to article and when user clicks on the Read More link, he will
get the whole story.
In bodytext I have some HTML tags to format my story. But when I try to
print them on the screen, if I use escape(), it escapes from the
htmlentities. I want to keep the format of my story.
The code that I am using is;
<?php foreach ($this->articles as $articles): ?>
<h1><a href="/article/view/id/<?php echo
$this->escape($articles->id);?>">
<?php echo
$this->escape($articles->title);?></a></h1>
<p><?php echo
$this->escape(substr($articles->bodytext,0,400));?> </p>
<p> <a href="">More</a></p>
<p class="comments align-right clear">
Author: <?php echo
$this->escape($articles->author);?>
<a href="">Comments()</a>
Puablished Date: <?php echo
$this->escape($articles->date_published);?>
</p>
<?php endforeach;?>
When I remove the escape function I am getting the following error;
Catchable fatal error: Object of class Zend_Db_Table_Row could not be
converted to string in
Is there way to keep the format?
Thanks in advance
Erdal YAZICIOGLU
Network Systems
Page Europa
A GENERAL DYNAMICS COMPANY
Via del Serafico, 200
00142 Rome - Italy
Office : +39 06 50395424
Mobile: +39 335 6155809
没有评论:
发表评论