"/^[\w_\.-]*@[\w_-]*\.[\w_\.-]*[a-z]$/i"
Хелперы, как правило, хранятся в папке system/helpers. Так же вы можете создать папку с названием helpers внутри вашей папки application и хранить собственные хелперы там. CodeIgniter сначала будет искать хелпер в папке system/application/helpers. Если директория не существует, либо файла с таким названием не найдено, CI продолжит поиск в вашей папке system/helpers.
function fcke($value='',$name='FCKeditor1',$width='600px',$height='400px',$basePath='/fckeditor/')
{
include_once("fckeditor/fckeditor.php") ;
$oFCKeditor = new FCKeditor($name) ;
$oFCKeditor->BasePath = $basePath;
$oFCKeditor->Value = $value;
$oFCKeditor->Width = $width;
$oFCKeditor->Height = $height;
return $oFCKeditor->CreateHtml();
}
}
<?php echo fcke() ?>
$this->load->helper('form');
function declension($n,$string=array('день','дня','дней'))
{
$n = abs($n) % 100;
$n1 = $n % 10;
if ($n > 10 && $n < 20) return $string[2];
if ($n1 > 1 && $n1 < 5) return $string[1];
if ($n1 == 1) return $string[0];
return $string[2];
}
<?php
class Flash
{
private $container=array();
public function __construct()
{
if(isset($_SESSION['flash'])){
$this->container=$_SESSION['flash'];
$_SESSION['flash']='';
}
}
public function set($name,$value)
{
$_SESSION['flash'][$name]=$value;
}
public function get($name,$defaultvalue=null)
{
if(empty($this->container[$name])){
return $default_value;
} else {
return $this->container[$name];
}
}
}
?>