Ignore:
Timestamp:
Oct 31, 2010, 6:10:36 PM (13 years ago)
Author:
ddtddt
Message:

[extensions] - metasimple - update for priority / meta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/metasimple/main.inc.php

    r7470 r7517  
    1818
    1919
    20 add_event_handler('loc_begin_page_header', 'add_metadesc' );
    21 function add_metadesc()
    22 {
    23   global $template, $page, $meta_infosdesc;
     20add_event_handler('loc_begin_page_header', 'add_metadescacc',55);
     21add_event_handler('loc_begin_page_header', 'add_metadesccat',60);
     22add_event_handler('loc_begin_page_header', 'add_metadescimg',70);
     23add_event_handler('loc_after_page_header', 'set_metadesc_back',80);
    2424
    25   $meta_infosdesc = array();
    26   $meta_infosdesc['info'] = $template->get_template_vars('INFO_FILE');
    27   $meta_infosdesc['page'] = $template->get_template_vars('PAGE_TITLE');
     25function 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        }
    2844
    29  
    30   //meta categories
    31   if ( !empty($page['category']['id']) )   
    32   {
    33 
     45function 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                                {
    3454    $query = '
    3555    select id,comment
     
    3959    $result = pwg_query($query);
    4060    $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
     69function 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                                {
    5178    $query = '
    5279    select id,comment
     
    5683    $result = pwg_query($query);
    5784    $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
     93function set_metadesc_back()
     94        {
     95                global $template, $meta_infosdesc;
    6596 
    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        }
    90105?>
Note: See TracChangeset for help on using the changeset viewer.