My Sql


Steve Gunther
 

I have to admit, I have not learned Xway yet. I guess I am waiting either until there is a conversion process form Freeway, or I have to create a new website, and therefore need to apply myself sooner rather than later.

I do have a question. Is there some facility for Xway to save data to an sql base. So, for instance, currently when I have a new client registration, they fill out a form, and it arrives in an email to me. Will there be some way that that information gets saved to a database?


Walter Lee Davis
 

I don't speak for the company, but based on my decades of experience with Freeway, I would say no, not now at least. Xway follows in Freeway's footsteps as a static HTML generator, and it does not have any associations with MySQL or other databases. There were some PHP/MySQL Freeway Actions many years ago, written by Paul Dunning, but they have not been updated for many years, and do not represent modern thinking in Web application design in any way. I'm sure that Paul would agree with me that using them in today's Web would be a very risky idea.

If Xway were to grow this sort of facility, it would likely start with an Action, and as you know, Actions aren't available for Xway yet (the technology isn't even there to support them). I would imagine that adding it to the core of the application would be a "much later, probably never" sort of thing.

For now, if you wanted to maintain a database backup of your form submissions, you may want to investigate a service that will do this for you. Here's one page that has a write-up of the problem, and some solutions. I haven't tried any of these personally. https://forestry.io/blog/5-ways-to-handle-forms-on-your-static-site/

Walter

On Jun 9, 2020, at 10:24 AM, order@depth.net.au wrote:

I have to admit, I have not learned Xway yet. I guess I am waiting either until there is a conversion process form Freeway, or I have to create a new website, and therefore need to apply myself sooner rather than later.

I do have a question. Is there some facility for Xway to save data to an sql base. So, for instance, currently when I have a new client registration, they fill out a form, and it arrives in an email to me. Will there be some way that that information gets saved to a database?


Steve Gunther
 

Ah, thanks for the clear reply.

I have another question. Selling a product. Buyers arrive at the sales page. Paypal doesnt allow you to use coupons...is it possible to have some kind of field in Xway where people enter a coupon code, and then according to the code, it takes them to a different page on my site? Or does that require more of the not-to-be actions?


Walter Lee Davis
 

On Jun 9, 2020, at 11:37 AM, order@depth.net.au wrote:

Ah, thanks for the clear reply.

I have another question. Selling a product. Buyers arrive at the sales page. Paypal doesnt allow you to use coupons...is it possible to have some kind of field in Xway where people enter a coupon code, and then according to the code, it takes them to a different page on my site? Or does that require more of the not-to-be actions?
It's not so much not-to-be, but more like not-yet.

You could do this in a very low-tech manner, by creating a page named exactly for your coupon code (say, XTRA-DISCOUNT.html) and then using a little JavaScript to link to that when someone adds a coupon code. You'd need to set up a different PayPal button on that page, one that already took the coupon code into effect, and that would get you what you want, albeit with a lot of extra hand-work and duplicate pages. There would be absolutely nothing keeping anyone (or bot) from discovering that page, except for the cryptic URL, so there's always a chance that your codes would find a wider distribution than you intended... Of course that's always true, and coupon codes are one of the most-pirated things I know of, right after Photoshop.

So to make this work, you would create a form with one text field and a submit button labeled "Check Code" or something like that. Make sure the form has an Action set to '#', and a Method of GET. Xway doesn't support creating forms yet, so this is either theoretical, or something for you to implement in a Markup Item, depending on your level of devotion to the craft.

On the button, you would add an onclick attribute, which will "hijack" that button click and cause the form to redirect. This technique is similar to the ancient "Password Protected Page" Action of Freeway of Yore.

```html
<form action="#" method="get">
<label for="code">Coupon Code</label>
<input id="code">
<input type="submit" value="Check Code" onclick="return check_code(this)">
</form>
```

```js
<script>
function check_code(button){
var code = button.form.getElementById('code').value;
if(!!code){
button.form.action = code + '.html';
return true;
}else{
alert('Please enter a coupon code');
return false;
}
}
</script>
```

Untested, but should probably work.

Please let me know if this makes any sense at all.

Walter


Jeremy Hughes
 

Hi Steve,

Actions (or plug-ins of some kind) are on our to-do list.

You can also use markup to add scripts within Xway (as you can in Freeway).

Jeremy


Steve Gunther
 

Cool. I will look at this. Thanks very much for the answer!!!


Paul Dunning
 

HI,
they were written in 2001 or 2002, when I was working at Softpress. A lot of time has passed since then, and I’ve been hand writing my PHP & MySQL for a long time now. I pretty much only use PHPBlock these days.

All the best,

Paul Dunning

web design - http://www.pauldunning.com

freeway actions - http://www.actionsworld.com




On 9 Jun 2020, at 15:48, Walter Lee Davis <waltd@...> wrote:

There were some PHP/MySQL Freeway Actions many years ago, written by Paul Dunning, but they have not been updated for many years, and do not represent modern thinking in Web application design in any way. I'm sure that Paul would agree with me that using them in today's Web would be a very risky idea.