Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Link to other site upon viewing...  (Read 4766 times)

0 Members and 1 Guest are viewing this topic.

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Link to other site upon viewing...
« 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
« Last Edit: October 14, 2007, 10:33:11 am by GauGau »
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Link to other site upon viewing...
« Reply #1 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.
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Link to other site upon viewing...
« Reply #2 on: October 07, 2007, 09:51:42 am »

Okay, thanks. Is there anyway to apply this to only one category?

thanks,
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Link to other site upon viewing...
« Reply #3 on: October 07, 2007, 09:54:59 am »

If you code it: yes.
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Link to other site upon viewing...
« Reply #4 on: October 07, 2007, 10:09:48 am »

Ok, its something to look into...

Thanks,
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Link to other site upon viewing...
« Reply #5 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

Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Link to other site upon viewing...
« Reply #6 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.

Code: [Select]
$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:

Code: [Select]
</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.
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Link to other site upon viewing...
« Reply #7 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:


Code: [Select]


 $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:

Code: [Select]

$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 and they say it is something in coppermine that is preventing this.

Can you please help me.

Thanks!
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Link to other site upon viewing...
« Reply #8 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.
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Link to other site upon viewing...
« Reply #9 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

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Link to other site upon viewing...
« Reply #10 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.
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 20 queries.