Another way to integrate Digg Another way to integrate Digg
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Another way to integrate Digg

Started by divestoclimb, January 08, 2009, 06:55:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

divestoclimb

I integrated Digg into my gallery with a little help from some old topics on the subject, but also some new ideas. Here's what I did:

  • Copy the entire function theme_html_picture() from themes/sample/theme.php into your theme's theme.php.
  • Find this section:

    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );

  • ABOVE it, add this (this lets you generate a permanent link to submit):

        $this_page = $_SERVER['REQUEST_URI'];
        if (strpos($this_page, "?") !== false) $this_page = reset(explode("?", $this_page));

    (code found in comment on http://us.php.net/manual/en/reserved.variables.server.php)
  • At the end of the list of parameters you found in step 2, add this (UPDATE added the http: part):

    '{PERMALINK}' => "http://".$_SERVER['SERVER_NAME'].$this_page."?pos=-$pid",

  • Copy and paste the $template_display_media section from themes/sample/theme.php into your theme.php, up until you see "EOT;"
  • Replace the last <table> section with this:

                            <table cellpadding="0" cellspacing="0" class="tableb" width="100%">
                                    <tr>
    <!-- BEGIN img_desc -->
                                            <td class="tableb" width="100%"><center>
    <!-- BEGIN title -->
                                                    <b>{TITLE}</b><br />
    <!-- END title -->
    <!-- BEGIN caption -->
                                                    {CAPTION}
    <!-- END caption -->
    </center></td>
    <!-- END img_desc -->
    <td class="tableb" align="right">
    <script type="text/javascript">
    digg_url='{PERMALINK}';
    </script>
    <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
    </td>
                                    </tr>
                            </table>


Egofreaky

My hat goes off to you sir for figuring this one out, as I've been looking for a Digg solution to coppermine for ages (and I'm no coder)... However, it's bloody confusing.
Step 2? What?

I hate to be picky, but do you think you could possibly rewrite this as step by step instructions? Please? I'd be amazingly grateful if you did.

Yes, I know I'm a n00b moron for not being able to figure this out.