Skip to Content
It is currently September 15th, 2019, 4:55 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: March 22nd, 2012, 4:21 pm 
Offline
New User
New User

Joined: August 14th, 2010, 3:03 am
Posts: 15
Hello Everyone,

Would it be possible to display the Album Art of the songs on the Top Requested list of the site?
If yes, How can I achieve that?

I'm using the latest version of SAMPHP included on SAM 4.9.2.

--

(I've been searching the whole forum for hours already and haven't found the right result. But if there's one I missed, can you please point me to the right direction?)


Thank You!


Top
 Profile  
Reply with quote  
PostPosted: March 22nd, 2012, 7:29 pm 
Offline
SVS Member
SVS Member

Joined: October 15th, 2003, 11:59 pm
Posts: 4732
Location: Los Angeles - A Little West Of Nashville
Not sure why you need that, but if you know PHP it can be done.

_________________
- DJ Dee
- Spacial Volunteer Support (SVS)
- Custom PAL services: www.palscripts.com
- http://www.AlternativeHD.com
- http://www.lahotcountry.com


Top
 Profile  
Reply with quote  
PostPosted: October 7th, 2013, 4:54 am 
Offline
Junior User
Junior User

Joined: January 21st, 2013, 9:33 pm
Posts: 33
I would like to know how this is done as well, as I have seen it done before and also album art in the playlist too.

_________________
Never a dull moment at MIXROCKMETAL.COM ~ UP THE IRONS \m/


Top
 Profile  
Reply with quote  
PostPosted: October 7th, 2013, 5:16 am 
Offline
Junior User
Junior User

Joined: March 26th, 2013, 12:47 am
Posts: 35
Location: Hungary
Here is my code:
display/display.header.php

Code:
         <!-- BEGIN:TOP_REQUESTS -->
         <?php if (ALLOW_REQUESTS && SHOW_TOP_REQUESTS && is_array($topRequestedSongs) && count($topRequestedSongs) > 0): ?>
         <div id="top_requests">
            <dl>
               <dt>A kért dalok:</dt>
               <?php
                    $counter = 1;
                    foreach ($topRequestedSongs as $topRequestedSong): ?>
                  <dd>
                     <a href="javascript:songinfo(<?php echo $topRequestedSong->ID; ?>)" title="<?php echo $topRequestedSong->artist; ?>">
                     <?php echo $topRequestedSong->artist; ?><br>
                        <?php if(SHOW_PICTURES && !empty($topRequestedSong->picture)) : ?>
                        <font color="#ffc42c"><b><?php echo $counter++;?>.</b></font>&nbsp;&nbsp;
                        <img id="cpPictureMainSong" onload="showPicture(this, true)" width=33" height="33" src="<?php echo $topRequestedSong->picture; ?>" />
                        <?php if(!empty($topRequestedSong->title)) : ?><br /><?php echo $topRequestedSong->title; ?><?php endif; ?>
                        (<?php echo $topRequestedSong->cnt; ?>)
                           </a>
                           <?php endif; ?>   
                  </dd>                           
               <?php endforeach; ?>
            </dl>
         </div>
         <?php endif; ?>


Attachments:
top_request_with_album_pictures.jpg
top_request_with_album_pictures.jpg [ 72.62 KiB | Viewed 3924 times ]
Top
 Profile  
Reply with quote  
PostPosted: October 7th, 2013, 4:02 pm 
Offline
Junior User
Junior User

Joined: January 21st, 2013, 9:33 pm
Posts: 33
Thanks for your quick reply radarok, it looks like your on a version of SAM that is newer than mine, I am still on 4.9 and could not make that code work for me :(

_________________
Never a dull moment at MIXROCKMETAL.COM ~ UP THE IRONS \m/


Top
 Profile  
Reply with quote  
PostPosted: October 7th, 2013, 4:45 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7872
Location: Aachen (Germany)
The Web templates were last changed in 4.7.4, so if your files are structured a lot differently, you are still on the old 3.x version of the templates (there were only minor changes during the 4.x releases)

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: October 7th, 2013, 8:26 pm 
Offline
Junior User
Junior User

Joined: January 21st, 2013, 9:33 pm
Posts: 33
You are correct Mastacheata, I only did a simple upgrade from 3.5 to 4.9 and never upgraded the templates. I know you have great knowledge Mastacheata and was wondering where codes/pal could be located to add album art in the Playlist.php and or the Top Request areas for the older version of Sam?

_________________
Never a dull moment at MIXROCKMETAL.COM ~ UP THE IRONS \m/


Top
 Profile  
Reply with quote  
PostPosted: October 7th, 2013, 9:28 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7872
Location: Aachen (Germany)
Code:
function PutRow($song)
{
global $i;
Preparesong($song);

?>
 
     <font size="2" color="#003366"><small><? echo $i; ?>.
     <a href="javascript:songinfo(<? echo $song["songid"]; ?>)"><? echo $song["artist"]; ?></a></small></font> <font size="2" color="#9F9F9F"><small>(<? echo $song["cnt"]; ?>)</small></font><br>
    <font size="2" color="#003366"><small>&nbsp;&nbsp;&nbsp;&nbsp;<? echo $song["title"]; ?></small></font><br>
   
<?}?>

^^ This is the relevant section from top10requests.php from the old templates. This shows the function that is used to build every row of the top10 requests.

In order to display pictures like in the now playing view (I'm just copy pasting relevant sections now, I didn't try it) you'll need thse helper functions right in front of the above section (you should leave a blank line between, just for better readability)
Code:
$pic_cnt = 0;
function PicName()
{
 global $pic_cnt;
 echo "Picture".$pic_cnt;
}
 
function NextPicName()
{
 global $pic_cnt;
 $pic_cnt += 1;
 PicName();
}


Also modify the global $i; line to now look like this:
Code:
global $i, $showpic;


And here comes the code that you put somewhere in the function from the first code block (you'll have to adjust the layout to match whatever you have in mind yourself and find a good spot for the picture)
Code:
<?if($showpic){?>
<? if($song["haspicture"]) {?>   
       <a href="<? echo $song["buycd"]; ?>" target="_blank"><img id="<? NextPicName(); ?>" onError="PictureFail('<? PicName(); ?>')" width="60" height="60" src="<? echo $song["picture"]; ?>" alt="Buy CD!" border=0></a>
<?};?>       
<?}?>


No idea if this will look nice at all, but it might serve as a starting point.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: March 17th, 2014, 7:53 am 
Offline
Junior User
Junior User

Joined: January 21st, 2013, 9:33 pm
Posts: 33
Thanks for the code changes Mastacheata, I played around and was only able to get my na.gif to show up and other attempts just shut down the top10 completely, it was not a very important feature to add but thought it would be kinda cool. I may take another look at it later on. Sometimes I got to have a break and then voila it all clicks in.

_________________
Never a dull moment at MIXROCKMETAL.COM ~ UP THE IRONS \m/


Top
 Profile  
Reply with quote  
PostPosted: March 5th, 2019, 4:42 am 
Offline
Junior User
Junior User

Joined: January 21st, 2013, 9:33 pm
Posts: 33
I managed to do this with Sam 4.9 web template, was not as bad as I thought, I just edited the display/display.playing.php

Code:
<!-- BEGIN:TOP_REQUESTS -->
            <?php if (ALLOW_REQUESTS && SHOW_TOP_REQUESTS && is_array($topRequestedSongs) && count($topRequestedSongs) > 0): ?>
            <div id="top_requests">
                <dl>
                    <dt>Top 40 Songs (Requests)</dt>
                    <?php
                          $counter = 1;
                          foreach ($topRequestedSongs as $topRequestedSong): ?>
                        <dd>
                        <a href="javascript:songinfo(<?php echo $topRequestedSong->ID; ?>)" title="<?php echo $topRequestedSong->artist_title; ?>">
                            <?php if(SHOW_PICTURES && !empty($topRequestedSong->picture)) : ?>  <img class="picture" id="picture" onload="showPicture(this, <?php echo SHOW_PICTURES; ?>)" width="60" height="60" src="<?php echo $topRequestedSong->picture; ?>" alt="" border=0 /><?php endif; ?>
                                <?php echo $counter++;?>. <?php echo $topRequestedSong->title; ?>
                                <?php if(!empty($topRequestedSong->artist)) : ?> <font color="red">/</font>  <?php echo $topRequestedSong->artist; ?><?php endif; ?>
                                (<?php echo $topRequestedSong->cnt; ?> Requests)
                            </a>
                        </dd>
                    <?php endforeach; ?>
                </dl>
            </div>
            <?php endif; ?>
            <!-- END:TOP_REQUESTS -->


Taken from my website so if you remove <font color="red">/</font> and replace with the default "by" without quotations it should work for you also alter your picture dimensions.

_________________
Never a dull moment at MIXROCKMETAL.COM ~ UP THE IRONS \m/


Last edited by Mastacheata on March 5th, 2019, 6:47 am, edited 2 times in total.
Please use [CODE] tags next time


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group