久久精品水蜜桃av综合天堂,久久精品丝袜高跟鞋,精品国产肉丝袜久久,国产一区二区三区色噜噜,黑人video粗暴亚裔

Jcow/開發(fā)

來自站長百科
跳轉(zhuǎn)至: 導(dǎo)航、? 搜索

Jcow | 安裝 | 入門使用 | 開發(fā)

Development API[ ]

  • section content(),section close()

這兩個(gè)函數(shù)主要是向用戶輸出內(nèi)容,用法是:

section_content($content=' '),section($title=' ')

section_content('content in section one')
section_content('Title of section one')
section_content('content in section two')
section_content('Title of section two')

上面代碼的產(chǎn)生的輸出效果如下:

Jcowapi1.gif

  • client()

用法:client($key=' ')

返回值:當(dāng)前會(huì)話者的關(guān)于字段key的值的具體信息

Key字段取值:id,page_id,email,username,fullname,avatar,gender,birthmonth,birthyear,location,var1~var7(自定義的會(huì)員個(gè)人資料中的字段),如果key的取值為空的話,前面各個(gè)取值將一起以一個(gè)數(shù)組輸出。

例子:section_content(
              client('fullname')
       );
  • t()

用法:t($str,$alt1=' ',$alt2=' ',$alt3=' ',$godb=0)

$str: 必須填寫的,是要顯示的字符串

$alt1: 可選的,第一個(gè)占位符

$alt2: 可選的,第二個(gè)占位符

$alt3: 可選的,第三個(gè)占位符

$godb: 可選的,取'真'則表示這一字符串將被輸入到數(shù)據(jù)庫

Example1:section_content(
                 t('hello world')
         );
         輸出:hello world
Example2: sectiom_content(
                 t('hello {1},Your username is:{2}',client('fullname'),client('username'))
         );
         如果某用戶的fullname是L,username是N的話,則輸出為:
           hello L,your username is:N
  • jcow_page_feed()

在jcow 個(gè)人資料頁面或者是社區(qū)頁面顯示streams/feeds

用法:jcow_page_feed($target_id,$args=array()) 返回值:stream ID

$target_id: 必選填寫的,目標(biāo)頁面的ID

$args["message"]: 必須填寫,訂閱信息,少于140字符

$args["link"]: 可選的,鏈接URL

$args["name"]: 可選的,鏈接的名字或者是標(biāo)題

$args["description"]: 可選的,鏈接的說明

$args["thumbs"]: 可選的,用逗號(hào)隔開的短的URL,最多可填寫三個(gè)

Example1: jcow_page_feed(user_page_id($user['id'],array('message'=>'logged in');
Example2:  jcow_page_feed($client['page']['id'],array('message'=>'logged in');
  • url()

用法:url($uri=,$name = ,$target=)

返回值:一個(gè)完全路徑的鏈接地址

$uri: 必須填寫,鏈接的URL

$name: 可選的,鏈接的標(biāo)題

$target: 可選的,目標(biāo)窗口,可取值有:_blank,_self,_top

Example1:  url('blogs');
          輸出:http://www.your_site_url/blogs
Example2: url('feed',t('news feed'));
          輸出:<a href="http://YOUR_SITE_URL/feed">news feed</a>
Example3: url(');
          輸出:<a href="

Hooks API[ ]

  • 怎樣開發(fā)Hooks

Hooks函數(shù)是寫在一個(gè)PHP文件里,文件名為YOUR_MODULE_NAME.hook.php,但是Hook文件并不是module組件所必須地

Example:
 modules/test/test.hook.php ,test組件里的hook_boot()函數(shù):
           function test_boot() {
	// do something here
	}
  • hook_boot()

某一訪問者會(huì)話開始時(shí)調(diào)用該方法,沒有返回值,也沒有參數(shù)

Example:
 modules/test/test.hook.php 中
          function test_boot() {
	// do something here
	}
  • hook_header

模板加載時(shí)調(diào)用該方法,返回值將被寫入hearder頂部,沒有參數(shù)

Example:
 function test_header() {
	// do something here
	return $content;
	}
  • hook_footer

模板加載時(shí)調(diào)用,返回值將被寫入footer底部,沒有參數(shù)

Example: 
 function test_footer() {
	// do something here
	return $content;
	}
  • hook_u_menu

向個(gè)人資料頁面添加表單菜單項(xiàng),沒有返回值,參數(shù)有:

&$tab_menu:目前個(gè)人資料頁面的表單菜單

$page: 個(gè)人資料頁面的數(shù)據(jù)

字段取值:

$tab_menu['name']: 必須填寫,菜單項(xiàng)的名稱

$tab_menu['type']: 必須填寫,值是:tab

$tab_menu['path']: 必須填寫,菜單項(xiàng)的鏈接

Example:
 function test_u_menu(&$tab_menu,$page) {
	    $tab_menu[] = array(
		'name'=>'Test',
		'type'=>'tab',
		'path'=>'test/profile/'.$page['id']
		);
            }
  • hook_page_menu()

向community頁面添加制表菜單項(xiàng),沒有返回值,參數(shù)、字段取值以及使用方法與上述的hook_u_menu()完全一樣。

  • hook_page_cache()

用來建立緩存機(jī)制,返回值將直接作用于緩存管理器,參數(shù):

$parr: 當(dāng)前的路徑數(shù)組

$page: 當(dāng)前的頁面編號(hào)(1,2,3...)

$client: 當(dāng)前的會(huì)話用戶

返回?cái)?shù)組中的字段:

key:頁面的唯一關(guān)鍵字

live:可選的,緩存的存在時(shí)間

Example:function test_page_cache($parr, $page = 1, $client=array()) {
	if ($parr[0] == 'home' && !$client['id']) {
		return array(
			'key'=>'cache_page_home',
			'live'=>2
			);
	}
 }

定制首頁[ ]

  • 訪客可看到的首頁

當(dāng)游客或者是沒有登錄的會(huì)員訪問你的站點(diǎn),將會(huì)看到如下頁面:

Jcowcustom home1.gif

你可以通過編輯/themes/當(dāng)前使用的主題文件夾/page.tpl.php文件來定制該頁面,例如可以定制顯示近期的相冊(cè)、博客、和視頻,近期登錄的會(huì)員等。

  • 會(huì)員首頁

當(dāng)會(huì)員登錄時(shí),將會(huì)看到類似于下面的頁面,通常稱為“Dashboard”,可以通過編輯"/applications/dashboard/dashboard.php"文件定制該頁面。

Jcowcustom home2.gif

主題制作[ ]

如果想定制或者是新制作一個(gè)主題的話,可以通過編輯下面兩個(gè)文件:

"your_theme_folder/page.tpl.php":包含了頁面的結(jié)構(gòu)布局顯示;

"your_theme_folder/page.css": 包含了頁面的主題及樣式

組件開發(fā)[ ]

操作步驟:

  • 新建一個(gè)文件夾:"/modules/testapp/"
  • 新建一個(gè)info文件:"/modules/testapp/testapp.info",示例代碼:
name = My Test Module
version = 1.0
description = this is my testing
  • 新建一個(gè)icon文件:"/modules/testapp/icon.png"(可選擇的)
  • 新建一個(gè)php文件:"/modules/testapp/testapp.php "(文件名必須與文件夾名相同),示例代碼:
<?php
 class testapp {
	function index() {
		section_content('Hello world!');
		section_close('Hello title');
	}
	function test() {
		section_content('Hello world2!');
		section_close('Hello title2');
	}
 }
 ?>
  • 新建一個(gè)Installation文件:"/modules/testapp/testapp.install.php" (Optional),示例代碼:
<?php
 function testapp_menu() {
	$items = array();
	$items['testapp'] = array(
		'name'=>'Test menu1',
		'type'=>'community'
	);
	$items['testapp/test'] = array(
		'name'=>'Test menu2',
		'type'=>'personal'
	);
	return $items;
 }
 ?>
  • 打開Admin Panel-->Modules,你將會(huì)看到"My Test Modules"顯示在組件列表中,選中它前面的復(fù)選框,點(diǎn)檢”update Modules“,你新建的組件即被啟用

參考來源[ ]

http://www.jcow.net/docs/