일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 그누보드
- mysql
- 설정
- CI3
- php
- function
- 헬퍼
- 웹 프로그래밍
- phpDocumentor
- 옵션표
- jquery
- 영카트
- MSsql
- rairen
- 라이렌
- html
- ajax
- 안드로이드
- Database
- 코드이그나이터
- FCM
- jw player
- CodeIgniter
- 함수
- 후크
- config
- API
- javascript
- codeigniter3
- APK
Archives
- Today
- Total
프로그램 개발서
[코드이그나이터] Custom Helper 모음 v0.1 본문
/**
* @Version 0.1
* @last 2020.05.20
* @Author Rairen
*/
if ( ! function_exists('view_load'))
{
/**
* @param $views_path String views 폴더 내 경로
* @param $data mixed load되는 파일에서 쓸 데이터
*/
function view_load($views_path, $data = NULL)
{
$CI =& get_instance();
$CI->load->view($views_path, $data);
}
}
if ( ! function_exists('add_stylesheet'))
{
/**
* 스타일시트 추가
*
* @param String|array $stylesheet 스타일시트태그(<link href=""/>)
* @param Int $order 출력순번
*/
function add_stylesheet($stylesheet, $order)
{
$ci_object =& get_instance();
$links = $ci_object->config->item('links');
$is_merge = TRUE;
if (is_array($stylesheet))
{
for ($i = 0; $i < count($stylesheet); $i++)
{
foreach ($links as $link)
{
if ($link[1] == $stylesheet[$i])
{
$is_merge = FALSE;
break;
}
}
if ($is_merge)
{
$links[] = array($order, $stylesheet[$i]);
}
}
$ci_object->config->set_item('links', $links);
} else
{
foreach ($links as $link)
{
if ($link[1] == $stylesheet)
{
$is_merge = FALSE;
break;
}
}
if ($is_merge)
{
$links[] = array($order, $stylesheet);
$ci_object->config->set_item('links', $links);
}
}
}
}
if ( ! function_exists('add_javascript'))
{
/**
* @param string|array $javascript 스크립트태그
* @param int $order
*/
function add_javascript($javascript, $order)
{
$ci_object =& get_instance();
$scripts = $ci_object->config->item('scripts');
$is_merge = TRUE;
if (is_array($javascript))
{
for ($i = 0; $i < count($javascript); $i++)
{
foreach ($scripts as $script)
{
if ($script[1] == $javascript[$i])
{
$is_merge = FALSE;
break;
}
}
if ($is_merge)
{
$scripts[] = array($order, $javascript[$i]);
$ci_object->config->set_item('scripts', $scripts);
}
}
} else
{
foreach ($scripts as $script)
{
if ($script[1] == $javascript)
{
$is_merge = FALSE;
break;
}
}
if ($is_merge)
{
$scripts[] = array($order, $javascript);
$ci_object->config->set_item('scripts', $scripts);
}
}
}
}
if ( ! function_exists('breadcrumbs'))
{
function breadcrumbs($breadcrumbs = array())
{
$breadcrumb_html = '';
if (is_array($breadcrumbs) and count($breadcrumbs) > 0)
{
foreach ($breadcrumbs as $key => $breadcrumb)
{
if ($breadcrumb['link'] == TRUE and (isset($breadcrumb['href']) and ! empty($breadcrumb['href'])))
{
$breadcrumb_html .= '<li><a href="' . $breadcrumb['href'] . '">' . $breadcrumb['name'] . '</a></li>';
} else
{
$breadcrumb_html .= '<li>' . $breadcrumb['name'] . '</li>';
}
}
return $breadcrumb_html;
} else
{
return $breadcrumb_html;
}
}
}
if ( ! function_exists('head_title'))
{
/**
* @param string $title 타이틀 명
*/
function head_title($title = '')
{
if (isset($title) and ! empty($title))
{
$CI =& get_instance();
$head_title = $CI->config->item('head_title');
$CI->config->set_item('head_title', $title . ' | ' . $head_title);
}
}
}
if ( ! function_exists('encrypt'))
{
/**
* @param string $password 비밀번호 문자열
* @param bool $raw_output 암호화 출력 형태 (binary|string)
* @param string $algorithm 암호화 알고리즘
* @return string 암호화 문자열
*/
function encrypt($password, $raw_output = FALSE, $algorithm = 'sha256')
{
return hash($algorithm, $password, $raw_output);
}
}
반응형
'Web' 카테고리의 다른 글
메타 태그 (0) | 2020.06.08 |
---|---|
[코드이그나이터] Custom Helper Function 모음 - Default (0) | 2020.05.29 |
[Jquery][CodeIgniter] 회원가입 관련 코드 모음. (0) | 2020.05.20 |
mysqldump utf8 덤프 한글 문제 (0) | 2020.04.28 |
[코드이그나이터] 개발,시험,운영 환경 구분하는 ENVIRONMENT 설정 (0) | 2020.03.06 |