Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-20-2006, 12:04 AM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
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:
  #2 (permalink)  
Old 08-20-2006, 12:24 PM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,547
Thanks: 254
Thanked 649 Times in 513 Posts
Today I am going to see if I can enable the gravatar in front of the users name in sneak/spy. I'll post the code if I can figure it out.
__________________
I accept donations for my time helping users like you on the forum and IRC.
Reply With Quote
  #3 (permalink)  
Old 08-20-2006, 02:30 PM
New Pligger
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kbeeveer46 View Post
Today I am going to see if I can enable the gravatar in front of the users name in sneak/spy. I'll post the code if I can figure it out.
..love it, great idea!!!
Reply With Quote
  #4 (permalink)  
Old 08-21-2006, 11:57 AM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,547
Thanks: 254
Thanked 649 Times in 513 Posts
Quote:
Originally Posted by louisd View Post
..love it, great idea!!!
I found out from Ash that it's going to be a much harder task than anticipated.
__________________
I accept donations for my time helping users like you on the forum and IRC.
Reply With Quote
  #5 (permalink)  
Old 08-22-2006, 09:25 PM
Casual Pligger
 
Join Date: Dec 2005
Posts: 31
Thanks: 0
Thanked 3 Times in 2 Posts
Send a message via AIM to williamboliver Send a message via MSN to williamboliver Send a message via Yahoo to williamboliver Send a message via Skype™ to williamboliver
Nice mod.....can you post the code for the legend at the top?
Reply With Quote
  #6 (permalink)  
Old 08-22-2006, 10:25 PM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,547
Thanks: 254
Thanked 649 Times in 513 Posts
Quote:
Originally Posted by williamboliver View Post
Nice mod.....can you post the code for the legend at the top?
You should probably use your own images but here is the code for the legend:
PHP Code:
<p align="left" style="padding-right:10px; font-weight:bold"><img src="templates/mollio-beat/images/spy_new.gif" /> new/published&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="templates/mollio-beat/images/spy_vote2.gif" /> vote&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="templates/mollio-beat/images/spy_comment.gif" /> comment</p
__________________
I accept donations for my time helping users like you on the forum and IRC.
Reply With Quote
  #7 (permalink)  
Old 08-23-2006, 09:09 AM
Casual Pligger
 
Join Date: Dec 2005
Posts: 31
Thanks: 0
Thanked 3 Times in 2 Posts
Send a message via AIM to williamboliver Send a message via MSN to williamboliver Send a message via Yahoo to williamboliver Send a message via Skype™ to williamboliver
thanks! I'm looking for some replacement images to match my theme. I agree that we need a good opensource version of the images.

update: I had a link for some GPL icons that I have updated my site with.

http://www.maxpower.ca/free-icons/2006/03/05/

I'm using the mini pack. Attached are the replacement icons I am using:
Attached Files
File Type: zip icons.zip (4.5 KB, 29 views)

Last edited by williamboliver; 08-23-2006 at 09:30 AM..
Reply With Quote
The Following 2 Users Say Thank You to williamboliver For This Useful Post:
  #8 (permalink)  
Old 08-10-2007, 05:46 AM
Constant Pligger
Pligg Version: 9.7
Pligg Template: Yget
 
Join Date: Nov 2006
Posts: 161
Thanks: 26
Thanked 1 Time in 1 Post
Thanks for this mod. But i don't know why my live page looks like this :-/

Reply With Quote
  #9 (permalink)  
Old 08-10-2007, 05:58 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,071
Thanks: 53
Thanked 25 Times in 23 Posts
What´s the difference between this / digg spy and the live view? Kb´s link is password protected meanwhile.
Reply With Quote
  #10 (permalink)  
Old 08-10-2007, 07:19 AM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,547
Thanks: 254
Thanked 649 Times in 513 Posts
Man, it was almost a year ago when I made this thread. Can't believe I've stuck around this long

Any ways, the way the images work looks exactly like digg because that's what I based it off of.
__________________
I accept donations for my time helping users like you on the forum and IRC.
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
select images for submission in development ivytony Modification Tutorials 44 11-28-2008 05:38 PM
RSS importer doesn't import images from feeds lostdeviant General Help 2 05-07-2008 09:29 AM
Profile Badges and Images EASY work 30 usd winner! bbrian017 Off-topic 0 04-25-2008 10:47 AM
Star rating images? PurpleCow Template Support 2 06-17-2007 02:30 AM
Images with Lightbox in Desc w/ popup Thumb kanedaguy Modification Tutorials 0 02-02-2007 01:51 AM


Search Engine Friendly URLs by vBSEO 3.2.0