PEAK XOOPS - Re: syndicating events in englishin japanese

Re: syndicating events

List posts in the topic

normal Re: syndicating events

msg# 1.1
depth:
1
Previous post - Next post | Parent - Children.1 | Posted on 2004/12/10 18:11
GIJOE  ÀèǤ·³Áâ   Posts: 4110
hi joeblow.

It's quite easy to make RSS feeds.

eg) RSS of today's events
create piCal/todays_rss2.php
<?php

	include '../../mainfile.php';
	if (function_exists('mb_http_output')) {
		mb_http_output('pass');
	}
	header ('Content-Type:text/xml; charset=utf-8');

	// for "Duplicatable"
	$mydirname = basename( dirname( __FILE__ ) ) ;
	if( ! preg_match( '/^(\D+)(\d*)$/' , $mydirname , $regs ) ) echo ( "invalid dirname: " . htmlspecialchars( $mydirname ) ) ;
	$mydirnumber = $regs[2] === '' ? '' : intval( $regs[2] ) ;

	// 各種パスの設定
	$mod_path = XOOPS_ROOT_PATH."/modules/$mydirname" ;
	$mod_url = XOOPS_URL."/modules/$mydirname" ;

	// piCalクラスの定義
	require_once( "$mod_path/class/piCal.php" ) ;
	require_once( "$mod_path/class/piCal_xoops.php" ) ;

	// オブジェクトの生成
	$cal = new piCal_xoops( date( 'Y-n-j' ) , $xoopsConfig['language'] , true ) ;
	$cal->use_server_TZ = true ;

	// cid による影響を受けないようにする
	$cal->now_cid = 0 ;

	// 各プロパティの設定
	$cal->conn = $xoopsDB->conn ;	// 本来はprivateメンバなので将来的にはダメ
	include( "$mod_path/include/read_configs.php" ) ;
	$cal->base_url = $mod_url ;
	$cal->images_url = "$mod_url/images/$skin_folder" ;
	$cal->images_path = "$mod_path/images/$skin_folder" ;

	$block =& $cal->get_blockarray_date_event( "$mod_url/index.php" ) ;

echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<rss version=\"2.0\">
  <channel>
    <title>Today's event on ".xoops_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES))."</title>
    <link>$mod_url/</link>
    <description>".xoops_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES))."</description>
    <lastbuild>".formatTimestamp(time(),'rss')."</lastbuild>
    <webmaster>".$xoopsConfig['adminmail']."</webmaster>
    <editor>".$xoopsConfig['adminmail']."</editor>
    <category>Calendar</category>
    <generator>piCal for XOOPS</generator>
    <language>"._LANGCODE."</language>\n" ;

foreach( $block['events'] as $event ) {

	echo "
    <item>
      <title>{$event['start_desc']} ".xoops_utf8_encode($event['summary'])."</title>
      <link>$mod_url/?event_id={$event['id']}</link>
      <description>".xoops_utf8_encode($event['description'])."</description>
    </item>\n" ;

}

echo "
  </channel>
</rss>\n" ;

?>
Votes:1 Average:10.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!