Форумы / Cotonti / Extensions / Pages order in tag output

Macik
#39484 27.04.2014 09:57

This functionallity is hard coded in Tags plugin. So you can not alter it simply with settings.

But it's a flexible enough to be extended with other plugin for this. 

So you can write simple plugin with 2 hooks:

  • on «tags.search.pages.query» hook
PHP
1
2
3
4
5
// check is it possible to sort by this field
if ($db->fieldExists($db_pages,'page_'.$o)) {
 
    $order = 'ORDER BY `page_'.$o.'`';
}
  • on «tags.first» hook
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // column => title
    $addition_fields = array(
        'begin' => 'Begin date',
        'author' => 'Author',
        // on so on — any page field
    );
    foreach ($addition_fields as $order=>$title)
    {
        $ord = mb_strtolower($order);
        $selected = $ord == $o ? 'selected="selected"' : '';
        $tag_order .= cot_rc('input_option', array('value' => $ord, 'selected' => $selected, 'title' => $title));
    }

     

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F