After a quick examination, I found some room for improvement.
==================================================
As you go through includes/functions.php from top to bottom, the following lines are
not needed:
"media_src_big" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view, 1),
function get_media_code($media_file_name, $image_id = 0, $cat_id = 0, $image_name = "", $mode = "", $show_link = 0, $detailed_view = 0, $big = 0) {
Change this line from V@no
"media_src_big" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view, 1),
to this instead:
"media_src_big" => $media_src_big,
Continuing, the following line is
not needed:
$media = ((!$big) ? ($site_template->parse_template("media/".$file_extension)) : $media_src_big);
==================================================
Some inaccuracies also exist. It's not a big deal but since I've already found them, maybe posting improvements might interest someone.
There is no class "big" defined for this mod, so in details.html
<a class="big" href="javascript:openpopupbig('big')">
you can remove
class="big"
As long as I'm taking the time, in big.html maybe it's worth noting that the
<center></center>
is deprecated in the HTML 4.0 specification in favor of the DIV element. Therefore it's better to use this:
<div align="center"></div>
Deprecated means that future browsers won't be required to support the CENTER element.
In details.php:
$templates_used = 'details,header';
does not exist. Perhaps it's there for V@no from another mod?
==================================================
This note isn't anything big, but since there is no {image_id} tag created by details.php, it is safe to change
"image_id2" => $image_id,
to
"image_id" => $image_id,
I try to follow the 4images code style whenever possible so this is just a personal preference. For me, it makes reading the code easier since the naming convention is consistent. Again, not a big deal.
Also, instead of adding "big=1" to the URL, I find it more useful to specify a template to be used instead.
Open details.php. Replace this code
if (isset($_GET['big']) || isset($_POST['big'])) {
$templates_used = 'big,header';
$main_template = 'big';
}else{
$templates_used = 'details,header';
$main_template = 'details';
}
with this
$main_template = "details";
if (isset($_GET['template']) || isset($_POST['template'])) {
$template = (isset($_GET['template'])) ? stripslashes(trim($_GET['template'])) : stripslashes(trim($_POST['template']));
if (!file_exists(TEMPLATE_PATH."/".$template.".".$site_template->template_extension)) {
$main_template = $template;
}
}
Now you can use
var popurl="details.php?image_id={image_id}&template=big";
in the javascript that opens a new window. This makes details.php look for a template named "big.html" or whatever name you specify.
The javascript to open a new window has a compatibility limitation. It won't work if the user SHIFT-clicks in IE to try to open the link in a new window. It happens. Users don't know it will open in a new window so they try. Same applies for CTRL-click in Mozilla based browsers.
Also, to open a new window without certain features when using 'fullscreen', you don't have to explicitly use "feature=no". It's safe to just leave it out. The browser only adds features that are requested in this case.
So taking the javascript knowledge above, we can change our link that opens the image in a big window from:
{if media_src_big}
<script type="text/javascript">function openpopupbig(big){var popurl="details.php?image_id={image_id2}&big=1";settings='fullscreen,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=no';winpopsbigWindow=window.open(popurl,big,settings);winpopsbigWindow.focus();}</script>
<a class="big" href="javascript:openpopupbig('big')">{endif media_src_big}
{image}{if media_src_big}</a>{endif media_src_big}
to this
{if media_src_big}
<script language="JavaScript" type="text/javascript">
function openBigWindow(url) {
bigwindow = window.open(url,'bigwindow','fullscreen,scrollbars=yes,resizable=yes');
bigwindow.focus();
}
</script>
<a href="./details.php?image_id={image_id}&template=big" onClick="openBigWindow(this.href);return false;">
{image}</a>{endif media_src_big}
By the way, the script language should always be specified. It's more important to a browser that the script type.
Here's a great online javascript reference:
http://www.devguru.com/Technologies/ecmascript/quickref/javascript_index.htmlLastly: Thank you V@no for this mod! I've always wanted 4images to do this and your mod came along just when I needed it. So don't anyone think that I'm ungrateful.
Edit: Corrected a statement I made about how javascript window.open() works.