Welcome Guest, Not a member yet? Register   Sign In
How to use a helper inside template parser?
#1

[eluser]cavi1905[/eluser]
Hello everybody!

I had used helpers inside a template parser but they didn't working.

My code:
Code:
{lyrics}
            <tr>
                <td class="title">&lt;?php echo anchor('lyrics/detail/{lyric_id}-'.url_title('{title_latin}','dash',TRUE),'{title}',array('title'=>'<b>{title}</b><br/>'.$this->lang->line('artist').': {artist_name}'))?&gt;</td>
                <td class="artist artistname">&lt;?php echo anchor('artist/detail/{artist_id}-'.url_title('{artist_name_latin}','dash',TRUE),'{artist_name}',array('title'=>$this->lang->line('artist2').': <b>{artist_name}</b>'))?&gt;</td>
                <td class="view">{view}</td>
                <td class="view">&lt;?=anchor('mp3/search/'.url_title('{title_latin}','dash',TRUE),img(array('src'=>'images/listening.png')),array('title'=>$this->lang->line('tip_listening')))?&gt;</td>
            </tr>
            <tr>
                <td class="lyric2" colspan=4>&lt;?=word_limiter('{content}',15);?&gt;</td>
            </tr>
            <tr>
                <td class="user username" colspan=4><i class="dim">&lt;?=$this->lang->line('userpost')?&gt;:</i> &lt;?=anchor('member/listsongsby/{user_id}-{username}','{username}')?&gt;
                |&nbsp;<i class="dim">&lt;?=$this->lang->line('category')?&gt;: </i>&lt;?=anchor('category/{category_id}-'.url_title('{cat_name_latin}','dash',TRUE),'{cat_name}')?&gt;
                </td>
            </tr>
            {/lyrics}

url_title(), word_limiter() aren't working but no errors...

Can everybody help me? Thanks!
#2

[eluser]kulldox[/eluser]
You actually should be able to use helper methods if that helper is loaded for the current object.
Is the URL helper ( for url_title()) and Text helper (for word_limiter()) loaded in your controller or in autoload.php?
#3

[eluser]cavi1905[/eluser]
Yes, they loaded in my controller... but they didn't working... Sad
#4

[eluser]kulldox[/eluser]
Strange.
I've just loaded the Text helper in one of my controllers and then tried to use the word_limiter() method in it's view, and it works.

Your problem is somewhere else.




Theme © iAndrew 2016 - Forum software by © MyBB