Welcome Guest, Not a member yet? Register   Sign In
global view function
#1

[eluser]ApranaxFortress[/eluser]
Hi, i have to use same function in my views. Is there any easy way to call my function from all views.

My sample view page
Code:
<div class="pagination">&lt;?=$pagination?&gt;</div>
<div class="clear"></div>
&lt;?php foreach($entries as $row => $custom_array): ?&gt;
<div class="grid_2 alpha" style="text-align:center;">
<img src="http://www.lipsum.com/images/lipsum05.gif"/>
</div>

<div class="grid_6 omega">
<strong>&lt;?=$custom_array->user?&gt;</strong><br>
<strong><a href="&lt;?=site_url(">id."/".replace_tr($custom_array->subject);?&gt;">&lt;?=$custom_array->subject?&gt;</a></strong>
<br /><br />
&lt;?=$custom_array->summary?&gt;<br />
<a href="&lt;?=site_url(">id;?&gt;">Edit</a><br />
</div>

<div class="clear"></div>
&lt;?php endforeach ?&gt;
<div class="pagination">&lt;?=$pagination?&gt;</div>


&lt;?php
//THE FUNCTION
function replace_tr($text) {
$text = trim($text);
$search = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü',' ');
$replace = array('C','c','G','g','i','I','O','o','S','s','U','u','_');
$new_text = str_replace($search,$replace,$text);
return $new_text;
}
?&gt;
#2

[eluser]Armchair Samurai[/eluser]
Make a helper or plugin and autoload it.
#3

[eluser]ApranaxFortress[/eluser]
Thank you Smile




Theme © iAndrew 2016 - Forum software by © MyBB