Ugly URL after regex_replace

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
hwmd
New Member
New Member
Posts: 9
Joined: Mon Jun 01, 2015 12:28 pm

Ugly URL after regex_replace

Post 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.
hwmd
New Member
New Member
Posts: 9
Joined: Mon Jun 01, 2015 12:28 pm

Re: Ugly URL after regex_replace

Post by hwmd »

Is there no one here who sees a solution? Or maybe a step in the right way?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Ugly URL after regex_replace

Post 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.
hwmd
New Member
New Member
Posts: 9
Joined: Mon Jun 01, 2015 12:28 pm

Re: Ugly URL after regex_replace

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Ugly URL after regex_replace

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Ugly URL after regex_replace

Post 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>
hwmd
New Member
New Member
Posts: 9
Joined: Mon Jun 01, 2015 12:28 pm

Re: Ugly URL after regex_replace

Post by hwmd »

Thanks, I added that line of code but it makes no difference...
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Ugly URL after regex_replace

Post 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>
hwmd
New Member
New Member
Posts: 9
Joined: Mon Jun 01, 2015 12:28 pm

Re: Ugly URL after regex_replace

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

Return to “The Lounge”