Perhaps you know the Gallery-Script
(E)2 Photo Gallery (
http://www.e2interactive.com).
I thought it would be great to simply integrate this gallery-script to MODx. So I’m not very experienced with programming, I thought of it as a challenge.
What I wanted, was a gallery for EACH Document. So the user should easily manage and upload Photos to a kind of document-gallery.
This gallery should also only show up on specific templates selected for the document.
And with a quite simple checkbox as TV, the user should turn the gallery on and off like he/she wants.
So it wasn’t enough to simply make a snippet, because I thought it would be a good idea if the user can upload and manage the photos of the gallery from within the document, therefore I made
* a plugin
* a snippet
* a TV
:::::::::::::::
The Plugin:
It checks if there already exists a gallery (actually its only a specific folder for each document where the photos and thumbnails are placed).
If yes, the plugin places a link to the manager of the gallery.
If not, the plugin places a link to the upload-manager of the gallery.
It’s quite simple, it just makes a link to the upload-script of (E)2 Photo Gallery or a small self-made script for showing the images of the (E)2 Photo Gallery.
:::::::::::::::
The Snippet:
Its only a smiple call the the snippet, without (many) options yet.
It creates the gallerycode if the TV is checked AND the gallery exists for this document.
:::::::::::::::
The TV:
Its just a checkbox:
Variable Name: e2galleryCheck
Input-Type: Checkbox
Input-Option-Values: Activate
:::::::::::::::
Install:
Download the ZIP and extract it.
Open config.php and eventuelly change it to mach with you behaviour.
Upload the folder e2_gallery to assets/snippets/.
Create the TV as mentioned in createTV.txt
Create the Snippet as mentioned in createSnippet.txt
Create the Plugin as mentioned in createPlugin.txt
IMPORTANT: You have to add the following lines into the header of you template(!) (as written in an earlier post, I don’t know if it is possible to manipulate the header of MODx directly with a snippet):
<!-- USED FOR (E)2 PHOTO GALLERY -->
<link rel="stylesheet" type="text/css" href="./assets/snippets/e2_gallery/css/e2.css" title="default" />
<link rel="alternate stylesheet" type="text/css" href="./assets/snippets/e2_gallery/css/e2photo_black.css" title="black" />
<link rel="alternate stylesheet" type="text/css" href="./assets/snippets/e2_gallery/css/e2photo_gray.css" title="gray">
<link rel="alternate stylesheet" type="text/css" href="./assets/snippets/e2_gallery/css/e2photo_lightgray.css" title="lightgray">
<link rel="alternate stylesheet" type="text/css" href="./assets/snippets/e2_gallery/css/e2photo.css" title="none">
<style type="text/css">
body{text-align:center;font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;}
img{border:none;}
</style>
<!-- END USED FOR (E)2 PHOTO GALLERY -->
If you did not install/upload the gallery to assets/snippets/e2_gallery, you will have to change this in the href.
That’s it.
Try to create a new document or edit an existing document, eventually with the specified template in config.php, and see if you find the link to manage the document-gallery at the buttom of the page.
Make a call to the snippet [[e2gallerySnippet]] in the document, if you have not "hard-coded" it into the template.
Try it and play a little bit around with it.
:::::::::::::::
What has NOT beeon done yet:
* Internationalization
* Customizing with the snippet-call
* Perhaps other things you know?
:::::::::::::::
I would be glad if someone tries this script just for fun and tells me what he/she thinks about it and what could be done even better.
Hope you enjoy it!