Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

RESOLVED: Submission Code


Tricky

Rekomendowane odpowiedzi

I want to have the same as the Image code, with rating stars and comments, if its possible ^_^

Image Code:

<table class='ipb_table' cellspacing="1">
   <tbody>
       <tr>
           <td class='row2'>


<?php
       /* Init */
       $return  = "";
       $to_show = 30;
       $per_row = 6;
       $count   = 0;

       /* Query */
       $this->DB->build( array( 'select'   => 'i.id AS picid, i.masked_file_name, i.directory, i.caption, i.member_id, i.ratings_count, i.ratings_total, i.comments ',
                                                        'from'     => array( 'gallery_images' => 'i' ),
                                                        'add_join' => array( 0 => array( 'select' => 'g.rate AS number',
                                                                                         'from'   => array( 'gallery_ratings' => 'g' ),
                                                                                         'where'  => 'i.id=g.img_id',
                                                                                         'type'   => 'left' ) ),
                                                        'add_join' => array( 1 => array( 'select' => 'm.name as uname',
                                                                                         'from'   => array( 'members' => 'm' ),
                                                                                         'where'  => 'i.member_id=m.member_id',
                                                                                         'type'   => 'left' ) ),


                                                        'order'    => 'i.id DESC',
                                                        'limit'    => array( 0, $to_show ),
                                       )          );
       $this->DB->execute();

       /* Got some rows */
       if ( $this->DB->getTotalRows() )
       {

               $return .= "<div><table>";

               $return .= "<tr>
                           <td rowspan='{$this->DB->getTotalRows()}' valign='top'>
<b>Single Submission Menu:</b><br>
<br>
<ul><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=3'>Wallpapers</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=22'>Photographs</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=173'>Artisan Crafts</a></i></li><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=162'>Icons</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=56'>Digital Art</a></i></li><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=51'>Fan Art</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=73'>Photo-Manipulation</a></i></li><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=172'>Scrap Images</a></i></li><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=145'>Vector</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=12'>Vexel</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=75'>WallBase Pro Portfolios</a></i></li></ul>               <br>

<font size='1'><a href='http://wallbase.org/index.php?app=gallery&module=stats&do=ratings'>Top Rated Images</a><br>

<a href='http://wallbase.org/index.php?app=gallery&module=stats&do=views'>Most Viewed Images</a><br>

<a href='http://wallbase.org/index.php?app=gallery&module=stats&do=comments'>Recent Comments</a></font>
</td>
                                                       </tr>";


               while ( $row = $this->DB->fetch() )
               {
                       $count++;
                       $row['rate']['id'] = intval( $row['picid'] );
                       $row['rate']['number'] = intval( $row['number'] );
                       $row['rate']['canrate']         = 1;
                       $row['rate']['_rate_int'] = $row['ratings_count'] ? round( $row['ratings_total'] / $row['ratings_count'], 0 ) : 0;

                       $row['number'] = $this->registry->output->getTemplate( 'gallery_imagelisting' )->rate_form( $row['rate'] );

                       $return .= <<<EOF
       <td class='short'>
               <a href="index.php?app=gallery&module=images&section=viewimage&img={$row['picid']}">
                       <img border="2" src="uploads/{$row['directory']}/tn_{$row['masked_file_name']}" alt="{$row['caption']}"/>
               </a><br />
               <i>By:</i><a href='index.php?app=gallery&module=user&user={$row['member_id']}'><b> {$row['uname']}</b></a></strong><br />{$row['number']}
               <br />
               <a href="index.php?app=gallery&module=post&section=comment&do=postcomment&img={$row['picid']}">Comment?</a> - <a href="index.php?app=gallery&module=images&section=viewimage&img={$row['picid']}"><b>{$row['comments']}</b></a>

      </td>
EOF;

                       /* New row */
                       if ( $count && $count % $per_row == 0 )
                       {
                               $return .= "</tr><tr>";
                       }
               }

               $return .= "</tr></table></div>";
       }

       /* Return */
       print $return;
?>
          </td>
       </tr>
   </tbody>
</table>

Files Code

<table class='ipb_table' cellspacing="1">
   <tbody>
       <tr>
           <td class='row2'>

<?php
       /* Init */
       $return  = "";
       $to_show = 24;
       $per_row = 6;
       $count   = 0;

       /* Query */
       $this->DB->build( array( 'select'   => 'f.file_id, f.file_name, f.file_ssname',
                                                        'from'     => array( 'downloads_files' => 'f' ),
                                                        'add_join' => array( 0 => array( 'select' => 'm.name as uname',
                                                                                                                         'from'   => array( 'members' => 'm' ),
                                                                                                                         'where'  => 'f.file_submitter=m.member_id',
                                                                                                                         'type'   => 'left' ) ),
                                                        'order'    => 'f.file_id DESC',
                                                        'limit'    => array( 0, $to_show ),
                                       )          );
       $this->DB->execute();

       /* Got some rows */
       if ( $this->DB->getTotalRows() )
       {
               $return .= "<div><table><tr>";

               $return .= "<tr>

<td rowspan='{$this->DB->getTotalRows()}' valign='top'>
<b>Single Submission Menu:</b><br>
<br>
<ul><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=3'>Wallpapers</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=22'>Photographs</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=173'>Artisan Crafts</a></i></li><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=162'>Icons</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=56'>Digital Art</a></i></li><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=51'>Fan Art</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=73'>Photo-Manipulation</a></i></li><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=172'>Scrap Images</a></i></li><li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=145'>Vector</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=12'>Vexel</a></i></li>
<li><i><a href='http://wallbase.org/index.php?app=gallery&module=cats&do=sc&cat=75'>WallBase Pro Portfolios</a></i></li></ul>               <br>

<font size='1'><a href='http://wallbase.org/index.php?app=gallery&module=stats&do=ratings'>Top Rated Images</a><br>

<a href='http://wallbase.org/index.php?app=gallery&module=stats&do=views'>Most Viewed Images</a><br>

<a href='http://wallbase.org/index.php?app=gallery&module=stats&do=comments'>Recent Comments</a></font>
</td>
                           </tr>";


               while ( $row = $this->DB->fetch() )
               {
                       $count++;
                       $return .= <<<EOF
<td class='short'>
       <a href="index.php?app=downloads&showfile={$row['file_id']}">
EOF;

                       if ( $row['file_ssname'] )
                       {
                               $return .= <<<EOF
               <img src="index.php?app=downloads&module=display&section=screenshot&id={$row['file_id']}" width='128' height='100'  alt="{$row['file_name']}" />
EOF;
                       }
                       else
                       {
                               $return .= <<<EOF
               <em>No Screenshot Available</em>
EOF;
                       }

                       $return .= <<<EOF
       </a><br />
       <i>By:</i> <strong>{$row['uname']}</strong><br> In <a href="http://wallbase.org/index.php?app=downloads"> Skins & Themes</a>
</td>
EOF;

                       /* New row */
                       if ( $count && $count % $per_row == 0 )
                       {
                               $return .= "</tr><tr>";
                       }
               }

               $return .= "</tr></table></div>";
       }

       /* Return */
       print $return;
?>

           </td>
       </tr>
   </tbody>
</table>

Thanks

- Kenneth

Odnośnik do komentarza
Udostępnij na innych stronach

Nooo, its useless for me and my website ^_^^^,) hehe

but, i got a suggestion, is it easy to make like.. hmm.. when u hold over a img, the img will zoom(in this case i have it on: 640x480 ar preview) in, and it will appear in the middle.. hmm.. or-.

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.