Changeset 16333
- Timestamp:
- 2007/10/08 22:49:32 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-templates/data/class/SC_View.php
r16325 r16333 20 20 /** »ÈÍѤ·¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Ñ¥Ã¥±¡¼¥¸Ì¾ */ 21 21 var $tplName; 22 /** display¤¹¤ëtpl¥Õ¥¡¥¤¥ë̾ */ 23 var $template; 22 24 23 25 /** … … 77 79 $this->_smarty->register_function("sfIsHTTPS","sfIsHTTPS"); 78 80 $this->_smarty->default_modifiers = array('script_escape'); 79 $this->_smarty->force_compile = true;81 $this->_smarty->force_compile = DEBUG_MODE; 80 82 } 81 83 … … 154 156 */ 155 157 function display($template, $display = false) { 158 $this->template = $template; 159 156 160 // ¥Æ¥ó¥×¥ì¡¼¥ÈÀÚ¤êÂؤ¨½èÍý 157 $this->init Display($template);161 $this->initTemplate(); 158 162 159 163 // ¥°¥í¡¼¥Ð¥ë¥¨¥é¡¼¤Îɽ¼¨ … … 161 165 162 166 // ²èÌÌɽ¼¨ 163 $this->_smarty->display($t emplate);167 $this->_smarty->display($this->template); 164 168 165 169 // ¥Ù¥ó¥Á¥Þ¡¼¥¯·ë²Ì¤Îɽ¼¨ … … 171 175 * ¼ÂÁõ¤Ï»Ò¥¯¥é¥¹¤Ç¹Ô¤¦. 172 176 */ 173 function init Display($template) {}177 function initTemplate() {} 174 178 175 179 /** … … 276 280 } 277 281 278 function init Display($template) {282 function initTemplate() { 279 283 // ¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍѤ·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ïreturn 280 284 if (empty($this->tplName)) return; 281 285 286 // ¸½ºß»ÈÍѤ·¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹ 287 // ***/html/user_data/tpl_packages/***/templates/ 288 $template_dir = TPL_PKG_PATH . $this->tplName . '/templates/'; 289 // FIXME ¤³¤³¤Ë¥â¥Ð¥¤¥ëÍѽèÍý¤ò¶´¤ß¤¿¤¯¤Ê¤¤... 290 if ($this->_smarty->template_dir == MOBILE_TEMPLATE_DIR) { 291 $template_dir .= 'mobile/'; 292 } 293 282 294 /** 295 * tpl_mainpage¤Î¥Æ¥ó¥×¥ì¡¼¥ÈŬ±þ½èÍý 296 * 283 297 * tpl_mainpage¤¬ÁêÂХѥ¹¤Ç¤¢¤ì¤Ð 284 298 * ¥æ¡¼¥¶¡¼¥Æ¥ó¥×¥ì¡¼¥È¤Ø¤ÎÀäÂХѥ¹¤ËÊѹ¹¤· … … 286 300 */ 287 301 $tpl_mainpage = $this->_smarty->get_template_vars('tpl_mainpage'); 288 $template_dir = TPL_PKG_PATH . $this->tplName . '/templates/';289 302 290 303 $win = "^[a-zA-Z]{1}:"; 291 304 $other = "^\/"; 292 305 $pattern = "/($win)|($other)/"; 293 if (!preg_match($pattern, $tpl_mainpage)) { 306 307 if (!is_null($tpl_mainpage) && !preg_match($pattern, $tpl_mainpage)) { 294 308 $tpl_pkg_mainpage = $template_dir . $tpl_mainpage; 295 309 if (file_exists($tpl_pkg_mainpage)) { … … 297 311 } 298 312 } 313 314 // site_frame.tpl¤Î¥Æ¥ó¥×¥ì¡¼¥ÈŬÍѽèÍý 315 if ($this->template == SITE_FRAME) { 316 if(file_exists($template_dir . SITE_FRAME)) { 317 $this->template = $template_dir . SITE_FRAME; 318 } 319 // $this->template¤¬SITE_FRAME¤Ç¤Ê¤¤¾ì¹ç 320 // $objView->display($objPage->tpl_mainpage)¤Ê¤É 321 } else { 322 if(file_exists($template_dir . $this->template)) { 323 $this->template = $template_dir . $this->template; 324 } 325 } 326 327 // site_main.tpl¤Î¥Æ¥ó¥×¥ì¡¼¥ÈŬ±þ½èÍý 299 328 $tpl_site_main = $template_dir . 'site_main.tpl'; 300 329 if (file_exists($tpl_site_main)) { … … 302 331 } 303 332 } 304 } 333 334 function fetch($template) { 335 $this->template = $template; 336 $this->initTemplate(); 337 return $this->_smarty->fetch($this->template); 338 } 339 } 340 305 341 class SC_UserView extends SC_SiteView{ 306 342 function SC_UserView($template_dir, $compile_dir = COMPILE_DIR) { … … 321 357 $this->_smarty->compile_dir = $compile_dir; 322 358 } 359 // SC_View::getTemplateName()¤ÎDB¥¢¥¯¥»¥¹½èÍý¤ò¹Ô¤ï¤Ê¤¤¤è¤¦¤Ë¥ª¡¼¥Ð¡¼¥é¥¤¥É 323 360 function getTemplateName() {} 324 361 } … … 331 368 } 332 369 } 333 334 370 ?>
Note: See TracChangeset
for help on using the changeset viewer.