× Form Help

URL parts in a variable

  • Eddy.vh
  • Eddy.vh's Avatar Topic Author
  • Away
  • Gold Boarder
  • Gold Boarder
  • Posts: 236
  • Karma: 1
  • Thank you received: 26

Eddy.vh created the topic: URL parts in a variable

Hello.

I would like to retrieve two parts of a referent url.
The url is as follows:
www.site.com/index.php/agenda/icalrepeat...noi-de-regularite-j2
and sometimes as follows:
www.site.com/index.php/agenda/icalrepeat...-regularite-j2?pop=0

In either case, I'd like to recover
the date of the event 2019/09/12 in a variable
and the name of the tournament-de-regularite-j2 event in a second variable

How to implement this?
I have tested with urlFrom.split('anything'); but I can't isolate what I need.

Thank you for your help
#237761
  • Posts: 5930
  • Karma: 118
  • Thank you received: 550

MarioPuco replied the topic: URL parts in a variable

Hi Eddy,

www.site.com/index.php/agenda/icalrepeat...-regularite-j2?pop=0

For this link you can do it like this :
var a = window.document.location.href;
a.substring(55, 70);
// This would result in 2019/09/12/2517

www.w3schools.com/jsref/jsref_substring.asp

Maybe there is a better way to do this but I think this should work.

Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#237763
The following user(s) said Thank You: Eddy.vh
  • Eddy.vh
  • Eddy.vh's Avatar Topic Author
  • Away
  • Gold Boarder
  • Gold Boarder
  • Posts: 236
  • Karma: 1
  • Thank you received: 26

Eddy.vh replied the topic: URL parts in a variable

Hi Mario.

Thank you for your answer.
I will test it. ;)
#237772
The following user(s) said Thank You: MarioPuco
  • Eddy.vh
  • Eddy.vh's Avatar Topic Author
  • Away
  • Gold Boarder
  • Gold Boarder
  • Posts: 236
  • Karma: 1
  • Thank you received: 26

Eddy.vh replied the topic: URL parts in a variable

Hi Mario.

Perfect, I was able to achieve what I want.

One more question, is it possible to retrieve the content of the "title" tag of the referrer page? I don't think so, but I could be wrong.

document.referrer.title does not work...
#237776
  • Posts: 5930
  • Karma: 118
  • Thank you received: 550

MarioPuco replied the topic: URL parts in a variable

Hey,

referrer Property gets the URL of the location that referred the user to the current page.
Title is a property of document/page and not of URL so I think this is not doable by any JS, but I could be wrong.

Maybe you are best of saving the title into a variable and sending it via POST.

Hope this helps.

Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#237778
  • Eddy.vh
  • Eddy.vh's Avatar Topic Author
  • Away
  • Gold Boarder
  • Gold Boarder
  • Posts: 236
  • Karma: 1
  • Thank you received: 26

Eddy.vh replied the topic: URL parts in a variable

Okay. I thought it was impossible.
Thank you for your answer.
#237783
Moderators: ForumSupporttomeperica
Time to create page: 0.075 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here