LightNEasy Support Forum
LightNEasy Mini 2.4 released, LightNEasy 3.2.1 released.
You are not logged in.
#1 2010-07-27 08:42:40
- moonrakre
- Member
- Registered: 2009-09-16
- Posts: 79
Lytebox addon LNE 3.2
In the general content I have for some time wanted to be able to put single pictures which show large on click. With the introduction of addons in 3.2 I now find I can do this much more easily with a lytebox addon, as I have seen some posts requesting such a feature I am making this available to the LNE community.
Here are the instructions:
lytebox addon:
Installation
Create a folder inside Addons folder with a name lytebox (using FTP).
Put two files into the lytebox folder:
header.php and main.php (see below).
Create a record in addons: (use query database and replace LNE_ with your own prefix):
Code:
INSERT INTO `LNE_addons` ( `name`, `fname`, `aname`, `active`, `adminlevel`, `header`) VALUES ( 'lytebox', 'lytebox', NULL, 1, 1, 1);
Usage
Code:
%!$lytebox galleryname imagename Picture_Title alignment;hspace;vspace;border;group$!%
Where Picture_Title is the name that will appear as the title and the alt text. NOTE there must be no spaces in the picture title, but any underscores "_" will be converted to spaces.
and group is a name used to group pictures so that the viewer can pass from one to another, if the word gallery is used as the group then the images will be grouped according to the galleryname parameter. Note that this group can transcend galleries, but it only applies to pictures on the same page.
The parameter string (alignment;hspace;vspace;border;group) must use ; as a separator, if the rightmost are not needed they can be missing but if ones in the middle are not need they must still have their separator (and no space between the separators), and there must be no more one space between any of the elements of the call.
Galleryname and imagename are required, if one is missing then an error "=== MISSING IMAGE PARAMETER IN LYTEBOX ===" will show where the picture should be.
If the image doesn't exist in the gallery specified then an error message "=== IMAGE DOES NOT EXIST IN LYTEBOX ===" will show where the picture should be.
e.g:
Code:
%!$lytebox one 445764_920.jpg Jennifer_Aniston right;20;5;7;friends$!% %!$lytebox two 445775.jpg Lisa_Kudrow left;20;;;friends$!%
The pictures must be uploaded using the Images feature of LightNeasy, i.e. they must be part of the galleries in LNE. You can of course set up a separate gallery for the pictures to be used for the litebox display. This also means that the thumbnail size is determined by the settings for Galleries.
main.php
Code:
<?php
/*---------------------------------------------------+
| LightNEasy Content Management System
| Copyright 2007 - 2010 Fernando Baptista
| http://www.lightneasy.org
+----------------------------------------------------+
| Addon Lytebox run module main.php
| Version 3.2 SQLite/MySQL
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
function lytebox($gallery, $image, $title, $param ) {
if($gallery=="" || $image=="") return "<p><span style=\"color: rgb(255, 0, 0);\"><span style=\"font-size: x-large;\"><strong>=== MISSING IMAGE PARAMETER IN LYTEBOX ===</strong></span></span></p>";
if(!file_exists("./galeries/".$gallery."/".$image)) return "<p><span style=\"color: rgb(255, 0, 0);\"><span style=\"font-size: x-large;\"><strong>=== IMAGE DOES NOT EXIST IN LYTEBOX ===</strong></span></span></p>";
$title2=str_replace("_"," ",$title);
if ($param != "") $param2=explode(";",$param);
$paramtext="";
// params are align;hspace,vspace;border;group
if ($param2[0]!="") $paramtext.=" align=\"".$param2[0]."\"";
if ($param2[1]!="") $paramtext.=" hspace=\"".$param2[1]."\"";
if ($param2[2]!="") $paramtext.=" vspace=\"".$param2[2]."\"";
if ($param2[3]!="") $paramtext.=" border=\"".$param2[3]."\"";
$out="<a title=\"".$title2."\" rel=\"lytebox";
if (strtolower($param2[4])=="gallery") $out.="(".$gallery.")";
elseif ($param2[4]!="") $out.="(".$param2[4].")";
$out.="\" href=\"/galeries/";
$out.=$gallery."/".$image."\"><img".$paramtext;
$out.=" src=\"/thumbs/".$image."\" alt=\"";
$out.=$title2."\" /></a>";
return $out;
}
?>header.php
Code:
<?php
/*---------------------------------------------------+
| LightNEasy Content Management System
| Copyright 2007 - 2010 Fernando Baptista
| http://www.lightneasy.org
+----------------------------------------------------+
| Addon Lytebox header module header.php
| Version 3.2 SQLite/MySQL
| Copy of Lyteframe header module
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
$out=str_replace("</head>","<link rel=\"stylesheet\" href=\"css/lytebox.css\" type=\"text/css\" media=\"screen\" />\n<script type=\"text/javascript\" src=\"js/lytebox.js\"></script>\n</head>",$out);
?>Best wishes
Adrian
Last edited by moonrakre (2010-07-27 13:13:19)
Offline