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 a Code


Tricky

Rekomendowane odpowiedzi

Hello,

How can i bring the "STARS" from a Image., where you see: {$row['number']} out of 5

i have a code from: Michael, From IPS..

<center>
<i><b>Be aware:</b> We allow nudity Wallpapers & Photographs and it may appear on front page<br><font size="1">(Guests are <b>Not</b> allowed to Download such wallpapers)</font></i>
<br><br>
</center>
<?php
       /* Init */
       $return  = "";
       $to_show = 24;
       $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',
                                                        '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><tr>";

               while ( $row = $this->DB->fetch() )
               {
                       $count++;
                       $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 /><i>Rating:</i> {$row['number']} out of 5

       </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

Try change it:

                        $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 /><i>Rating:</i> {$row['number']} out of 5

       </td>
EOF;

To:

           $row['rate']['number'] = intval( $row['number'] );
		$row['rate']['canrate'] 	= 1;
		$row['rate']['_rate_int'] = $rows[0]['ratings_count'] ? round( $rows[0]['ratings_total'] / $rows[0]['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 /><i>Rating:</i> {$row['number']} out of 5

       </td>
EOF;

NOT TESTED. Please make backup of file!

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

  • Manager

Sorry, change to:

                        $row['rate']['id'] = intval( $row['picid'] );
                       $row['rate']['number'] = intval( $row['number'] );
                       $row['rate']['canrate']         = 1;
                       $row['rate']['_rate_int'] = $rows[0]['ratings_count'] ? round( $rows[0]['ratings_total'] / $rows[0]['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 /><i>Rating:</i> {$row['number']} out of 5

       </td>
EOF;

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

  • Manager

Try change whole code by:

<center>
<i><b>Be aware:</b> We allow nudity Wallpapers & Photographs and it may appear on front page<br><font size="1">(Guests are <b>Not</b> allowed to Download such wallpapers)</font></i>
<br><br>
</center>
<?php
       /* Init */
       $return  = "";
       $to_show = 24;
       $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',
                                                        'from'     => array( 'gallery_images' => 'i' ),
                                                        'add_join' => array( 0 => array( 'select' => 'g.ratings_count, g.ratings_total, 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><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'] = $rows[0]['ratings_count'] ? round( $rows[0]['ratings_total'] / $rows[0]['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 /><i>Rating:</i> {$row['number']} out of 5

       </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

  • Manager

Try again:

<center>
<i><b>Be aware:</b> We allow nudity Wallpapers & Photographs and it may appear on front page<br><font size="1">(Guests are <b>Not</b> allowed to Download such wallpapers)</font></i>
<br><br>
</center>
<?php
       /* Init */
       $return  = "";
       $to_show = 24;
       $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><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'] = $rows[0]['ratings_count'] ? round( $rows[0]['ratings_total'] / $rows[0]['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 /><i>Rating:</i> {$row['number']} out of 5

       </td>
EOF;

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

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

       /* Return */
       print $return;
?>

Please note: i can't test any ot these codes so please be patient. :)

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

  • Manager

And again:

<center>
<i><b>Be aware:</b> We allow nudity Wallpapers & Photographs and it may appear on front page<br><font size="1">(Guests are <b>Not</b> allowed to Download such wallpapers)</font></i>
<br><br>
</center>
<?php
       /* Init */
       $return  = "";
       $to_show = 24;
       $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><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 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 /><i>Rating:</i> {$row['number']} out of 5

       </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

Okay, one last thing :D

But when i submit a Video File, the "screenshot" doesn't show with that code(didn't work with those others either)?

if an Video has been submitted we can have a img says that this is an Video File or if its easy done the screenshot to the video..if it's simpler.. hmm

Thanks for a reply! ;)

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Oh, you uploaded .mov file as screenshot

uploads/1243459243/tn_gallery_1_166_12163165.mov

;)

so question is: what you want to do with this? Skip all .mov screens and show only 'image' types as screenshots?

'

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

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ę.