/*
Pixelpost version 1.7.1
Pixelpost www: http://www.pixelpost.org/
PPEndLoop Addon
made by Erik J. Barzeski
http://nslog.com/plugins/ppendloop
2008-09-24 version 1.0.0 - modified from ImageCycle (http://www.pixelpost.org/extend/addons/imagecycle/)
2008-11-25 version 1.0.1 - Renamed, posted to nslog.com/plugins
2008-11-25 version 1.1 - Added thumbnail and plain URL generation
================================================================
*/
$addon_name = "PPEndLoop";
$addon_description = "This addon stops the image cycle when a user reaches the first or last image.
You can use these new tags in your templates:
Tag: <IMAGE_ENDLOOP_PREV_LINK>
Tag: <IMAGE_ENDLOOP_PREV_THUMB>
Tag: <IMAGE_ENDLOOP_PREV_TITLE>
Tag: <IMAGE_ENDLOOP_PREV_URL>
Tag: <IMAGE_ENDLOOP_NEXT_LINK>
Tag: <IMAGE_ENDLOOP_NEXT_THUMB>
Tag: <IMAGE_ENDLOOP_NEXT_TITLE>
Tag: <IMAGE_ENDLOOP_NEXT_URL>
Tested with Pixelpost version 1.7.1";
$addon_version = "1.1";
//---------------------------------------------------------------------------
// if no previous image in index.php was found - get newest image
if($previous_row['id'] == "")
$prevlink = FALSE;
else
$prevlink = TRUE;
//---------------------------------------------------------------------------
//this section is copied from index.php
$image_previous_name = $previous_row['image'];
$image_previous_id = $previous_row['id'];
if($language_abr == $default_language_abr) {
$image_previous_title = pullout($previous_row['headline']);
}else{
$image_previous_title = pullout($previous_row['alt_headline']);
}
$image_previous_datetime = $previous_row['datetime'];
$image_previous_link = "$lang_previous";
if(!empty($image_previous_name)) { list($local_width,$local_height,$type,$attr) = getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_previous_name); }
$image_previous_thumbnail = "
";
$image_previous_url = "$showprefix$image_previous_id";
if($image_previous_id == "") {
$image_previous_id = $image_id;
$image_previous_title = "$lang_no_previous";
$image_previous_link = "";
$image_previous_thumbnail = "";
}
//---------------------------------------------------------------------------
// if no next image in index.php was found - get oldest image
if($next_row['id'] == "")
$nextlink = FALSE;
else
$nextlink = TRUE;
//---------------------------------------------------------------------------
//this section is copied from index.php
$image_next_name = $next_row['image'];
$image_next_id = $next_row['id'];
if($language_abr == $default_language_abr) {
$image_next_title = pullout($next_row['headline']);
}else{
$image_next_title = pullout($next_row['alt_headline']);
}
$image_next_datetime = $next_row['datetime'];
$image_next_link = "$lang_next";
if(!empty($image_next_name)) { list($local_width,$local_height,$type,$attr) = getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_next_name); }
$image_next_thumbnail = "
";
$image_next_url = "$showprefix$image_next_id";
if($image_next_id == "")
{
$image_next_id = $image_id;
$image_next_title = "$lang_no_next";
$image_next_link = "";
$image_next_thumbnail = "";
}
if($prevlink)
{
$tpl = ereg_replace("", $image_previous_link, $tpl);
$tpl = ereg_replace("", $image_previous_thumbnail, $tpl);
$tpl = ereg_replace("", $image_previous_title, $tpl);
$tpl = ereg_replace("", $image_previous_url, $tpl);
}
else
{
$tpl = ereg_replace("", $lang_previous, $tpl);
$tpl = ereg_replace("", "", $tpl);
$tpl = ereg_replace("", $image_previous_title, $tpl);
$tpl = ereg_replace("", "", $tpl);
}
if($nextlink)
{
$tpl = ereg_replace("", $image_next_link, $tpl);
$tpl = ereg_replace("", $image_next_thumbnail, $tpl);
$tpl = ereg_replace("", $image_next_title, $tpl);
$tpl = ereg_replace("", $image_next_url, $tpl);
}
else
{
$tpl = ereg_replace("", $lang_next, $tpl);
$tpl = ereg_replace("", "", $tpl);
$tpl = ereg_replace("", $image_next_title, $tpl);
$tpl = ereg_replace("", "", $tpl);
}
?>