Changeset 5727 for extensions/PWG_Stuffs/include
- Timestamp:
- Apr 9, 2010, 12:26:04 AM (14 years ago)
- Location:
- extensions/PWG_Stuffs/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PWG_Stuffs/include/class.inc.php
r3609 r5727 95 95 $block['U_EDIT'] = PHPWG_ROOT_PATH.'admin.php?page=plugin&section='.STUFFS_DIR.'%2Fadmin%2Fadd_module.php&type='.$module['type'].'&edit='.$module['id']; 96 96 } 97 $block['TEMPLATE'] = realpath($this->get_template($module['type'].'.tpl'));97 $block['TEMPLATE'] = 'stuffs_'.$module['type'].'.tpl'; 98 98 $this->set_tpl_block($block, $module); 99 99 } … … 169 169 } 170 170 171 /* Return template for user template/theme*/ 172 function get_template($file) 173 { 174 global $user, $template; 175 176 $dir = STUFFS_PATH . 'template/'; 177 $theme_file = $dir.$user['template'].'/'.$user['theme'].'/'.$file; 178 $template_file = $dir.$user['template'].'/'.$file; 179 180 if (file_exists($theme_file)) 181 { 182 return $theme_file; 183 } 184 elseif (file_exists($template_file)) 185 { 186 return $template_file; 187 } 188 else 189 { 190 return $dir.$file; 191 } 171 static function prefilter_index_css($source, &$smarty) 172 { 173 $css = array( 174 '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}plugins/PWG_Stuffs/theme/stuffs_index.css">' 175 ); 176 177 foreach ($smarty->get_template_vars('themes') as $theme) 178 { 179 if (file_exists(PHPWG_THEMES_DIR.$theme['id'].'/stuffs_index.css')) 180 { 181 array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/'.$theme['id'].'/stuffs_index.css">'); 182 } 183 } 184 185 $source = str_replace("\n</head>", "\n".implode( "\n", $css )."\n</head>", $source); 186 187 return $source; 188 } 189 190 static function prefilter_picture_css($source, &$smarty) 191 { 192 $css = array( 193 '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}plugins/PWG_Stuffs/theme/stuffs_picture.css">' 194 ); 195 196 foreach ($smarty->get_template_vars('themes') as $theme) 197 { 198 if (file_exists(PHPWG_THEMES_DIR.$theme['id'].'/stuffs_picture.css')) 199 { 200 array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/'.$theme['id'].'/stuffs_picture.css">'); 201 } 202 } 203 204 if (!empty($css)) 205 { 206 $source = str_replace("\n</head>", "\n".implode( "\n", $css )."\n</head>", $source); 207 } 208 209 return $source; 192 210 } 193 211 } -
extensions/PWG_Stuffs/include/stuffs.inc.php
r4968 r5727 10 10 $stuffs = new stuffs(); 11 11 12 $template->set_filename('stuffs', realpath($stuffs->get_template('blocks.tpl'))); 12 $template->set_template_dir(STUFFS_PATH.'theme/template/'); 13 $template->set_filename('stuffs', 'stuffs_blocks.tpl'); 13 14 14 15 if (script_basename() == 'index') … … 16 17 $begin = 'PLUGIN_INDEX_CONTENT_BEFORE'; 17 18 $end = 'PLUGIN_INDEX_CONTENT_AFTER'; 18 $ css_file = 'index.css';19 $template->set_prefilter( 'header', array('stuffs', 'prefilter_index_css') ); 19 20 } 20 21 else … … 22 23 $begin = 'PLUGIN_PICTURE_BEFORE'; 23 24 $end = 'PLUGIN_PICTURE_AFTER'; 24 $ css_file = 'picture.css';25 $template->set_prefilter('header', array('stuffs', 'prefilter_picture_css')); 25 26 pwgs_picture_special_sections(); 26 27 } … … 37 38 } 38 39 39 $template->block_html_head('', '<link rel="stylesheet" type="text/css" href="'.get_root_url().ltrim($stuffs->get_template($css_file), '/\\.').'">', $smarty, $repeat);40 41 40 ?>
Note: See TracChangeset
for help on using the changeset viewer.