Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Output function

Hi there,i work on photogallery..

Look here and click photos please..

There are manuel change..

This code:
CodeDownload  
<a href='".FUSION_SELF."?photo_id=".$data['photo_id']."' class='photogallery_album_photo_link'><!--photogallery_album_photo_".$data['photo_id']."-->



Change to:

CodeDownload  
<a href='".PHOTODIR.$data['photo_filename']."' rel='grup' title='".$locale['453']."'><!--photogallery_photo_".$_GET['photo_id']."-->



Now, i want to meke this with output functions

code:

CodeDownload  
<?php

global $settings;

function fancybox_photogallery_album_output($output) {
   $search = array(
      "@</strong><br /><br />\n<a href='(.*?)' class='photogallery_album_photo_link'><!--photogallery_album_photo_(.*?)-->@si",
   );         
            

   $data = dbarray(dbquery("SELECT tp.photo_filename FROM ".DB_PHOTOS." tp WHERE album_id='".$_GET['album_id']."' GROUP BY photo_id ORDER BY photo_order LIMIT 1"));    

   $replace = array(
      '</strong><br /><br /><a rel="grup" href="'.PHOTODIR.$data['photo_filename'].'" class="photogallery_album_photo_link"><!--photogallery_album_photo_$2-->',

   );
   $output = preg_replace($search, $replace, $output);
   return $output;
}
add_handler("fancybox_photogallery_album_output");
}
?>



But there are a problem..i think problem is LIMIT.. Can you help me about it ?

Thank you..
What is the problem/error?

I'm not sure if it's the cause, but there's a "GROUP BY" clause which has nothing to group if the query is limited to 1. It also contains "tp" which is used to join queries (which isn't necessary in your code if I'm right).

Is your output-replacement working apart from the db-query?
Thanks for reply.. Yes,output replacement working..

Problem is this Look and click prew-next please..
showing thumb images there are no problem but show only one main image,no display other big image..
Your code replaces all album image-links with one and the same link. Maybe try it this way:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php

global $settings;

function fancybox_photogallery_album_output($output) {
$search = array(
"@</strong><br /><br />\n<a href='photogallery.php?photo_id=(.*?)' class='photogallery_album_photo_link'><!--photogallery_album_photo_(.*?)--><img src='(.*?)_t1.(.*?)'@si",
);
$replace = array(
'</strong><br /><br /><a rel="grup" href="$3.$4" class="photogallery_album_photo_link"><!--photogallery_album_photo_$2--><img src="$3_t1.$4"',
);
$output = preg_replace($search, $replace, $output);
return $output;
}
add_handler("fancybox_photogallery_album_output"wink;

?>[/syntaxhighlighter]In this example output replacement takes the thumbnail url into consideration, modifies it to a url without the thumbnail suffix and applies it to your link.

Mind the removed } character (before ?>wink which has no function in this snippet.
MM thank you but it isn't.. no working..

we want make this:
CodeDownload  
<a href='".FUSION_SELF."?photo_id=".$data['photo_id']."' class='photogallery_album_photo_link'><!--photogallery_album_photo_".$data['photo_id']."-->



change to this with output replacement:
CodeDownload  
<a href='".PHOTODIR.$data['photo_filename']."' rel='grup' title='".$locale['453']."'><!--photogallery_photo_".$_GET['photo_id']."-->



Examples:
Manuel changes (working fine)
output replacement (no display big pic)

Thank you..
I think that problem is in database codes. Because only first picture displays at all of the pictures.

Merged on Apr 17 2012 at 17:08:59:
I accidentally pressed the spam button. Sory...

Quote

Mehmet wrote:

I think that problem is in database codes. Because only first picture displays at all of the pictures.

Yes there is a problem with the query. But even when you solve it, there still is no way to tell output replacement which database-item to apply to what html part.
It's not impossible to do, but even manually editing photogallery.php is more easy than solving it the way you intend to.

Quote

HaYaLeT wrote:

it isn't.. no working..

You could try to step-by-step adapt your code to the example I provided. If you can get it to work (your site's " ' use or <br> <br /> might be different for example) it should replace output as you need it to (for every item, link to it's image-file instead of photogallery.php?photo_id=x).
Thread Information
Author
Replies
7 posts
Views
3430 times
Last Post
Last updated on 8 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: HaYaLeT, MM, Mehmet