Welcome Guest, Not a member yet? Register   Sign In
text helper
#1

[eluser]abbe01[/eluser]
Hi,
I am using text helper of CI. I have load the helper in my controllers.
But, once I use it for word wrap the row data form my database, it will come to this error message.
Quote:
Fatal error: Using $this when not in object context in C:\Inetpub\wwwroot\voxcms\system\helpers\text_helper.php on line 395
How to use the text_helper instead? I found that i m not able to use the text_helper while loading my db row data set.
below is my code, which I would like to word_wrap my $row->postcontent:
Code:
$post_count = $query->num_rows();
            $i = 0;
            if ($post_count > 0){
                foreach($query->result() as $row){
                    $postcontent = $row->postcontent;
                    //extract($posts[$i]);
                    $postcontent = word_wrap($postcontent, 6);
                    echo "<tr>\n";
                    echo "    <td>&lt;input type=\"checkbox\" name=\"tick$i\" value=\"$row-&gt;postid\" /></td>\n";
                    echo "    <td>$row->posttitle</td>\n";
                    echo "    <td>$postcontent</td>\n";
                    echo "    <td>&nbsp;</td>\n";
                    echo "    <td>$row->createdate</td>\n";
                    echo "    <td>$row->createdby</td>\n";
                    echo "    <td><a href=\"post.php?id=$row->postid\" id=\"imghref\"><img src=\"images/edit.gif\" title=\"edit\" /></a></td>";
                    echo "</tr>\n";
                    $i++;
                }
Hope anyone can point it out, how I am going to implete this.
Thanks.
#2

[eluser]Rick Jolly[/eluser]
I think you've found a bug in text_helper.php. That helper uses "\n" for newline characters throughout. For some reason on line 395 $this->newline is used. That makes no sense in a procedural function. I'd just change it to "\n".




Theme © iAndrew 2016 - Forum software by © MyBB