View Single Post
  #1 (permalink)  
Old 08-20-2006, 12:04 AM
kbeeveer46's Avatar
kbeeveer46 kbeeveer46 is offline
Pligg Developer/Admin
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,547
Thanks: 254
Thanked 649 Times in 513 Posts
Add-on: How to use images in sneak/spy like digg's spy

I have customized my sneak/spy to use images like digg's spy. Check it out here: http://www.indianaseesee.com/sneak.php

For the time being, I have just used digg's images until I can get some of my own. If you would like this for your site you will need to edit your to_html function in sneak.php. Make sure to change the template if you're not using mollio-beat. Also you will need to change the location of the images to the location of your images.

Replace

PHP Code:
function to_html(data) {
    var ts=new Date(data.ts*1000);
    var timeStr;

    var hours = ts.getHours();
    var minutes = ts.getMinutes();
    var seconds = ts.getSeconds();

    timeStr  = ((hours < 10) ? "0" : "") + hours;
    timeStr  += ((minutes < 10) ? ":0" : ":") + minutes;
    timeStr  += ((seconds < 10) ? ":0" : ":") + seconds;

    html = '<div class="sneaker-ts">'+timeStr+'</div>';

    if (data.type == 'problem')
        html += '<div class="sneaker-type"><span class="sneaker-problem">'+data.type+'</span></div>';
    else if (data.type == 'new' || data.type == 'published')
        html += '<div class="sneaker-type"><strong>'+data.type+'</strong></div>';
    else
        html += '<div class="sneaker-type">'+data.type+'</div>';

    html += '<div class="sneaker-votes">'+data.votes+'</div>';
    html += '<div class="sneaker-story"><a href="<? echo my_base_url.my_pligg_base?>/story.php?id='+data.link+'">'+data.title+'</a></div>';
    if (data.type == 'problem')
        html += '<div class="sneaker-who"><span class="sneaker-problem">'+data.who+'</span></div>';
    else if (data.uid > 0) 
        html += '<div class="sneaker-who"><a href="<? echo my_base_url.my_pligg_base?>/user.php?login='+data.who+'">'+data.who+'</a></div>';
    else 
        html += '<div class="sneaker-who">'+data.who+'</div>';
    html += '<div class="sneaker-status">'+data.status+'</div>';
    return html;
}
with

PHP Code:
function to_html(data) {
    var 
ts=new Date(data.ts*1000);
    var 
timeStr;

    var 
hours ts.getHours();
    var 
minutes ts.getMinutes();
    var 
seconds ts.getSeconds();

    
timeStr  = ((hours 10) ? "0" "") + hours;
    
timeStr  += ((minutes 10) ? ":0" ":") + minutes;
    
timeStr  += ((seconds 10) ? ":0" ":") + seconds;

    
html '<div class="sneaker-ts">'+timeStr+'</div>';

    if (
data.type == 'problem')
        
html += '<div class="sneaker-type"><span class="sneaker-problem">'+data.type+'</span></div>';
    else if (
data.type == 'new' || data.type == 'published')
        
html += '<div class="sneaker-type"><img src="templates/mollio-beat/images/spy_new.gif"></div>';            
    else if (
data.type == 'comment')
        
html += '<div class="sneaker-type"><img src="templates/mollio-beat/images/spy_comment.gif"></div>';
    else if (
data.type == 'vote')
        
html += '<div class="sneaker-type"><img src="templates/mollio-beat/images/spy_vote2.gif"></div>';    
    else        
        
html += '<div class="sneaker-type">'+data.type+'</div>';

    
html += '<div class="sneaker-votes">'+data.votes+'</div>';
    
html += '<div class="sneaker-story"><a href="story.php?id='+data.link+'">'+data.title+'</a></div>';
    if (
data.type == 'problem')
        
html += '<div class="sneaker-who"><span class="sneaker-problem">'+data.who+'</span></div>';
    else if (
data.uid 0
        
html += '<div class="sneaker-who"><a href="user.php?login='+data.who+'">'+data.who+'</a></div>';
    else 
        
html += '<div class="sneaker-who">'+data.who+'</div>';
    
html += '<div class="sneaker-status">'+data.status+'</div>';
    return 
html;

__________________
I accept donations for my time helping users like you on the forum and IRC.

Last edited by kbeeveer46; 08-20-2006 at 10:50 AM..
Reply With Quote
The Following 3 Users Say Thank You to kbeeveer46 For This Useful Post: