SMFHacks.com

SMF Gallery Lite => SMF Gallery Lite => Topic started by: reyver on May 30, 2011, 11:29:02 am

Title: Facebook like button
Post by: reyver on May 30, 2011, 11:29:02 am
is it possible to put a like button every photos uploaded in the gallery?

thanks

reyver
Title: Re: Facebook like button
Post by: SMFHacks on May 30, 2011, 11:49:05 am
Yes on the view picture page you would need to modify the gallery.template.php file then in there find the view_picture function
Title: Re: Facebook like button
Post by: reyver on May 30, 2011, 12:17:56 pm
i will put the code from the facebook plugin in gallery.template.php ?
Title: Re: Facebook like button
Post by: SMFHacks on May 30, 2011, 12:18:37 pm
Yes in the template_view_picture function
Title: Re: Facebook like button
Post by: reyver on May 30, 2011, 06:49:47 pm
Good day again,

i cant find the view_picture function is it inside the gallery.template.php? cause when i open the it i didnt find the view_picture

thanks

reyver
Title: Re: Facebook like button
Post by: SMFHacks on May 30, 2011, 07:38:49 pm
Should be i think function template_view_picture
Title: Re: Facebook like button
Post by: reyver on May 30, 2011, 07:44:20 pm
i found this  "gallery_theme.php" in /public_html/gallery/modules/gallery/helpers

and when i open the file i cant find template_view_picture

thanks

reyver
Title: Re: Facebook like button
Post by: SMFHacks on May 30, 2011, 07:53:14 pm
If you are using SMF Gallery Lite
The file is themes/default/gallery.template.php
Title: Re: Facebook like button
Post by: reyver on May 30, 2011, 08:36:13 pm
ok im on the file, is the code from facebook plugin needs to be insert or need to replace some code in the template_view_picture?

thanks

reyver
Title: Re: Facebook like button
Post by: reyver on May 30, 2011, 11:40:50 pm
Hope you dont mind asking this.

This is the Template_view_ Picture code

Quote

function template_view_picture()
{
   global $scripturl, $context, $txt,  $id_member, $modSettings, $memberContext;

   // Load permissions
   $g_manage = allowedTo('smfgallery_manage');
   $g_edit_own = allowedTo('smfgallery_edit');
   $g_delete_own = allowedTo('smfgallery_delete');

   // Keywords
   $keywords = explode(' ',$context['gallery_pic']['keywords']);
    $keywordscount = count($keywords);


   ShowTopGalleryBar();
   


   echo '<br /><table cellspacing="0" cellpadding="10" border="0" align="center" width="90%" class="tborder">
         <tr class="catbg">
            <td align="center">' . $context['gallery_pic']['title'] . '</td>
         </tr>
         <tr class="windowbg2">
            <td align="center"><img height="' . $context['gallery_pic']['height']  . '" width="' . $context['gallery_pic']['width']  . '" src="' . $modSettings['gallery_url'] . $context['gallery_pic']['filename']  . '" alt="" /></td>
         </tr>
         <tr class="windowbg2">

            <td>
            <b>' . $txt['gallery_form_description'] . ' </b>' . (parse_bbc($context['gallery_pic']['description'])  ). '
            <hr />
            ' . $txt['gallery_text_picstats'] . '<br />

            ' . $txt['gallery_text_views'] . $context['gallery_pic']['views'] . '<br />
            ' . $txt['gallery_text_filesize']  . gallery_format_size($context['gallery_pic']['filesize'],2) . '<br />
            '  . $txt['gallery_text_height'] . ' ' . $context['gallery_pic']['height']  . '  ' . $txt['gallery_text_width'] . ' ' . $context['gallery_pic']['width'] . '<br />
            ';
   
            if (!empty($context['gallery_pic']['keywords']))
            {
            
               echo $txt['gallery_form_keywords'] . ' ';
               for($i = 0; $i < $keywordscount;$i++)
               {
                  echo '<a href="' . $scripturl . '?action=gallery;sa=search2;key=' . $keywords[$i] . '">' . $keywords[$i] . '</a>&nbsp;';
               }
               echo '<br />';
               
            }


            

            if ($context['gallery_pic']['real_name'] != '')
               echo$txt['gallery_text_postedby'] . '<a href="' . $scripturl . '?action=profile;u=' . $context['gallery_pic']['id_member'] . '">'  . $context['gallery_pic']['real_name'] . '</a>' . $txt['gallery_at'] . $context['gallery_pic']['date'] . '<br /><br />';
            else
               echo $txt['gallery_text_postedby'] . $txt['gallery_guest']  . $txt['gallery_at'] . $context['gallery_pic']['date'] . '<br /><br />';
            
            
            
            // Show image linking codes
            if ($modSettings['gallery_set_showcode_bbc_image']  || $modSettings['gallery_set_showcode_directlink'] || $modSettings['gallery_set_showcode_htmllink'])
            {
               echo '<b>',$txt['gallery_txt_image_linking'],'</b><br />
               <table border="0">
               ';
               
               if ($modSettings['gallery_set_showcode_bbc_image'])
               {
                  echo '<tr><td width="30%">', $txt['gallery_txt_bbcimage'], '</td><td> <input type="text" value="(http://' . $modSettings['gallery_url'] . $context['gallery_pic']['filename']  . ')" size="50" /></td></tr>';
               }
               if ($modSettings['gallery_set_showcode_directlink'])
               {
                  echo '<tr><td width="30%">', $txt['gallery_txt_directlink'], '</td><td> <input type="text" value="' . $modSettings['gallery_url'] . $context['gallery_pic']['filename']  . '" size="50" /></td></tr>';
               }
               if ($modSettings['gallery_set_showcode_htmllink'])
               {
                  echo '<tr><td width="30%">', $txt['gallery_set_showcode_htmllink'], '</td><td> <input type="text" value="<img src=&#34;' . $modSettings['gallery_url'] . $context['gallery_pic']['filename']  . '&#34; />" size="50" /></td></tr>';
               }
               
               echo '</table>';
               
            }      

            // Show edit picture links if allowed
            if ($g_manage)
               echo '&nbsp;<a href="' . $scripturl . '?action=gallery;sa=unapprove;pic=' . $context['gallery_pic']['id_picture'] . '">' . $txt['gallery_text_unapprove'] . '</a>';
            if ($g_manage || $g_edit_own && $context['gallery_pic']['id_member'] == $id_member)
               echo '&nbsp;<a href="' . $scripturl . '?action=gallery;sa=edit;pic=' . $context['gallery_pic']['id_picture']. '">' . $txt['gallery_text_edit'] . '</a>';
            if ($g_manage || $g_delete_own && $context['gallery_pic']['id_member'] == $id_member)
               echo '&nbsp;<a href="' . $scripturl . '?action=gallery;sa=delete;pic=' . $context['gallery_pic']['id_picture'] . '">' . $txt['gallery_text_delete'] . '</a>';


            // Show report picture link
            if (allowedTo('smfgallery_report'))
               echo '&nbsp;<a href="' . $scripturl . '?action=gallery;sa=report;id=' . $context['gallery_pic']['id_picture'] . '">' . $txt['gallery_text_reportpicture'] . '</a>';
      

            echo '
            </td>
         </tr>';

      // Display who is viewing the picture.
      if (!empty($modSettings['gallery_who_viewing']))
      {
         echo '<tr>
         <td align="center" class="windowbg2"><span class="smalltext">';

         // Show just numbers...?
         // show the actual people viewing the topic?
         echo empty($context['view_members_list']) ? '0 ' . $txt['gallery_who_members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['gallery_who_hidden'] . ')');

         // Now show how many guests are here too.
         echo $txt['who_and'], @$context['view_num_guests'], ' ', @$context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['gallery_who_viewpicture'], '</span></td></tr>';
      }

echo '
      </table><br />';
   //Check if allowed to display comments for this picture
   if ($context['gallery_pic']['allowcomments'])
   {
      //Show comments
      echo '<table cellspacing="0" cellpadding="10" border="0" align="center" width="90%" class="tborder">
            <tr class="catbg">
               <td align="center" colspan="2">' . $txt['gallery_text_comments'] . '</td>
            </tr>';

      if (allowedTo('smfgallery_comment'))
      {
         //Show Add Comment
         echo '
            <tr class="titlebg"><td colspan="2">
            <a href="' . $scripturl . '?action=gallery;sa=comment;id=' . $context['gallery_pic']['id_picture'] . '">' . $txt['gallery_text_addcomment']  . '</a></td>
            </tr>';
      }

      // Display all user comments
   
      $comment_count = $context['gallery_comment_count'];

      foreach($context['gallery_comment_list'] as $row)
      {
         echo '<tr class="windowbg">';
         // Display member info
         echo '<td width="10%" valign="top">
         <a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">'  . $row['real_name'] . '</a><br />
         <span class="smalltext">' . $txt['gallery_text_posts'] . $row['posts'] . '</span><br />';
         // Display the users avatar
            $memCommID = $row['id_member'];
            loadMemberData($memCommID);
         loadMemberContext($memCommID);

         
         echo $memberContext[$memCommID]['avatar']['image'];
         
         echo '
         </td>';
         // Display the comment
         echo '<td width="90%"><span class="smalltext">' . timeformat($row['date']) . '</span><hr />';

         echo   parse_bbc($row['comment']);

         // Check if the user is allowed to delete the comment.
         if($g_manage)
            echo '<br /><a href="' . $scripturl . '?action=gallery;sa=delcomment;id=' . $row['id_comment'] . '">' . $txt['gallery_text_delcomment'] .'</a>';


         echo '</td>';
         echo '</tr>';
      }



      // Show Add Comment link again if there are more than one comment
      if( allowedTo('smfgallery_comment') && $comment_count != 0)
      {
       // Show Add Comment
         echo '
            <tr class="titlebg">
               <td colspan="2">
               <a href="' . $scripturl . '?action=gallery;sa=comment;id=' . $context['gallery_pic']['id_picture'] . '">' . $txt['gallery_text_addcomment'] . '</a>
               </td>
            </tr>';
      }

      echo '</table><br />';
   }
   

   // Link back to the gallery index
   echo '<div align="center"><a href="', $scripturl, '?action=gallery">' . $txt['gallery_text_returngallery'] . '</a></div><br />';



   GalleryCopyright();
}

and this the code from facebook plugins

Quote
<iframe src="http://www.facebook.com/plugins/like.php?app_id=170685896314252&amp;href=http%3A%2F%2Fedwinloyola.com%2Findex.php%3Faction%3Dgallery&amp;send=false&amp;layout=standard&amp;width=400&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:400px; height:35px;" allowTransparency="true"></iframe>

can you teach me how to do it?

thanks in advance,

Regards,

Rey