Page 1 of 1

Ugly URL after regex_replace

Posted: Fri Jul 10, 2015 10:12 am
by hwmd
Hello,

I'm allmost finishing a CMS Made Simple website but I'm facing a weird problem:

I use FormBuilder for a contact form, on the bottom of a website consisting of one large single page. I first stuggled with the redirection after submitting when the user made an input error, because the page went to top while it should stay at the contact form. I'm glad I could fix that with this line of code (thanks, Velden):

Code: Select all

{FormBuilder|regex_replace:'/action="(.*)"/U':'action="$1#your-hash-tag"' form='contact-form'}
But now the problem is that my base URL is automatically redirected to "http://www.website.com/submap/#ae-image-0", where /#ae-image-0 should be left out...
It's only the URL, the page starts just fine at the top. And yes I use the (AE-)gallery module, but I don't know why this happens? (I'm not that good with smarty tags / JS)

The website itself is working fine, it's just that ugly URL. I'm quite sure the regex_replace affects it but I got no clue how to correct it. The base-URL in the source code is also fine. Can anyone help? Thanks alot.

Re: Ugly URL after regex_replace

Posted: Mon Jul 13, 2015 8:29 am
by hwmd
Is there no one here who sees a solution? Or maybe a step in the right way?

Re: Ugly URL after regex_replace

Posted: Mon Jul 13, 2015 8:40 am
by velden
You might want to share an url so we can see what's really happening. Not sure how a regex could influence the base url. And not sure what you mean exactly.

Re: Ugly URL after regex_replace

Posted: Mon Jul 13, 2015 9:39 am
by hwmd
I'm sorry, just tested again without the regex and the URL problem still exists, so it's not about the regex line, don't know why I thougt that...

When I navigate to the website "http://www.website.com/submap/", it automatically adds an anchor to the first image in the gallery (the browser doesn't navigate to it, stays at the top). I just don't want that anchor #ae-image-0 to show up in the website URL.
This thing also happens when I submit the form.

I can pm you the exact web-address, but only the name of the website and submap differ. Thanks for your feedback.

Re: Ugly URL after regex_replace

Posted: Mon Jul 13, 2015 9:48 am
by velden
You can PM the url.

There must be some logic somewhere that adds the hash. I'd expect some js in this case.

Re: Ugly URL after regex_replace

Posted: Mon Jul 13, 2015 11:26 am
by velden
Try this:

Code: Select all

<__script__ type="text/javascript">
  $(function() {
    var galleries = $('.ae-gallery').aeGallery({
      loader_image: 'modules/Gallery/templates/ae-gallery/loader.gif',
      slideshow: {
        autostart: false,
        update_window_hash: false, // <-- NEW OPTION
        speed: 4000,
        start_label: 'Start',
        stop_label: 'Stop',
        stop_on_scroll: false
      }
    });
  });
</__script>

Re: Ugly URL after regex_replace

Posted: Mon Jul 13, 2015 11:39 am
by hwmd
Thanks, I added that line of code but it makes no difference...

Re: Ugly URL after regex_replace

Posted: Mon Jul 13, 2015 12:45 pm
by velden
My bad, I'm sorry (not really ;) )

Code: Select all

<__script__ type="text/javascript">
  $(function() {
    var galleries = $('.ae-gallery').aeGallery({
      loader_image: 'modules/Gallery/templates/ae-gallery/loader.gif',
      update_window_hash: false, // <-- NEW OPTION
      slideshow: {
        autostart: false,
        speed: 4000,
        start_label: 'Start',
        stop_label: 'Stop',
        stop_on_scroll: false
      }
    });
  });
</__script>

Re: Ugly URL after regex_replace

Posted: Mon Jul 13, 2015 1:07 pm
by hwmd
That solved it! Thanks alot. I guess this would be very hard for me to find, never heard of that window_hash thing before. Thanks again and this topic can be marked as solved.