Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Lightbox photo gallery does not allow comments


Reply


5 Posts   3624 Views

Avatar
lusiton

13 Posts

18 November 2007 at 5:16am

Edited: 18/11/2007 5:19am

Hi guys.
I have a little problem with the Lightbox photo gallery.
It works fine until I add $comments and $form tags to the page.
It gives me a javascript error "Prototype.BrowserFeatures.XPath is null or not an object" and all images open in new window / tab . I tried to put the the tags in other sections on the page or create separate div for it but I get the same error until I remove them completely from the template.
Is there any body who had similar problem? I would like to learn how you solve it.
"http://www.myfriendsru.com/mysite/site/gallery-worcester/"

Thank you.

Avatar
Anatol

126 Posts

22 November 2007 at 4:26pm

Hi,

I am also looking for a way to make the gallery work with comments enabled. This would be quite a nice extra feature for a gallery.

I noticed that when I open a gallery page with comments enabled I get this error message in the Javascript console:

"Error: Prototype.BrowserFeatures has no properties
Source File: http://127.0.0.1:3000/gallery/javascript/prototype.js
Line: 2067"

The line 2067 is:

compileMatcher: function() {
// Selectors with namespaced attributes can't use the XPath version
if (Prototype.BrowserFeatures.XPath && !(/\[[\w-]*?:/).test(this.expression))
return this.compileXPathMatcher();

When I disable commenting I do not get this error message and the 'javascript popups' work fine.

If anyone has any idea how to solve this problem I would be grateful.

Cheers!
Anatol

(Note: the 'javascript popups' also do not work if the Silverstripe Navigator is visible, but this is not really a problem.)

Avatar
guillem_l

9 Posts

20 December 2007 at 11:39am

This is because the double inclusion of the prototype script.
When you enables the comments the prototype library is loaded from jsparty and cause an error. A rapid way to solve the problem is include the gallery scripts after the comments scripts. You can put the scripts directly in your page template after the body (not polite but works).
....
</head>
<body>
<script type="text/javascript" src="gallery/javascript/prototype.js"></script>
<script type="text/javascript" src="gallery/javascript/effects.js"></script>
<script type="text/javascript" src="gallery/javascript/lightwindow.js"></script>
....

Avatar
Anatol

126 Posts

20 December 2007 at 2:36pm

Hi guillem_l,

Thank you for that hint. That works.
Be aware that if you hard-code the gallery Javascript inclusions you need to remove or comment out the inclusions in the file /gallery/code/galleryPage.php in the GalleryPage_Controller init() method:

function init() {
   
      // Javascript Requirements
      
      //Requirements::javascript( "gallery/javascript/prototype.js" ); // comment or remove this line
      //Requirements::javascript( "gallery/javascript/effects.js" ); // comment or remove this line
      //Requirements::javascript( "gallery/javascript/lightwindow.js" ); // comment or remove this line   

If you don't remove these three lines the images get blown up to double size.

Cheers!
Anatol

Avatar
guillem_l

9 Posts

21 December 2007 at 9:28pm

Yes, do you have to comment the javascript inclusions from GalleryPapge.php and move the CSS inclusions to the Page.php to include them in all pages of you website, if not, some extra elements like ligthwindow divs will be visible at the end of the pages.