Forums

Get dynamic the url of the page

smousionis 31 Jul, 2012
Hello everyone. I want to ask something. I created a form for "expression of interest" for a real estate website. Here is a single property "http://greekhorizon.gr/index.php/en/component/k2/item/71-for-sale,-maisonette-118,40-sq-m,-kriopigi,-chalkidiki,-%E2%82%AC-640-000". I want when i get the email by the form for the "expression of interest", the email to contain the url of the page so to understand for which property the client is interested. Can this be done? And if yes how can i do it? Thanks in advance!
smousionis 31 Jul, 2012
I added a Custom Element from the Advanced Elements Group to the Preview box. Then i clicked the Configure button for it. Then i added the code to the code box:

<input type='hidden' name='page_url' id='page_url' value='<?php echo JURI::root(); ?>' />

and then i saved it. Then i went to the "Email" tab and i clicked "Generate Auto Template". For the custom element it gives me:

{page_url}' />

And then i save it. When i get the email from the form i get back:

http://greekhorizon.gr/' />

But i should get:

http://greekhorizon.gr/index.php/el/component/k2/item/61-%CF%80%CF%8E%CE%BB%CE%B7%CF%83%CE%B7,-%CE%BC%CE%B5%CE%B6%CE%BF%CE%BD%CE%AD%CF%84%CE%B1-118,40-%CF%84-%CE%BC-,-%CE%BA%CF%81%CF%85%CE%BF%CF%80%CE%B7%CE%B3%CE%AE,-%CF%87%CE%B1%CE%BB%CE%BA%CE%B9%CE%B4%CE%B9%CE%BA%CE%AE,-%E2%82%AC-640-000?chronoform=chrono_gr_1&event=submit

What have i done wrong?
smousionis 31 Jul, 2012
I found the solution. I had to change "JURI::root" to "JURI::current()"
GreyHead 31 Jul, 2012
Hi smousionis,

Sorry, my mistake, I've updated the FAQ.

Bob
smousionis 01 Aug, 2012
Thanks for help! The FAQ helped me. 😀
This topic is locked and no more replies can be posted.