µ¶ÀÚÀûÀÎ Æ÷¸ËÀ» Á¦°øÇÏ°í ½ÍÀº, ȤÀº ¿ä¼Ò°¡ ÀÚµ¿ÀûÀ¸·Î ¼ÒÁ¤ÀÇ À̸§ °ø°£¿¡ ¹èÄ¡µÇ´Â µîÀÇ ¸ÚÁø ±â´ÉÀ» Ãß°¡ÇÏ°í ½ÍÀº, ±×·¸´Ù°í ÇßÀ»
°æ¿ì´Â Zend_Feed
Ŭ·¡½º¸¦ È®ÀåÇØ ´ëÀÀÇÕ´Ï´Ù.
ÀÌÇÏ¿¡ Atom ¿£Æ®¸® Ŭ·¡½º¸¦ È®ÀåÇÏ´Â ¿¹¸¦ ³ªÅ¸³À´Ï´Ù. ÀÌ Å¬·¡½º¿¡¼´Â, µ¶ÀÚÀûÀÎ À̸§ °ø°£ myns:
(À»)¸¦
»ç¿ëÇϰí ÀÖ½À´Ï´Ù. ¶Ç,registerNamespace()
ÇÏÁö¸¸ ÄÝ µÇ°í ÀÖ´Â °Í¿¡ ÁÖÀÇÇսôÙ.
ÀÌ Å¬·¡½ºÀÇ »ç¿ëÀÚ´Â, À̸§ °ø°£¿¡ µµÂøÇØ °ÆÁ¤ÇÒ Çʿ䰡 ¾ø¾îÁý´Ï´Ù.
·Ê 10.7. µ¶ÀÚÀûÀÎ À̸§ °ø°£À» »ç¿ëÇÑ Atom ¿£Æ®¸® Ŭ·¡½ºÀÇ È®Àå
<?php
/**
*
ÀÌ µ¶ÀÚ ¿£Æ®¸® Ŭ·¡½º´Â, ÀÚµ¿ÀûÀ¸·Î Çǵå URI
(À»)¸¦ ½Äº° (
¿É¼Ç)
ÇØ
*
À̸§ °ø°£À» Ãß°¡ÇÕ´Ï´Ù
*/
class MyEntry extends Zend_Feed_EntryAtom
{
public function __construct($uri = 'http://www.example.com/myfeed/',
$xml = null)
{
parent::__construct($uri, $xml);
Zend_Feed::registerNamespace('myns', 'http://www.example.com/myns/1.0');
}
public function __get($var)
{
switch ($var) {
case 'myUpdated':
// myUpdated
(À»)¸¦ myns:updated
(À¸)·Î º¯È¯ÇÕ´Ï´Ù
return parent::__get('myns:updated');
default:
return parent::__get($var);
}
}
public function __set($var, $value)
{
switch ($var) {
case 'myUpdated':
// myUpdated
(À»)¸¦ myns:updated
(À¸)·Î º¯È¯ÇÕ´Ï´Ù
parent::__set('myns:updated', $value);
break;
default:
parent::__set($var, $value);
}
}
}
?>
±×¸®°í ÀÌ Å¬·¡½º¸¦ »ç¿ëÇϸé, ÀνºÅϽº¸¦ ÀÛ¼ºÇÏÀÚ ¸¶ÀÚ myUpdated
ÇÁ·ÓÆÛƼ¸¦
¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.
<?php
$entry = new MyEntry();
$entry->myUpdated = '2005-04-19T15:30';
?>