The New Button Fly!!!!!!

somayehbayat

New Member
hi
i have created a new button fly for you!
demo:
tab-right.png

demo live (at the right of site):
http://peyvandham.niloblog.com
steps:
1) create folder css & create tab.css & input this codes:
Code:
.toolsdlmouse{
    position:fixed;
    right:-150px;
    width:150px;
    top:50%;
    height:150px;
    margin-top:-100px;
    padding:10px;
    background:#ffffff;
    border:1px #ccc solid;
    border-radius:5px;
    -moz-border-radius:5px;
    -ms-border-radius:5px;
    -webkit-border-radius:5px;
    -o-border-radius:5px;
    -khtml-border-radius:5px;
    font:11px tahoma;
    direction:rtl;
}
.toolsdltittle{
    background:#0568c6;
    border-radius:100px 0 0 100px;
    -moz-border-radius:100px 0 0 100px;
    -ms-border-radius:100px 0 0 100px;
    -webkit-border-radius:100px 0 0 100px;
    -o-border-radius:100px 0 0 100px;
    -khtml-border-radius:100px 0 0 100px;
    text-align:left;
    padding:10px;
    position:fixed;
    top:50%;
    right:-125px;
    height:20px;
    margin-top:-135px;
    font:11px tahoma bold;
        color:#ffffff;
    direction:rtl;
    z-index:3;
    width:250px;
}

save & close!

2) go to folder sources/user_cp & edit link_code.php
search thi
Code:
if($CONF['stats_button'] == 1) {
 
$TMPL['link_code_content'] .= <<<EndHTML
Preview: <a href="{$TMPL['list_url']}/{$TMPL['verbose_link']}"><img src="{$TMPL['list_url']}/button.php?u={$TMPL['site']}&buttontype=stats" alt="{$CONF['text_link_button_alt']}" /></a>
<br />
<textarea readonly="readonly" name="code" rows="6" style="width: 90%;" onclick="select_all();">&lt;a href="{$TMPL['list_url']}/{$TMPL['verbose_link']}">&lt;img src="{$TMPL['list_url']}/button.php?u={$TMPL['site']}&buttontype=stats" alt="{$CONF['text_link_button_alt']}" />&lt;/a></textarea>
<hr />
 
EndHTML;
}

and replace with this
Code:
if($CONF['stats_button'] == 1) {
 
$TMPL['link_code_content'] .= <<<EndHTML
Preview: <a href="{$TMPL['list_url']}/index.php?a=in&u={$TMPL['username']}" target="_blank"><img src="http://peyvandham.ir/images/tab-right.png" /></a>
<br />
<textarea readonly="readonly" name="code" rows="6" style="width: 90%;" onclick="select_all();">&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
&lt;script>
/* created by www.peyvandham.ir
* Creator : info@peyvandham.ir
*/
$(document).ready(function(){
    $('.toolsdltittle,.toolsdlmouse').hover(function(){
        $('.toolsdltittle,.toolsdlmouse').animate({right:'-1px'});
    },function(){
        $('.toolsdltittle,.toolsdlmouse').animate({right:'-150px'});
    });
});
&lt;/script>
&lt;link rel="stylesheet" href="http://YOURSITEURL/css/tab-right.css" type="text/css" />
&lt;div class="toolsdlmouse">Your Site Name</a><div class="toolsdltittle">Your Site Name</div><div class="thetext">
&lt;a href="{$TMPL['list_url']}/index.php?a=in&u={$TMPL['username']}" target="_blank">&lt;img src="{$TMPL['list_url']}/button.php?u={$TMPL['site']}&buttontype=stats" alt="{$CONF['text_link_button_alt']}" />&lt;/a>
</div></div>
</textarea>
<hr />
 
EndHTML;
}

3) dont forgot like!!!!!
 
very nice, just correct point one and type tab-right.css
 
Also I would leave the option for people to choose between Static one and Fly one, so instead of replacing the code, just add the new below the original one, see below:
Code:
if($CONF['stats_button'] == 1) {
 
$TMPL['link_code_content'] .= <<<EndHTML
Preview of Static Stats Button: <a href="{$TMPL['list_url']}/{$TMPL['verbose_link']}"><img src="{$TMPL['list_url']}/button.php?u={$TMPL['site']}&buttontype=stats" alt="{$CONF['text_link_button_alt']}" /></a>
<br />
<textarea readonly="readonly" name="code" rows="6" style="width: 90%;" onclick="select_all();">&lt;a href="{$TMPL['list_url']}/{$TMPL['verbose_link']}">&lt;img src="{$TMPL['list_url']}/button.php?u={$TMPL['site']}&buttontype=stats" alt="{$CONF['text_link_button_alt']}" />&lt;/a></textarea>
<hr />
 
EndHTML;
}
 
if($CONF['stats_button'] == 1) {
 
$TMPL['link_code_content'] .= <<<EndHTML
Preview of Fly Stats Button: <a href="{$TMPL['list_url']}/index.php?a=in&u={$TMPL['username']}" target="_blank"><img src="http://peyvandham.ir/images/tab-right.png" /></a>
<br />
<textarea readonly="readonly" name="code" rows="6" style="width: 90%;" onclick="select_all();">&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
&lt;script>
/* created by www.peyvandham.ir
* Creator : info@peyvandham.ir
*/
$(document).ready(function(){
    $('.toolsdltittle,.toolsdlmouse').hover(function(){
        $('.toolsdltittle,.toolsdlmouse').animate({right:'-1px'});
    },function(){
        $('.toolsdltittle,.toolsdlmouse').animate({right:'-150px'});
    });
});
&lt;/script>
&lt;link rel="stylesheet" href="http://YOURSITEURL/css/tab-right.css" type="text/css" />
&lt;div class="toolsdlmouse">Your Site Name</a><div class="toolsdltittle">Your Site Name</div><div class="thetext">
&lt;a href="{$TMPL['list_url']}/index.php?a=in&u={$TMPL['username']}" target="_blank">&lt;img src="{$TMPL['list_url']}/button.php?u={$TMPL['site']}&buttontype=stats" alt="{$CONF['text_link_button_alt']}" />&lt;/a>
</div></div>
</textarea>
<hr />
 
EndHTML;
}
 
And to make it even better, dont edit the file at all :) simply use the plugin hook location: "user_cp_extra_link_code"

Basically just past your code into a file called user_cp_extra_link_code.php and upload to plugins/yourplugin/ - read the tutorial on how to make plugins for further guidance
 
i'm not sure what is wrong but after update it is not showing the button.
 
Did you maybe modified settings_buttons.php ? That would explain it, we forgot to remove it from the update bundle ( this update didnt went so well )
If so, overwrite it with the file from your backup
 
didn't help, I used settings_buttons.php file from back up.
 
is it something to do with word stats? cause we changed it to details in some cases.
 
Nope, check settings_buttons.php again, i am pretty sure you might have modified it in some way.
Code:
$img = imagecreatefrompng("{$CONF['path']}/images/ranking.png");
This is the default image which is used, is that the correct one for you?
 
All seems to be ok in my file, have a look below.

settings_button.php code:
Code:
<?php
if (!defined('VISIOLIST')) {
  die("This file cannot be accessed directly.");
}
 
$TMPL = $DB->fetch("SELECT *
                  FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats
                  WHERE sites.username = stats.username AND sites.username = '{$username}'", __FILE__, __LINE__);
if ($rank) {
  $TMPL['rank'] = $rank;
}
else {
  $TMPL['rank'] = $TMPL['old_rank'];
}
 
$TMPL['average_rating'] = $TMPL['num_ratings'] > 0 ? round($TMPL['total_rating'] / $TMPL['num_ratings'], 0) : 0;
 
$ranking_periods = array('daily', 'weekly', 'monthly');
$ranking_methods = array('unq_pv', 'tot_pv', 'unq_in', 'tot_in', 'unq_out', 'tot_out');
foreach ($ranking_periods as $ranking_period) {
  foreach ($ranking_methods as $ranking_method) {
    $TMPL["{$ranking_method}_avg_{$ranking_period}"] = 0;
    for ($i = 0; $i < 10; $i++) {
      $TMPL["{$ranking_method}_avg_{$ranking_period}"] = $TMPL["{$ranking_method}_avg_{$ranking_period}"] + $TMPL["{$ranking_method}_{$i}_{$ranking_period}"];
    }
    $TMPL["{$ranking_method}_avg_{$ranking_period}"] = $TMPL["{$ranking_method}_avg_{$ranking_period}"] / 10;
  }
}
 
$TMPL['average_rating'] = $TMPL['num_ratings'] > 0 ? round($TMPL['total_rating'] / $TMPL['num_ratings'], 0) : 0;
 
$img = imagecreatefrompng("{$CONF['path']}/images/ranking.png");
$color1 = imagecolorallocate($img, 0, 0, 0);
$color2 = imagecolorallocate($img, 0, 0, 0);
$color3 = imagecolorallocate($img, 255, 0, 0);
header ("Content-type: image/png");
 
imagestring($img, 10, 10, 5, $TMPL['username'], $color3);
imagestring($img, 3, 35, 20, $TMPL['xp_rate'], $color1);
imagestring($img, 3, 35, 30, $TMPL['sp_rate'], $color1);
imagestring($img, 3, 150, 20, $TMPL['drop_rate'], $color1);
imagestring($img, 3, 155, 30, $TMPL['adena_rate'], $color1);
imagestring($img, 3, 305, 20, $TMPL['safe_enchant'], $color1);
imagestring($img, 3, 305, 30, $TMPL['max_enchant'], $color1);
imagestring($img, 3, 55, 46, $TMPL['game_type'], $color3);
imagestring($img, 3, 175, 46, $TMPL['unq_in_0_monthly'], $color3);
//imagestring($img, 2, 80, 75, $TMPL['tot_pv_0_monthly'], $color1);
//imagestring($img, 2, 80, 90, $TMPL['unq_in_0_monthly'], $color1);
//imagestring($img, 2, 80, 84, "{$TMPL['average_rating']}/5", $color1);
 
imagestring($img, 3, 305 - ((strlen($TMPL['rank']) - 1) * 4), 46, $TMPL['rank'], $color3);
imagepng($img);
?>

code for fly button main file from plugin, user_cp_extra_link_code.php
Code:
if($CONF['stats_button'] == 1) {
 
$TMPL['link_code_content'] .= <<<EndHTML
Preview of Fly Stats Button: <a href="{$TMPL['list_url']}/{$TMPL['verbose_link']}"><img src="{$TMPL['list_url']}/button.php?u={$TMPL['site']}&buttontype=stats" alt="{$CONF['text_link_button_alt']}" /></a>
 
<br />
<textarea readonly="readonly" name="code" rows="6" style="width: 90%;" onclick="select_all();">&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
&lt;script>
/* created by www.peyvandham.ir
* Creator : info@peyvandham.ir
*/
$(document).ready(function(){
    $('.toolsdltittle,.toolsdlmouse').hover(function(){
        $('.toolsdltittle,.toolsdlmouse').animate({right:'-1px'});
    },function(){
        $('.toolsdltittle,.toolsdlmouse').animate({right:'-150px'});
    });
});
&lt;/script>
&lt;link rel="stylesheet" href="http://www.l2.votezone.eu/css/tab-right.css" type="text/css" />
&lt;div class="toolsdlmouse">L2VoteZone.eu - Home of Lineage 2 Top Private Servers</a><div class="toolsdltittle"></div><div class="thetext">
&lt;a href="{$TMPL['list_url']}/index.php?a=in&u={$TMPL['username']}" target="_blank">&lt;img src="{$TMPL['list_url']}/button.php?u={$TMPL['site']}&buttontype=stats" alt="{$CONF['text_link_button_alt']}" />&lt;/a>
</div></div>
</textarea>
<hr />
 
EndHTML;
}

tab-right.css code
Code:
.toolsdlmouse{
    position:fixed;
    right:-480px;
    width:468px;
    top:50%;
    height:80px;
    margin-top:-370px;
    padding:10px;
    background:#ffffff;
    border:1px #ccc solid;
    border-radius:5px;
    -moz-border-radius:5px;
    -ms-border-radius:5px;
    -webkit-border-radius:5px;
    -o-border-radius:5px;
    -khtml-border-radius:5px;
    text-align:left;
    font:14px tahoma bold;
        color:#000000;
    direction:rtl;
}
.toolsdltittle{
    background:#0568c6 url(http://www.l2.votezone.eu/images/votezone_logo_100x45.png) top left no-repeat;
    border-radius:10px 0 0 10px;
    -moz-border-radius:10px 0 0 10px;
    -ms-border-radius:10px 0 0 10px;
    -webkit-border-radius:10px 0 0 10px;
    -o-border-radius:10px 0 0 10px;
    -khtml-border-radius:10px 0 0 10px;
    text-align:left;
    padding:10px;
    position:fixed;
    top:50%;
    right:-480px;
    height:25px;
    margin-top:-405px;
    font:14px tahoma bold;
        color:#ffffff;
    direction:rtl;
    z-index:3;
    width:560px;
}
 
Hmm looks perfectly fine. Ill have a look on our dev list if the same is happening there

EDIT:: Works fine over there, ill to inspect what is happening a bit more on your site
 
Back
Top