Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Lightbox photo gallery does not allow comments

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

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

Page: 1
Go to End
Author Topic: 3548 Views
  • lusiton
    Avatar
    13 Posts

    Lightbox photo gallery does not allow comments Link to this post

    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.

  • Anatol
    Avatar
    126 Posts

    Re: Lightbox photo gallery does not allow comments Link to this post

    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.)

  • guillem_l
    Avatar
    9 Posts

    Re: Lightbox photo gallery does not allow comments Link to this post

    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>
    ....

  • Anatol
    Avatar
    126 Posts

    Re: Lightbox photo gallery does not allow comments Link to this post

    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

  • guillem_l
    Avatar
    9 Posts

    Re: Lightbox photo gallery does not allow comments Link to this post

    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.

    3548 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.