2011/4/28

提交Blog(網站)到(博客)搜索引擎

博客內容充實以後,如果要讓普通網絡用戶或者搜索引擎知道你,在搜索引擎沒有主動抓取的情況下,就需要向搜索引擎提交你的網站。 當然,在提交網站之前,還得檢查網站一些基本的地方,如鏈接(對搜索引擎友好)、標籤(標題、Meta等)、Robots.txt電子商務博客蒐集整理了一些常用的搜索引擎登錄入口地址如下: 提交博客到博客搜索引擎:
提交到博客到博客推廣和聚合平台
提交博客、網站到網站搜索引擎
  • 1、提交博客(網站)到百度
  • 2、提交博客(網站)到Google
  • 3、提交博客(網站)到Alexa
  • 4、提交博客(網站)到雅虎
  • 5、提交博客(網站)到愛問
  • 6、提交博客(網站)到天網
  • 7、提交博客(網站)到搜狗
  • 8、提交博客(網站)到TOM
  • 9、提交博客(網站)到中搜
  • 10、提交博客(網站)到一搜
  • 11、提交博客(網站)到140個搜索引擎
提交博客、網站到英文搜索引擎
  • 1、提交博客(網站)到MSN Search(Live Search)
  • 2、提交博客(網站)到Yahoo Search(可以提交網頁或者Feeds,不過需要Yahoo ID登錄後才可以)
  • 3、提交博客(網站)到Google Search
  • 4、提交博客(網站)到Exactseek(需要註冊ID)
  • 5、提交博客(網站)到Jayde
  • 6、提交博客(網站)到ScrubtheWeb
  • 7、提交博客(網站)到Abacho
  • 8、提交博客(網站)到FoundYa
  • 9、提交博客(網站)到SearchUK

將你的博客Blog提交到搜索引擎baidu,google,yahoo等

怎樣讓更多的人都知道你的博客呢?這肯定就要靠自己大力宣傳提高博客的知名度了。

如果不把你的博客提交到各大搜索引擎中,它們一般是不會收錄你的博客的,你可以先嘗試一下看看能不能在百度搜到你的博客吧如果你搜不到的話說明你的博客還沒有被百度收錄,那麼怎麼才能被百度google等各大搜索引擎收錄你的博客呢?下面列出了國內七大比較知名的博客搜索引擎。

1. Google谷歌博客提交入口:http://blogsearch.google.com/ping?hl=zh-CN

2. Baidu百度博客提交入口:http://utility.baidu.com/blogsearch/submit.php

3. Yahoo雅虎博客提交入口:http://www.yahoo.cn/ex/blog_rss/rss_input.php

4. Sogou搜狗博客提交入口:http://www.sogou.com/feedback/blogfeedback.php

5. Sina新浪愛問博客提交入口:http://blog.iask.com/add_new_rss.php

6. 163有道博客提交入口:http://tellbot.yodao.com/report?type=BLOG&keyFrom=help

7. Qikoo奇虎博客提交入口:http://so.blog.qikoo.com/subrss.html

2010/11/25

免費下載將近 80 種 jQuery Menu 範例,Apycom

Apycom 的 jQuery Drop Down Menu,可以免費下載,條件是不得用於商業網站以及要加上 http://apycom.com 的連結。

大致上用到的效果是兩個 jQuery 的 plugins:lavalamp 和 easing,都已經包在下載下來的 menu.js 裡,也有範例的檔案,應該是很容易學習的,你也可以修改 css 成你要的樣式。

不過 lavalamp 跟 fancybox 會沖,所以我在 ZOG 是選擇沒用到 lavalamp 的 menu。

至於 back link,你可以加在任何一個地方,然後用 CSS 藏起來。
Apycom jQuery Menus

2010/10/22

jQuery UI-Datepicker

jQuery UI很強大,其中的日期選擇插件Datepicker是一個配置靈活的插件,我們可以自定義其展示方式,包括日期格式、語言、限制選擇日期範圍、添加相關按鈕以及其它導航等。

官方地址:http://docs.jquery.com/UI/Datepicker,官方示例: http://jqueryui.com/demos/datepicker/


一個不錯的地址,用來DIY jQuery UI界面效果的站點http://jqueryui.com/themeroller/

DatePicker基本使用方法:

<!DOCTYPE html>
<html>
<head>
  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>

  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

  <script>
  $(document).ready(function() {
    $("#datepicker").datepicker();
  });
  </script>

</head>
<body style="font-size:62.5%;">

<div type="text" id="datepicker"></div>

</body>
</html>

DatePicker支持鼠標點選日期,同時還可以通過鍵盤控制選擇:

page up/down - 上一月、下一月
ctrl+page up/down - 上一年、下一年
ctrl+home - 當前月或最後一次打開的日期
ctrl+left/right - 上一天、下一天
ctrl+up/down - 上一週、下一週
enter - 確定選擇日期
ctrl+end - 關閉並清除已選擇的日期
escape - 關閉並取消選擇

實用功能:

$.datepicker.setDefaults( settings ) - 全局設置日期選擇插件的參數.
$.datepicker.formatDate( format, date, settings ) - 格式化顯示的日期字符串
$.datepicker.iso8601Week( date ) - 給出一個日期,確實他是一年中的第幾週
$.datepicker.parseDate( format, value, settings ) - 按照指定格式獲取日期字符串

日期格式:

d - 每月的第幾天 (沒有前導零)
dd - 每月的第幾天 (兩位數字)
o - 一年中的第幾天 (沒有前導零)
oo - 一年中的第幾天 (三位數字)
D - day name short
DD - day name long
m - 月份 (沒有前導零)
mm - 月份 (兩位數字)
M - month name short
MM - month name long
y - 年份 (兩位數字)
yy - 年份 (四位數字)
@ - Unix 時間戳 (從 01/01/1970 開始)
'...' - 文本
'' - 單引號
(其它) - 文本

其它標準日期格式:

ATOM - 'yy-mm-dd' (Same as RFC 3339/ISO 8601)
COOKIE - 'D, dd M yy'
ISO_8601 - 'yy-mm-dd'
RFC_822 - 'D, d M y'
RFC_850 - 'DD, dd-M-y'
RFC_1036 - 'D, d M y
RFC_1123 - 'D, d M yy'
RFC_2822 - 'D, d M yy'
RSS - 'D, d M y'
TIMESTAMP - '@'
W3C - 'yy-mm-dd'

參數(參數名 : 參數類型 : 默認值)


altField : String : ''
  將選擇的日期同步到另一個域中,配合altFormat可以顯示不同格式的日期字符串。
  初始:$('.selector').datepicker({ altField: '#actualDate' });
  獲取:var altField = $('.selector').datepicker('option', 'altField');
  設置:$('.selector').datepicker('option', 'altField', '#actualDate');  

altFormat : String : ''
  當設置了altField的情況下,顯示在另一個域中的日期格式。
  初始:$('.selector').datepicker({ altFormat: 'yy-mm-dd' });
  獲取:var altFormat = $('.selector').datepicker('option', 'altFormat');
  設置:$('.selector').datepicker('option', 'altFormat', 'yy-mm-dd');  

appendText : String : ''
  在日期插件的所屬域後面添加指定的字符串。
  初始:$('.selector').datepicker({ appendText: '(yyyy-mm-dd)' });
  獲取:var appendText = $('.selector').datepicker('option', 'appendText');
  設置:$('.selector').datepicker('option', 'appendText', '(yyyy-mm-dd)');  

buttonImage : String : ''
  設置彈出按鈕的圖片,如果非空,則按鈕的文本將成為alt屬性,不直接顯示。
  初始:$('.selector').datepicker({ buttonImage: '/images/datepicker.gif' });
  獲取:var buttonImage = $('.selector').datepicker('option', 'buttonImage');
  設置:$('.selector').datepicker('option', 'buttonImage', '/images/datepicker.gif');  

buttonImageOnly : Boolean : false
  Set to true to place an image after the field to use as the trigger without it appearing on a button.
  初始:$('.selector').datepicker({ buttonImageOnly: true });
  獲取:var buttonImageOnly = $('.selector').datepicker('option', 'buttonImageOnly');
  設置:$('.selector').datepicker('option', 'buttonImageOnly', true);  

buttonText : String : '...'
  設置觸發按鈕的文本內容。
  初始:$('.selector').datepicker({ buttonText: 'Choose' });
  獲取:var buttonText = $('.selector').datepicker('option', 'buttonText');
  設置:$('.selector').datepicker('option', 'buttonText', 'Choose');  

changeMonth : Boolean : false
  設置允許通過下拉框列表選取月份。
  初始:$('.selector').datepicker({ changeMonth: true });
  獲取:var changeMonth = $('.selector').datepicker('option', 'changeMonth');
  設置:$('.selector').datepicker('option', 'changeMonth', true);  

changeYear : Boolean : false
  設置允許通過下拉框列表選取年份。
  初始:$('.selector').datepicker({ changeYear: true });
  獲取:var changeYear = $('.selector').datepicker('option', 'changeYear');
  設置:$('.selector').datepicker('option', 'changeYear', true);  

closeTextType: StringDefault: 'Done'
  設置關閉按鈕的文本內容,此按鈕需要通過showButtonPanel參數的設置才顯示。
  初始:$('.selector').datepicker({ closeText: 'X' });
  獲取:var closeText = $('.selector').datepicker('option', 'closeText');
  設置:$('.selector').datepicker('option', 'closeText', 'X');  

constrainInput : Boolean : true
  如果設置為true,則約束當前輸入的日期格式。
  初始:$('.selector').datepicker({ constrainInput: false });
  獲取:var constrainInput = $('.selector').datepicker('option', 'constrainInput');
  設置:$('.selector').datepicker('option', 'constrainInput', false);  

currentText : String : 'Today'
  設置當天按鈕的文本內容,此按鈕需要通過showButtonPanel參數的設置才顯示。
  初始:$('.selector').datepicker({ currentText: 'Now' });
  獲取:var currentText = $('.selector').datepicker('option', 'currentText');
  設置:$('.selector').datepicker('option', 'currentText', 'Now');  

dateFormat : String : 'mm/dd/yy'
  設置日期字符串的顯示格式。
  初始:$('.selector').datepicker({ dateFormat: 'yy-mm-dd' });
  獲取:var dateFormat = $('.selector').datepicker('option', 'dateFormat');
  設置:$('.selector').datepicker('option', 'dateFormat', 'yy-mm-dd');  

dayNames : Array : ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
  設置一星期中每天的名稱,從星期天開始。此內容用於dateFormat時顯示,以及日曆中當鼠標移至行頭時顯示。
  初始:$('.selector').datepicker({ dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'] });
  獲取:var dayNames = $('.selector').datepicker('option', 'dayNames');
  設置:$('.selector').datepicker('option', 'dayNames', ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi']);  

dayNamesMin : Array : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
  設置一星期中每天的縮語,從星期天開始,此內容用於dateFormat時顯示,以前日曆中的行頭顯示。
  初始:$('.selector').datepicker({ dayNamesMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'] });
  獲取:var dayNamesMin = $('.selector').datepicker('option', 'dayNamesMin');
  設置:$('.selector').datepicker('option', 'dayNamesMin', ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa']);  

dayNamesShort : Array : ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
  設置一星期中每天的縮語,從星期天開始,此內容用於dateFormat時顯示,以前日曆中的行頭顯示。
  初始:$('.selector').datepicker({ dayNamesShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'] });
  獲取:var dayNamesShort = $('.selector').datepicker('option', 'dayNamesShort');
  設置:$('.selector').datepicker('option', 'dayNamesShort', ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam']);  

defaultDate : Date, Number, String : null
  設置默認加載完後第一次顯示時選中的日期。可以是Date對象,或者是數字(從今天算起,例如+7),或者有效的字符串('y'代表年, 'm'代表月, 'w'代表周, 'd'代表日, 例如:'+1m +7d')。
  初始:$('.selector').datepicker({ defaultDate: +7 });
  獲取:var defaultDate = $('.selector').datepicker('option', 'defaultDate');
  設置:$('.selector').datepicker('option', 'defaultDate', +7);  

duration : String, Number : 'normal'
  設置日期控件展開動畫的顯示時間,可選是"slow", "normal", "fast",''代表立刻,數字代表毫秒數。
  初始:$('.selector').datepicker({ duration: 'slow' });
  獲取:var duration = $('.selector').datepicker('option', 'duration');
  設置:$('.selector').datepicker('option', 'duration', 'slow');  

firstDay : Number : 0
  設置一週中的第一天。星期天為0,星期一為1,以此類推。
  初始:$('.selector').datepicker({ firstDay: 1 });
  獲取:var firstDay = $('.selector').datepicker('option', 'firstDay');
  設置:$('.selector').datepicker('option', 'firstDay', 1);  

gotoCurrent : Boolean : false
  如果設置為true,則點擊當天按鈕時,將移至當前已選中的日期,而不是今天。
  初始:$('.selector').datepicker({ gotoCurrent: true });
  獲取:var gotoCurrent = $('.selector').datepicker('option', 'gotoCurrent');
  設置:$('.selector').datepicker('option', 'gotoCurrent', true);  

hideIfNoPrevNext : Boolean : false
  設置當沒有上一個/下一個可選擇的情況下,隱藏掉相應的按鈕。(默認為不可用)
  初始:$('.selector').datepicker({ hideIfNoPrevNext: true });
  獲取:var hideIfNoPrevNext = $('.selector').datepicker('option', 'hideIfNoPrevNext');
  設置:$('.selector').datepicker('option', 'hideIfNoPrevNext', true);  

isRTL : Boolean : false
  如果設置為true,則所有文字是從右自左。
  初始:$('.selector').datepicker({ isRTL: true });
  獲取:var isRTL = $('.selector').datepicker('option', 'isRTL');
  設置:$('.selector').datepicker('option', 'isRTL', true);  

maxDate : Date, Number, String : null
  設置一個最大的可選日期。可以是Date對象,或者是數字(從今天算起,例如+7),或者有效的字符串('y'代表年, 'm'代表月, 'w'代表周, 'd'代表日, 例如:'+1m +7d')。
  初始:$('.selector').datepicker({ maxDate: '+1m +1w' });
  獲取:var maxDate = $('.selector').datepicker('option', 'maxDate');
  設置:$('.selector').datepicker('option', 'maxDate', '+1m +1w');
       $('.selector').datepicker('option', 'maxDate', '12/25/2012');  

minDate : Date, Number, String : null
  設置一個最小的可選日期。可以是Date對象,或者是數字(從今天算起,例如+7),或者有效的字符串('y'代表年, 'm'代表月, 'w'代表周, 'd'代表日, 例如:'+1m +7d')。
  初始:$('.selector').datepicker({ minDate: new Date(2007, 1 - 1, 1) });
  獲取:var minDate = $('.selector').datepicker('option', 'minDate');
  設置:$('.selector').datepicker('option', 'minDate', new Date(2007, 1 - 1, 1));
       $('.selector').datepicker('option', 'minDate', '12/25/2012');  

monthNames : Array : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  設置所有月份的名稱。
  初始:$('.selector').datepicker({monthNames:['Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December']});
  獲取:var monthNames = $('.selector').datepicker('option', 'monthNames');
  設置:$('.selector').datepicker('option', 'monthNames', ['Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December']);  

monthNamesShort : Array : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  設置所有月份的縮寫。
  初始:$('.selector').datepicker({monthNamesShort:['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec']});
  獲取:var monthNamesShort = $('.selector').datepicker('option', 'monthNamesShort');
  設置:$('.selector').datepicker('option', 'monthNamesShort', ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec']);  

navigationAsDateFormat : Boolean : false
  如果設置為true,則formatDate函數將應用到 prevText,nextText和currentText的值中顯示,例如顯示為月份名稱。
  初始:$('.selector').datepicker({ navigationAsDateFormat: true });
  獲取:var navigationAsDateFormat = $('.selector').datepicker('option', 'navigationAsDateFormat');
  設置:$('.selector').datepicker('option', 'navigationAsDateFormat', true);  

nextText : String : 'Next'
  設置「下個月」鏈接的顯示文字。
  初始:$('.selector').datepicker({ nextText: 'Later' });
  獲取:var nextText = $('.selector').datepicker('option', 'nextText');
  設置:$('.selector').datepicker('option', 'nextText', 'Later');  

numberOfMonths : Number, Array : 1
  設置一次要顯示多少個月份。如果為整數則是顯示月份的數量,如果是數組,則是顯示的行與列的數量。
  初始:$('.selector').datepicker({ numberOfMonths: [2, 3] });
  獲取:var numberOfMonths = $('.selector').datepicker('option', 'numberOfMonths');
  設置:$('.selector').datepicker('option', 'numberOfMonths', [2, 3]);  

prevText : String : 'Prev'
  設置「上個月」鏈接的顯示文字。
  初始:$('.selector').datepicker({ prevText: 'Earlier' });
  獲取:var prevText = $('.selector').datepicker('option', 'prevText');
  設置:$('.selector').datepicker('option', 'prevText', 'Earlier');  

shortYearCutoff : String, Number : '+10'
  設置截止年份的值。如果是(0-99)的數字則以當前年份開始算起,如果為字符串,則相應的轉為數字後再與當前年份相加。當超過截止年份時,則被認為是上個世紀。
  初始:$('.selector').datepicker({ shortYearCutoff: 50 });
  獲取:var shortYearCutoff = $('.selector').datepicker('option', 'shortYearCutoff');
  設置:$('.selector').datepicker('option', 'shortYearCutoff', 50);  

showAnim : String : 'show'
  設置顯示、隱藏日期插件的動畫的名稱。
  初始:$('.selector').datepicker({ showAnim: 'fold' });
  獲取:var showAnim = $('.selector').datepicker('option', 'showAnim');
  設置:$('.selector').datepicker('option', 'showAnim', 'fold');  

showButtonPanel : Boolean : false
  設置是否在面板上顯示相關的按鈕。
  初始:$('.selector').datepicker({ showButtonPanel: true });
  獲取:var showButtonPanel = $('.selector').datepicker('option', 'showButtonPanel');
  設置:$('.selector').datepicker('option', 'showButtonPanel', true);  

showCurrentAtPos : Number : 0
  設置當多月份顯示的情況下,當前月份顯示的位置。自頂部/左邊開始第x位。
  初始:$('.selector').datepicker({ showCurrentAtPos: 3 });
  獲取:var showCurrentAtPos = $('.selector').datepicker('option', 'showCurrentAtPos');
  設置:$('.selector').datepicker('option', 'showCurrentAtPos', 3);  

showMonthAfterYear : Boolean : false
  是否在面板的頭部年份後面顯示月份。
  初始:$('.selector').datepicker({ showMonthAfterYear: true });
  獲取:var showMonthAfterYear = $('.selector').datepicker('option', 'showMonthAfterYear');
  設置:$('.selector').datepicker('option', 'showMonthAfterYear', true);  

showOn : String : 'focus'
  設置什麼事件觸發顯示日期插件的面板,可選值:focus, button, both
  初始:$('.selector').datepicker({ showOn: 'both' });
  獲取:var showOn = $('.selector').datepicker('option', 'showOn');
  設置:$('.selector').datepicker('option', 'showOn', 'both');  

showOptions : Options : {}
  如果使用showAnim來顯示動畫效果的話,可以通過此參數來增加一些附加的參數設置。
  初始:$('.selector').datepicker({ showOptions: {direction: 'up' });
  獲取:var showOptions = $('.selector').datepicker('option', 'showOptions');
  設置:$('.selector').datepicker('option', 'showOptions', {direction: 'up');  

showOtherMonths : Boolean : false
  是否在當前面板顯示上、下兩個月的一些日期數(不可選)。
  初始:$('.selector').datepicker({ showOtherMonths: true });
  獲取:var showOtherMonths = $('.selector').datepicker('option', 'showOtherMonths');
  設置:$('.selector').datepicker('option', 'showOtherMonths', true);  

stepMonths : Number : 1
  當點擊上/下一月時,一次翻幾個月。
  初始:$('.selector').datepicker({ stepMonths: 3 });
  獲取:var stepMonths = $('.selector').datepicker('option', 'stepMonths');
  設置:$('.selector').datepicker('option', 'stepMonths', 3);  

yearRange : String : '-10:+10'
  控制年份的下拉列表中顯示的年份數量,可以是相對當前年(-nn:+nn),也可以是絕對值 (-nnnn:+nnnn)
  初始:$('.selector').datepicker({ yearRange: '2000:2010' });
  獲取:var yearRange = $('.selector').datepicker('option', 'yearRange');
  設置:$('.selector').datepicker('option', 'yearRange', '2000:2010');

事件

beforeShow : function(input)
  在日期控件顯示面板之前,觸發此事件,並返回當前觸發事件的控件的實例對象。
  初始:$('.selector').datepicker({ beforeShow: function(input) { ... } });  

beforeShowDay : function(date)
  在日期控件顯示面板之前,每個面板上的日期綁定時都觸發此事件,參數為觸發事件的日期。調用函數後,必須返回一個數組:[0]此日期是否可選(true/false),[1]此日期的CSS樣式名稱(""表示默認),[2]當鼠標移至上面出現一段提示的內容。
  初始:$('.selector').datepicker({ beforeShowDay: function(date) { ... } });  

onChangeMonthYear : function(year, month, inst)
  當年份或月份改變時觸發此事件,參數為改變後的年份月份和當前日期插件的實例。
  初始:$('.selector').datepicker({ onChangeMonthYear: function(year, month, inst) { ... } });  

onClose : function(dateText, inst)
  當日期面板關閉後觸發此事件(無論是否有選擇日期),參數為選擇的日期和當前日期插件的實例。
  初始:$('.selector').datepicker({ onClose: function(dateText, inst) { ... } });  

onSelect : function(dateText, inst)
  當在日期面板選中一個日期後觸發此事件,參數為選擇的日期和當前日期插件的實例。
  $('.selector').datepicker({ onSelect: function(dateText, inst) { ... } });

方法:

destory
  從元素中移除拖拽功能。
  用法:.datepicker( 'destroy' )  

disable
  禁用元素的拖拽功能。
  用法:.datepicker( 'disable' )  

enable
  啟用元素的拖拽功能。
  用法:.datepicker( 'enable' )  

option
  獲取或設置元素的參數。
  用法:.datepicker( 'option' , optionName , [value] )  

dialog
  在dialog插件中打開一個日期插件。
  用法:.datepicker( 'dialog' , dateText , [onSelect] , [settings] , [pos] )  

isDisabled
  確實日期插件是否已被禁用。
  用法:.datepicker( 'isDisabled' )  

hide
  隱藏(關閉)之前已經打開的日期面板。
  用法:.datepicker( 'hide' , [speed] )   

show
.datepicker( 'show' )
  顯示日期插件。
  用法:.datepicker( 'show' )  

getDate
  返回當前日期插件選擇的日期。
  用法:.datepicker( 'getDate' )  

setDate
  設置日期插件當前的日期。date參數可以是數字(從今天算起,例如+7),或者有效的字符串('y'代表年, 'm'代表月, 'w'代表周, 'd'代表日, 例如:'+1m +7d'),null表示當天。
  用法:.datepicker( 'setDate' , date )

2010/9/22

smarty用法

在smarty可以使用{$variable|cat:"要合併的字串"}來將變數及字串合併。(在PHP要這樣使用-$variable . "要合併的字串")

其語法:{$variable|函數名稱:參數…}

主要函數說明:

capitalize 英文字首大寫
    {$variable|capitalize} 每個單字中若有非英文字母者不轉換
    {$variable|capitalize:true}

cat 字串合併
    {$variable|cat:"字串內容"}

count_characters算字串長度
    {$variable|count_characters} 不計算空白及標點符號。
    {$variable|count_characters:true}

count_paragraphs計算段落數
    {$variable|count_paragraphs}

count_sentences 計算句數
    {$variable|count_sentences}

count_words 計算單字數
    {$variable|count_words}

default 設定變數預設值
    {$variable|default:"字串內容"} 變數無內容時的預設值

date_format 轉換時間格式
    {$variable| date_format:"時間格式字串"} 設定時間的格式 (時間參數請參照官網)

string_format 轉換數字格式
    {$variable|string_format:"%.2f"} 傳回小數點兩位
    {$variable|string_format:"%d"} 傳回整數

escape將字串轉換成編碼
    {$variable|escape} 預設為參數"html"
    {$variable|escape:"html"} 將 & " ' < > 等字元轉換為編碼
    {$variable|escape:"htmlall"} 轉換所有的html
    {$variable|escape:"url"} 轉換成url編碼
    {$variable|escape:"quotes"} 轉換引號
    {$variable|escape:"hex"} 轉換16進位(網址)
    {$variable|escape:"hexentity"} 轉換16進位(字串)

upper轉成大寫
    {$variable|upper}

lower 轉成小寫
    {$variable|lower}

nl2br 將換行字元取代html的
    {$variable|nl2br}

replace 取代字串
    {$variable|replace:"被取代的字串":"取代成的字串"}

regex_replace 使用正規式取代字串

    {$variable|replace:"正規式":"取代成的字串"}

truncate 裁切字串
    {$variable|truncate} 預設長度為前80字元
    {$variable|truncate:數字} 自訂裁切的長度,預設的字串結尾為"..."
    {$variable|truncate:數字:"字串"} 自訂結尾的字串
    {$variable|truncate:數字:"字串":true} 長度計算包含結尾字串的長度

spacify 在字串的每個字元間插入空白
{$variable|spacify} 在每個字元之間插入一個空白
{$variable|spacify:"字串內容"} 在每個字元之間插入自訂的字串

strip 除去多餘的空白

    {$variable|strip} 除去多餘1個以上的空白
    {$variable|strip:"字串內容"} 將空白換成自訂的字串

strip_tags 除去html的標籤
    {$variable|strip_tags}

indent設定縮排
    {$variable|indent} 預設的縮排為四格空白
    {$variable|indent:數目} 縮排格空白數
    {$variableindent:數目:"字串內容"} 自訂縮排的字串(非空白)

wordwrap 設定文字邊界
    {$variable|wordwrap:長度} 設定每行文字的字數
    {$variable|wordwrap:長度:"換行字串"} 設定換行結尾的字串
    {$variable|wordwrap:長度:"換行字串":true} 長度計算不包含換行的字串