Hi, I have a fairly image intensive site (I make 3d models to use in the Sims2 and Sims3 PC games and offer them for free download on my site) and so I like to have a lot of pictures in my threads so my users can see what they are getting.
As sims is a real girls game I have mostly female members on my forum - and so the site needs to look pretty and no taking them off the site for new windows as they appear to get lost and confused when that happens...
I use the lightbox plug in at the moment and that works great on MYBB attachments, but I cant work out how to get the number/name out of the x threads attachments.
I had a look at how the lightbox plug in works and it does a preg_replace to find the aid number.
Code:
function lightbox2($page)
{
global $mybb,$db;
if(THIS_SCRIPT=="showthread.php")
{
$result=$db->simple_select("threads","fid","tid='".intval($mybb->input["tid"])."'",array("limit"=>1));
$thread=$db->fetch_array($result);
$permissions=forum_permissions($thread["fid"]);
if(!empty($thread)&&$permissions["candlattachments"]==1)
{
$page=str_replace("</head>",'<link rel="stylesheet" type="text/css" href="'.$mybb->settings["bburl"].'/themes/lightbox.css" />
<script type="text/javascript" src="'.$mybb->settings["bburl"].'/jscripts/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="'.$mybb->settings["bburl"].'/jscripts/lightbox/lightbox.js"></script>
</head>',$page);
$page=preg_replace('/\<a href="attachment.php\?aid=([0-9]+)" target="_blank"\>\<img/Usi','<a href="attachment.php?aid=$1" rel="lightbox[tid'.intval($mybb->input["tid"]).']"><img',$page);
return $page;
}
}
}
|
So I thought, hmm, maybe I can swap the code from x-threads images into that preg_replace bit (Im a noob ). So I had a look at the image names on my xthreads images and I'm stumped. I'm using RateU's excellent Product Review set up. I have a link like below for the url:
Code:
http://www.leefish.nl/mybb/xthreads_attach.php/30_1273886872_25376ecb/40b97b161bf0f01d571b319ea3f39d05/bag2.gif
|
and a link like below for the thumb
Code:
http://www.leefish.nl/mybb/xthreads_attach.php/30_1273886872_25376ecb/40b97b161bf0f01d571b319ea3f39d05/bag2.gif/thumb160x120
|
So I guess I need to get the thumb and replace it with the number in the url, but I dont see how the images are identified like in that light box code. The numbers are consistent - they begin at 1 and go up to 30 (so far), I'm not sure what all the gobbledegook numbers after the first two digits are. I saw in the x threads that there is a magic number field but I don't really get what that is for either. I have tried all kinds of javascript andjQuery scripts, but I either can't get them to work or they look ugly (see above requirement to look pretty).
So, at the end of a very long rambling thread, can anyone help me to get a lightbox effect using x threads attachments?
You can use rel attribute in Display Format of the picture.
Rateu, you are indeed truly awesome. Thank you.
Glad you got it working
(05-26-2010 01:15 AM)leefish Wrote: [ -> ]I'm not sure what all the gobbledegook numbers after the first two digits are.
If you're wondering, some are for optimisation, and some are meant to be random to prevent people from guessing the URL of files.
Arguably unnecessary, but generally shouldn't hurt
Hi RateU - yes, I got it working - I have made a link in the first post so it shows the main pic in a little slide show. Here is a link to what I made using your tutorial: Guests can view.
http://www.leefish.nl/mybb/forumdisplay.php?fid=30
Also, I put a <br /> in the blank replacement value of the additional picture field as it was showing a 0 in thethread if there was no picture.
I will post my edits in your thread if you think its worth it?
(05-27-2010 09:04 AM)leefish Wrote: [ -> ]Hi RateU - yes, I got it working - I have made a link in the first post so it shows the main pic in a little slide show.
Very nice, Lee
Mmm.. Please don't misunderstand me... I think you need to "review" your template. You have missed some close tags
(05-27-2010 09:04 AM)leefish Wrote: [ -> ]Also, I put a <br /> in the blank replacement value of the additional picture field as it was showing a 0 in thethread if there was no picture.
That's why I put
in the
Blank Replacement Value for the additional pictures
(05-27-2010 09:04 AM)leefish Wrote: [ -> ]I will post my edits in your thread if you think its worth it?
Of course. I believe that is what the XThreads forum for. To share our idea and modification
Oh yes, I have updated it to make it "compatible" with the newest XThreads version.
Thanks, Lee
Yes, I was looking at the WS3 code validator thing - I'm not sure why, but it hates all my <br /> tags and says they are wrong. So I was working on the templates and got a shade carried away..... I have fixed it now.
Yay that you have updated the templates! Cool, now I can also download the new version
. I will have a lot of trouble carefully going through all my X threads replacing code, so I really appreciate that. The new updates that Zinga posted look great though, and well worth the effort. X threads is a super plug in.
I have been updated all my example there, Lee
Yep, XThreads is a super tools plugin
Amazing.
EDIT: Related to your template, I believe the <br /> should be like that. The W3C Validator "hates" it because there are some other tags isn't closed
Example (showthread page):
Your header template:
HTML Code
<td class="thead" colspan="6"
|
Your dropdown menu:
HTML Code
<img src="images/NewFish/thing.gif"
<div id="forumlink__popup" class="popup_menu" style="display: none;"
|
And many  
should be
And add alt and title attribute in each image tags. W3C "loves" it
template_prefix_forumdisplay_thread:
HTML Code
<a href="forumdisplay.php?fid=30&filtertf_ep_prefix=Prefix 5"
|
Looks like it comes up now, but yeah, you still have a few issues here and there, like the following:
HTML Code
</div>
</td>
</strong>
</table>
</html>
<link rel="stylesheet" type="text/css" href="http://www.leefish.nl/mybb/themes/lightbox.css" />
<script type="text/javascript" src="http://www.leefish.nl/mybb/jscripts/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="http://www.leefish.nl/mybb/jscripts/lightbox/lightbox.js"></script>
</head>
|
Also look through your HTML (view -> source) and search for instances of "lightbox" - I think you have more than one lightbox.js around the place, which might cause some confusion.
Hope that helps.