coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: just_some_guy on October 06, 2007, 07:57:23 PM

Title: Link to other site upon viewing...
Post by: just_some_guy on October 06, 2007, 07:57:23 PM
Hello,

Is it possible to achive this:

When a user clicks the intermediate image and arrives at the screen where you can add comments and rate the file etc. And when they click the image again it would be a link to another website. (this is the same a when you click on the thumbnail of a .zip, but instead of going to the download, it would go to another URL). I tried to upload a .html with a meta redirect in it. But it is not allowed file type even when i allowed in config as an allowed document type.

Is this possible?

Thanks,

just_some_guy
Title: Re: Link to other site upon viewing...
Post by: Joachim Müller on October 07, 2007, 09:44:16 AM
edit your theme, find the section that created the link to the full-size pop-up and modify the code accordingly to make the link point to your link instead of the full-size image.
Title: Re: Link to other site upon viewing...
Post by: just_some_guy on October 07, 2007, 09:51:42 AM
Okay, thanks. Is there anyway to apply this to only one category?

thanks,
Title: Re: Link to other site upon viewing...
Post by: Joachim Müller on October 07, 2007, 09:54:59 AM
If you code it: yes.
Title: Re: Link to other site upon viewing...
Post by: just_some_guy on October 07, 2007, 10:09:48 AM
Ok, its something to look into...

Thanks,
Title: Re: Link to other site upon viewing...
Post by: just_some_guy on October 07, 2007, 05:57:48 PM
Would an if/else argument work on this?

example.

if - category id = 6

then you would define a site to link to.

else - the usal

Title: Re: Link to other site upon viewing...
Post by: just_some_guy on October 11, 2007, 09:57:25 PM
I have decided to do this another way. But i cant seem to get the code to work. When i paste the code under the {image} section of theme.php it just shows it as text.

See here for more info: http://forums.devshed.com/php-development-5/mysql-php-select-if-row-has-content-480976.html#post1912070 . I have been trying to code this with some help from the people there.

The following code is from the help i got in that link.

$query  = "SELECT download_link FROM cpg1411_pictures WHERE pid='".mysql_real_escape_string($pid)."'"; // add this if you haven't already sanitized your inputs.   
$result = mysql_query($query);   

if (mysql_num_rows($result) > 0) { // check to see that the row does exist   
    $row = mysql_fetch_assoc($result); 
    if ($row['download_link'] != '') { 
      echo  "<a href="{$row['download_link']}"> DOWNLOAD </a><br>"; // make sure your download link data is pointed to the right path to the files 
    } 

} else { 
    echo 'click above to download this file'; 



But i need this to be displayed here:


</td>
        </tr>

EOT;

// HTML template for intermediate image display
$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2" cellpadding="0" class="imageborder">
                                <tr>
                                        <td align="center">
                                                {IMAGE}

                                        </td>
                                </tr>
                        </table>
                </td></tr>


Below the {image}. It works as simple html <a href

But when i use the mysql code there it just errors or display nothing.

Can you help please.

Thanks.
Title: Re: Link to other site upon viewing...
Post by: just_some_guy on October 12, 2007, 07:04:09 PM
Hello,

i have a problem. I have the following code, which returns a url from the database if there is one in that row and if not it then display a link called home.

here is the code:





$query  = "SELECT download_link FROM cpg1411_pictures WHERE pid='".mysql_real_escape_string($pid)."'"; // add this if you haven't already sanitized your inputs.     
$result = mysql_query($query);     

if (mysql_num_rows($result) > 0) { // check to see that the row does exist     
    $row = mysql_fetch_assoc($result);   
    if ($row['download_link'] != '') {   
      $download_link =  ' echo <a href="'.$row['download_link'].'"> DOWNLOAD </a><br>';// make sure your download link data is pointed to the right path to the files   
    }   

} else {   
    $download_link = '<a href="http://www.mysimtractor.com">Home </a>';   
}

as you can see the revelent parts are defined as $download_link i need to echo that variable around the {image}

here:



$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2" cellpadding="0" class="imageborder">
                                <tr>
                                        <td align="center"> 
                                                {IMAGE}
                                        </td> 
                                </tr>
                        </table>
                </td></tr>
                <tr><td>


However the problem is that when i echo the variable below the {image} it just displays the home link despite thre being content in the download_coloum. I have been getting help form  here  (http://forums.devshed.com/php-development-5/mysql-php-select-if-row-has-content-480976-2.html#post1912676) and they say it is something in coppermine that is preventing this.

Can you please help me.

Thanks!
Title: Re: Link to other site upon viewing...
Post by: just_some_guy on October 12, 2007, 08:15:16 PM
would an easier way to do this just echo $CURRENT_PIC_DATA['download_link'] below the {image}

How would i do this?
If there was no content in that field would it still work?

please help,

thanks.
Title: Re: Link to other site upon viewing...
Post by: Stramm on October 12, 2007, 08:44:02 PM
if you want to go the plugin way, then have a look at my bbcode plugin. It demonstrates how to add data below the intermediate image

http://forum.coppermine-gallery.net/index.php?topic=36302.0
Title: Re: Link to other site upon viewing...
Post by: just_some_guy on October 12, 2007, 10:28:22 PM
Ok that helps alot. I have figured out away to do manally, but the plugin way looks better.

Thanks!

you can mark this as solved bow.