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

RESOLVED: Help with code(Again^^,)


Tricky

Rekomendowane odpowiedzi

Hey, i wanna say think you for the help before, but, my members wanna see "commets" above the Stars..

ex1: Comments: 0

ex2: Comments: 7

Here are the code:




<table class='ipb_table' cellspacing="100">
   <tbody>
       <tr>
           <td class='row1'>
<?php
       /* Init */
       $return  = "";
       $to_show = 36;
       $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 ',
                                                        '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>";

               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 src="uploads/{$row['directory']}/tn_{$row['masked_file_name']}" alt="{$row['caption']}" />
               </a><br />
               <i>Uploaded By:</i><br>
               <a href='index.php?app=gallery&module=user&user={$row['member_id']}'><b>{$row['uname']}</b></a></strong><br />{$row['number']}

      </td>
EOF;

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

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

       /* Return */
       print $return;
?>

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Hi,

try this:

<table class='ipb_table' cellspacing="100">
   <tbody>
       <tr>
           <td class='row1'>
<?php
       /* Init */
       $return  = "";
       $to_show = 36;
       $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>";

               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 src="uploads/{$row['directory']}/tn_{$row['masked_file_name']}" alt="{$row['caption']}" />
               </a><br />
               <i>Uploaded By:</i><br>
               <a href='index.php?app=gallery&module=user&user={$row['member_id']}'><b>{$row['uname']}</b></a></strong><br />{$row['number']}
               <br />
               Comments: {$row['comments']}

      </td>
EOF;

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

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

       /* Return */
       print $return;
?>

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

thanks! but one thing, sorry for the questions but you are only one who helped me with this :) and, im Thankful!

Is it possible to make Comments, a link to the comments.?

like:

i uploaded a image, and a guy has made a comment, and i can just click on the "Comments", and i get to the comment that has been made @ my uploaded image :%-):!

Easy way:

Comments(will be a link) -> redirect to the image comments :)

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Try this:

<table class='ipb_table' cellspacing="100">
   <tbody>
       <tr>
           <td class='row1'>
<?php
       /* Init */
       $return  = "";
       $to_show = 36;
       $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>";

               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 src="uploads/{$row['directory']}/tn_{$row['masked_file_name']}" alt="{$row['caption']}" />
               </a><br />
               <i>Uploaded By:</i><br>
               <a href='index.php?app=gallery&module=user&user={$row['member_id']}'><b>{$row['uname']}</b></a></strong><br />{$row['number']}
               <br />
               Comments: <a href="index.php?app=gallery&module=post&section=comment&do=postcomment&img={$row['picid']}">{$row['comments']}</a>

      </td>
EOF;

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

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

       /* Return */
       print $return;
?>

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

thank you so much!!!! :P

and, one more tiny thing^^,)

is it a possibility to do the same(Comments & Stars) on Last Skin & Themes code i have:

<div class='moderation_bar rounded  clear'>
<center>
<i><b><h3>Skins & Themes</h3></font></i>
</div>
</center>
<?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>";

               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;
?>

Edytowane przez Tricky
Odnośnik do komentarza
Udostępnij na innych stronach

  • 1 miesiąc temu...
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ę.