Changeset 7517
- Timestamp:
- Oct 31, 2010, 6:10:36 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/metasimple/main.inc.php
r7470 r7517 18 18 19 19 20 add_event_handler('loc_begin_page_header', 'add_metadesc ');21 function add_metadesc() 22 { 23 global $template, $page, $meta_infosdesc;20 add_event_handler('loc_begin_page_header', 'add_metadescacc',55); 21 add_event_handler('loc_begin_page_header', 'add_metadesccat',60); 22 add_event_handler('loc_begin_page_header', 'add_metadescimg',70); 23 add_event_handler('loc_after_page_header', 'set_metadesc_back',80); 24 24 25 $meta_infosdesc = array(); 26 $meta_infosdesc['info'] = $template->get_template_vars('INFO_FILE'); 27 $meta_infosdesc['page'] = $template->get_template_vars('PAGE_TITLE'); 25 function add_metadescacc() 26 //meta homepage 27 { 28 global $template, $page, $meta_infosdesc; 29 $meta_infosdesc = array(); 30 $meta_infosdesc['info'] = $template->get_template_vars('INFO_FILE'); 31 $meta_infosdesc['page'] = $template->get_template_vars('PAGE_TITLE'); 32 $meta_infosdesc['comment'] = $template->get_template_vars('COMMENT_IMG'); 33 34 if (isset($page['section']) and $page['section'] == 'categories' and empty($page['category']['id'])) 35 { 36 $descindex='ttz'; 37 if (!empty($descindex)) 38 { 39 $template->assign('COMMENT_IMG', $descindex); 40 $template->clear_assign('INFO_FILE'); 41 } 42 } 43 } 28 44 29 30 //meta categories 31 if ( !empty($page['category']['id']) ) 32 { 33 45 function add_metadesccat() 46 { 47 global $template, $page, $meta_infosdesc; 48 $meta_infosdesc = array(); 49 $meta_infosdesc['info'] = $template->get_template_vars('INFO_FILE'); 50 $meta_infosdesc['page'] = $template->get_template_vars('PAGE_TITLE'); 51 $meta_infosdesc['comment'] = $template->get_template_vars('COMMENT_IMG'); 52 if ( !empty($page['category']['id']) ) 53 { 34 54 $query = ' 35 55 select id,comment … … 39 59 $result = pwg_query($query); 40 60 $row = mysql_fetch_array($result); 41 if (!empty($row['comment'])) 42 { 43 $template->assign('COMMENT_IMG', $row['comment']); 44 $template->clear_assign('INFO_FILE'); 45 } 46 } 47 48 //meta images 49 if ( !empty($page['image_id']) ) 50 { 61 if (!empty($row['comment'])) 62 { 63 $template->assign('COMMENT_IMG', $row['comment']); 64 $template->clear_assign('INFO_FILE'); 65 } 66 } 67 } 68 69 function add_metadescimg() 70 { 71 global $template, $page, $meta_infosdesc; 72 $meta_infosdesc = array(); 73 $meta_infosdesc['info'] = $template->get_template_vars('INFO_FILE'); 74 $meta_infosdesc['page'] = $template->get_template_vars('PAGE_TITLE'); 75 $meta_infosdesc['comment'] = $template->get_template_vars('COMMENT_IMG'); 76 if ( !empty($page['image_id']) ) 77 { 51 78 $query = ' 52 79 select id,comment … … 56 83 $result = pwg_query($query); 57 84 $row = mysql_fetch_array($result); 58 if (!empty($row['comment'])) 59 { 60 $template->assign('COMMENT_IMG', $row['comment']); 61 $template->clear_assign('INFO_FILE'); 62 } 63 64 } 85 if (!empty($row['comment'])) 86 { 87 $template->assign('COMMENT_IMG', $row['comment']); 88 $template->clear_assign('INFO_FILE'); 89 } 90 } 91 } 92 93 function set_metadesc_back() 94 { 95 global $template, $meta_infosdesc; 65 96 66 //meta homepage 67 if (isset($page['section']) and $page['section'] == 'categories' and empty($page['category']['id'])) 68 { 69 $descindex=''; 70 71 if (!empty($descindex)) 72 { 73 $template->assign('COMMENT_IMG', $descindex); 74 $template->clear_assign('INFO_FILE'); 75 } 76 } 77 78 } 79 80 add_event_handler('loc_after_page_header', 'set_metadesc_back'); 81 function set_metadesc_back() 82 { 83 global $template, $meta_infosdesc; 84 85 $template->assign(array( 86 'INFO_FILE' => $meta_infosdesc['info'] 87 ) 88 ); 89 } 97 $template->assign 98 (array 99 ( 100 'INFO_FILE' => $meta_infosdesc['info'], 101 'COMMENT_IMG' => $meta_infosdesc['comment'] 102 ) 103 ); 104 } 90 105 ?>
Note: See TracChangeset
for help on using the changeset viewer.