getThemePath()

Permalink
Hey all. I am having a bit of a dumb problem with the above.

I have the following in two docs:
1) HTML Form excerpt
==================
action="assets/php/send-form-data.php"

2) JS Validator script excerpt
=======================
$.ajax({
type: "POST",
url: "assets/php/send-form-data.php",

I have tried every which way I can think of/devize to use "get them path" to provide the path to the resources. Most ideas come from Andrews HTML conversion vids as well as posts on this forum.

It works if I specify the fully qualified site URL, but that I fear is the wrong way to do things given there will be C5 updates/changes etc in the future.

So, I suspect that I don't really know how to code this.

Any pointers or thoughts are appreciated.

 
hutman replied on at Permalink Reply
hutman
I'm not quite following what you're asking for help with. Can you explain a little more?
goomba replied on at Permalink Reply
Ah, I figured I was a little cryptic, so here goes another shot.

We have a form that we have created and use on other sites. This is not a C5 component or block. What I'd like to do is in the form declaration not use the literal path this:
form class="well form-horizontal" action="/site_root/concrete/scripts/php/send-form-results.php" method="post"

I'd like to make this more C5-able by using getthemepath (or similar element) to use the path for the active theme. This would accomplish several things:
1) Make it more "portable" for other sites we build,
2) More importantly, make it more C5-abable to allow for C5 changes in the future.

The same principle for our ajax call:
url: "/site_root/concrete/scripts/php/send-form-results.php",
data: "name=" + contact_name + "&phoneno=" + contact_phone + "&email=" + contact_email + "&message=" + contact_message ETC..,

Does this make sense?
hutman replied on at Permalink Reply
hutman
If you're using a package you could put the send-form-data information in a class and then create a route to it in your controller's on_start function. That would make it very portable.
goomba replied on at Permalink Reply
I understand your thought; but we are still quite new to C5 V8 (only a few months) and are taking things one step at a time. Idea being to use what we know works, put it into c5 and "tweak" it so we get a better understanding of how C5 V8 works. Particularly sine we had bought several Blocks and Packages that are not usable with V8 without significant work.

So back to the drawing board and we lean the hard way, so when we "get the easy way" it clicks... Old school perhaps, but works well in our environment.

We were actually making good progress using C5.6 but then along came V8 and now we are leaning how it works.

I think for now (until we get packages down pat), we'll live with the "absolute" path. Not a show stopper and actually works so good for that.

Thanks for taking the time to respond, appreciate it.