forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: falarious on December 05, 2005, 02:24:04 am

Title: Using this code in theme.inc.php
Post by: falarious on December 05, 2005, 02:24:04 am
I would like to use this code

Code: [Select]
<a href="aim:goim?screenname=Friends+Screen+Name&message=Check+This+Out!+http://www.domain.com<? echo $_SERVER['PHP_SELF'];?>">My TExt </a>But, after i place it, a white page come up.

How can i fix it?
Title: Re: Using this code in theme.inc.php
Post by: Joachim Müller on December 05, 2005, 08:06:06 am
where exactly did you put this code to accomplish what? Don't edit themes.inc.php unless you really, really know what you're doing. Edit themes/yourtheme/theme.php instead!
Title: Re: Using this code in theme.inc.php
Post by: falarious on December 06, 2005, 04:07:31 am
This code will be so that a peron will be able to AOL Instant Message the current link to someone on AIM. Kinda like the "Send this page to a friend" thing.

Code: [Select]
<? echo $_SERVER['PHP_SELF'];?>
Once i remove that piece of code from the theme.inc.php file, the hyperlink comes up, but not the exact way i want it.

I am guessing that the code above determines what comes after the URL.
e.g
www.mydoamin/STUFF_HERE

I tried using the code the same way the {CUSTOM_HEADER} works, but the link doesnt come out the way i want it to.



Title: Re: Using this code in theme.inc.php
Post by: Joachim Müller on December 06, 2005, 10:11:50 am
where exactly did you put this code
Title: Re: Using this code in theme.inc.php
Post by: falarious on December 07, 2005, 01:47:46 am
Quote
EOT;
// HTML template for intermediate image display
if (!isset($template_display_media))  //{THEMES}
$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2px" cellpadding="0px" class="imageborder">
                                <tr>
                                        <td align="center">
                                                {IMAGE}

                                        </td>
                                </tr>
                        </table>
                </td></tr>
                <tr><td>
                                                <table width="100%" cellspacing="2px" cellpadding="0px" class="tableb">
                                <tr>
                                        <td align="center">

                                                {ADMIN_MENU}
                                        </td>
                                </tr>
                        </table>





<!-- BEGIN img_desc -->
                        <table cellpadding="0px" cellspacing="0px" class="tableb" width="100%">
<!-- BEGIN title -->
                                <tr>
CODE HERE
                                        <td class="tableb"><center><b>
                                                {TITLE}
                                        </b></center></td>
                                </tr>
<!-- END title -->
<!-- BEGIN caption -->
                                <tr>
                                        <td class="tableb"><center>
                                                {CAPTION}<br><br>




                                        </center></td>
                                </tr>
<!-- END caption -->
                        </table>
<!-- END img_desc -->
                </td>
        </tr>

EOT;

There
Title: Re: Using this code in theme.inc.php
Post by: donnoman on December 09, 2005, 05:50:57 am
the code you posted will not work in a heredoc block. Since it's already being expanded for variables you should just be able to do:

Code: [Select]
<a href="aim:goim?screenname=Friends+Screen+Name&message=Check+This+Out!+http://www.domain.com{$_SERVER['PHP_SELF']}">My TExt </a>
Title: Re: Using this code in theme.inc.php
Post by: falarious on December 12, 2005, 12:04:30 am
the code you posted will not work in a heredoc block. Since it's already being expanded for variables you should just be able to do:

Code: [Select]
<a href="aim:goim?screenname=Friends+Screen+Name&message=Check+This+Out!+http://www.domain.com{$_SERVER['PHP_SELF']}">My TExt </a>

This code ALMOST works.

This is the link http://mydomain.com/displayimage.php?pos=-686

but it comes out like this  http://mydomain.com/displayimage.php

Title: Re: Using this code in theme.inc.php
Post by: donnoman on December 12, 2005, 02:44:07 am
Well the code you posted did precisely what you had asked for.

but why don't we convert this thing to a plugin.

this is the meat of the codebase:
Code: [Select]
if (defined('DISPLAYIMAGE_PHP')) {
    $thisplugin->add_action('page_start','goaim_pagestart');
    $thisplugin->add_filter('post_breadcrumb','goaim_mod_block');
}

function goaim_mod_block()
{
    global $CURRENT_PIC_DATA, $CONFIG, $picture;
       
    $title=<<<EOT
        <div class="alblink">
            <a href="aim:goim?screenname=Friends+Screen+Name&message=Check+This+Out!+{$CONFIG['ecards_more_pic_target']}{$_SERVER['PHP_SELF']}?pos=-{$CURRENT_PIC_DATA['pid']}">AIM Buddy Notify!</a>
        </div>
EOT;
   
    $picture=str_replace('{GOAIM}',$title,$picture);
}

function goaim_pagestart()
{
  global $template_display_media;
  $template_display_media = str_replace('{ADMIN_MENU}','{GOAIM}{ADMIN_MENU}',$template_display_media);
}

plugin attached, modify to suit.

Note that I am actually placing the HREF slightly above where you specified because the image description section is only displayed on images that have a title or description and wouldn't be shown on images that didn't have at least one of those.  By co-opting the admin menu space you will see it on every image.
Title: Re: Using this code in theme.inc.php
Post by: falarious on December 12, 2005, 06:22:58 am
Thanks Don!!

This plugin works fantastic!!