This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
if (typeof jQuery != 'undefined') { | |
alert('jQuery working!'); | |
} else { | |
alert('no jQuery, too bad...'); | |
} | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" class="numbersOnly" value="" /> | |
//And: | |
jQuery('.numbersOnly').keyup(function () { | |
this.value = this.value.replace(/[^0-9\.]/g,''); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//內部(同一頁) | |
onclick='$("#tabs").tabs( "select", "tabs-2" )' | |
//外部(不同頁) | |
http://www.cglandmark.net/demosite/?page_id=88#thethe-tabs-1-2 | |
//在網址的最後面,加上Tab的ID,例如#thethe-tabs-1-2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*使用PHP mail()寄送UTF-8編碼之電子郵件 | |
常遇到的問題是,「郵件標題」或「寄件者」是亂碼的問題 | |
主要的原因在於,電子郵件標準格式中, | |
表頭的部分不允許使用雙位元的文字, | |
所以,使用mb_encode_mimeheader()函式 | |
將雙位元文字編碼為單位元字串。 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// if you still want to use AR, | |
// you could pass a FALSE as third parameter of | |
// $this->db->where | |
// to avoid automatic escaping by CI: | |
$this->db->select('id,name') | |
->where('dr','1') | |
->where('end >=', 'CURDATE()', FALSE); | |
$query = $this->db->get('store'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function is_logged_in() { | |
// Get current CodeIgniter instance | |
$CI =& get_instance(); | |
// We need to use $CI->session instead of $this->session | |
$user = $CI->session->userdata('user_data'); | |
if (!isset($user)) { return false; } else { return true; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// controller | |
function do_upload() | |
{ | |
$config['upload_path'] = './uploads/'; | |
$config['allowed_types'] = 'gif|jpg|png'; | |
$config['max_size'] = '100'; | |
$config['max_width'] = '1024'; | |
$config['max_height'] = '768'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// | |
function __construct() | |
{ | |
parent::__construct(); | |
[...] | |
if (isset($_SERVER['HTTP_REFERER'])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$xml_file = file_get_contents(SITE_PATH . 'cms/data.php'); | |
//CURL | |
function url_get_contents ($Url) { | |
if (!function_exists('curl_init')){ | |
die('CURL is not installed!'); | |
} | |
$ch = curl_init(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*You could put a PHP script inside the template | |
and then have PHP itself do the rendering, | |
for example: | |
*/ | |
//template.html: | |
?> | |
<div clas="headr"></div> |