M
M
Maxim Kiktev2015-05-06 20:59:41
PHP
Maxim Kiktev, 2015-05-06 20:59:41

How to change the output of the Favorite button in dle 10.1 in php?

In Dle 10.1, the Favorite style is formed by this code

if( $is_logged ) {
        
        $fav_arr = explode( ',', $member_id['favorites'] );
            
        if( ! in_array( $row['id'], $fav_arr ) or $config['allow_cache'] == "yes" ) $tpl->set( '{favorites}', "<a id=\"fav-id-" . $row['id'] . "\" href=\"$PHP_SELF?do=favorites&amp;doaction=add&amp;id=" . $row['id'] . "\"><img src=\"" . $config['http_home_url'] . "templates/{$config['skin']}/dleimages/plus_fav.gif\" onclick=\"doFavorites('" . $row['id'] . "', 'plus'); return false;\" title=\"" . $lang['news_addfav'] . "\" style=\"vertical-align: middle;border: none;\" alt=\"\" /></a>" );
        
else $tpl->set( '{favorites}', "<a id=\"fav-id-" . $row['id'] . "\" href=\"$PHP_SELF?do=favorites&amp;doaction=del&amp;id=" . $row['id'] . "\"><img src=\"" . $config['http_home_url'] . "templates/{$config['skin']}/dleimages/minus_fav.gif\" onclick=\"doFavorites('" . $row['id'] . "', 'minus'); return false;\" title=\"" . $lang['news_minfav'] . "\" style=\"vertical-align: middle;border: none;\" alt=\"\" /></a>" );

        $tpl->set( '[complaint]', "<a href=\"javascript:AddComplaint('" . $row['id'] . "', 'news')\">" );
        $tpl->set( '[/complaint]', "</a>" );
    
    } else {
        $tpl->set( '{favorites}', "" );
        $tpl->set_block( "'\\[complaint\\](.*?)\\[/complaint\\]'si", "" );
    }

help instead of pictures plus_fav.gif and minus_fav.gif to put boostrap buttons.
Instead of plus_fav.gif
<label class="btn btn-lg btn-block btn-default text-default">
            <input type="radio" name="options" id="option2" autocomplete="off">
            <i class="fa fa-circle-o fa-3x"></i>
            <br />
           Плей-лист
        </label>

Instead of minus_fav.gif
<label class="btn btn-lg btn-block btn-success text-success active">
            <input type="radio" name="options" id="option1" autocomplete="off" checked>
            <i class="fa fa-check-circle-o fa-3x animated fadeIn"></i>
            <br />
            В плей-листе
        </label>

and these two labels must be placed inside
<div class="" data-toggle="buttons"></div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Kiktev, 2015-05-08
@Ne0lite

Now I will write how to do it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question