Implementing to a Static html site

Once you've installed phpList... ask questions here!
Forum rules
Please help the volunteers to help you by supplying the version of phpList you are using, browser & version and if possible, a link to your phpList installation.

Implementing to a Static html site

Postby Hollywood691 » 6:47pm, Mon 16 Feb, 2015

I have seen the question sorta but havnt found the answer. I am not a programmer, coder but can follow directions And have used the "search".

I have used Advanced DHTML Popup to make a overlay optin that apprears, and the form fields I wanted. Works, "But" upon clicking the submit goes to domain.com/phplist

What I want it to do is, after entering your name and email address and clicking submit, is to add the user to the subscribe list (I only have 1) and just display the Thanks for joining in that same window......staying on the index page, instead of going to domain.com/phplist and leaving the user to have to "Go Back". Can someone help me to accomplish this?

my phplist is fresh (about a week ago installed) so version is most current.

Thanks
Hollywood~
Hollywood691
phpLister
 
Posts: 10
Joined: 6:31pm, Mon 16 Feb, 2015

Re: Implementing to a Static html site

Postby Hollywood691 » 10:09pm, Sun 01 Mar, 2015

Anybody? It's been like 15 days, so I guess, this means it can't be done......right?
Hollywood691
phpLister
 
Posts: 10
Joined: 6:31pm, Mon 16 Feb, 2015

Re: Implementing to a Static html site

Postby Dragonrider » 8:56am, Mon 02 Mar, 2015

It can be done, but it's not so easy.
Documents
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: Implementing to a Static html site

Postby Hollywood691 » 2:35pm, Mon 02 Mar, 2015

Thanks Dragonrider,... I have the form on our site,
currently,
1. enter name & email hit submit
2. it goes to our site/phplist page where you have to put your email in again, then hit the subscribe button
3. it carrys you to our thank you page on our site,...

which is , okay,...I was just trying to omit step 2, we wanted it to do just step 1 and 3, and thats what I havnt found how to do. So much reading I have done I just havnt found that yet. I went through what you gave me, and forgive me if I didnt read it right, but I didnt see how to omit that one step.

Thank you very much for your help,
Hollywood~
Hollywood691
phpLister
 
Posts: 10
Joined: 6:31pm, Mon 16 Feb, 2015

Re: Implementing to a Static html site

Postby Dragonrider » 4:11pm, Mon 02 Mar, 2015

It works somehow!

I know because some years (?) back I followed the instructions on the referred to page and got it working, and it works with V3 of phpList too.

I thought I would try to re-create the code, only to find it with a search for AJAX and CUSTOM SUBSCRIBE.

So here the working code is again, my thanks to H2B2 and a few others who have tweaked the code over the years.
Copy the code below and create a new HTML page to try it out on.
1. You'll need to change the http://yourdomain.com/lists to match your domain and the directory that you installed phplist in, also the subscribe&id= will need to match your value for your subscribe page id.
2. Also, you'll need to match name="list[1]" to the number of your list.
3. As Hollywood says a few posts down, you'll need to make sure that your subscribe page only asks for one email address, not a confirmation email as well, or else it'll redirect you to the standard phpList subscribe page.
Code: Select all
<html>

<head>
<title>New Page 2</title>
</head>

<body>

<!-- newsletter subscribe below here -->

<script language="Javascript" type="text/javascript">

var fieldstocheck = new Array();
fieldnames = new Array();
function checkform() {
for (i=0;i<fieldstocheck.length;i++) {
if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
alert("Please enter your "+fieldnames[i]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
return true;
}
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}
</script>

<form method="post" action="http://yourdomain.com/?p=subscribe&id=1" name="subscribeform">
Email:<input type="text" name="email" value = ""><br>
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>
Name: <input type="text" name="name" value = "">
<script language="Javascript" type="text/javascript">addFieldToCheck("name","Name");</script>
<input type="hidden" name="list[1]" value="signup" />
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();">
</form>

<!-- newsletter subscribe ends here --></body>

</html>


If it all works correctly, you should see a blank page with two input boxes, one for email, one for the Name and a Subscribe box . Enter your details in that and you should see a successful subscription page.

Try it out on my demo page. It is a test installation and you won't be subscribed for long as the database is re-set every 24 hours, but you should get a welcome email to make sure it works ok, so long as you give a valid email address.
Try it out
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: Implementing to a Static html site

Postby Hollywood691 » 9:28pm, Mon 02 Mar, 2015

Thanks dragonrider........your test page worked like I am trying to do, after submit, it takes you straight to thank you page and subscriber gets subscribed.......

I tried to do this, but it still goes to domain/phplist page where you have to put email in a 2nd box .....

you can see what I mean,....
Code: Select all
http://www.feedinternational.org/newsletter-subscribe


just use the 2nd and I'll delete it, as there are none in that one> We just added that one.

Both forms are exactly the same code wise, just different lists

Thanks again for your help!
Hollywood~
Hollywood691
phpLister
 
Posts: 10
Joined: 6:31pm, Mon 16 Feb, 2015

Re: Implementing to a Static html site

Postby Dragonrider » 10:10pm, Mon 02 Mar, 2015

When I look at your page, at the Prayer subscribe section, I see a lot of extra code has crept in, which is spoiling the custom subscribe option.

If you look at it below, there's [CDATA[ and where there should be< or > there's &gt; and &lt; (Greater Than and Less Than).

Can you check that this is not actually occurring please?

Code: Select all
<script type="text/javascript" language="Javascript">// <![CDATA[
var fieldstocheck = new Array();
fieldnames = new Array();
function checkform() {
for (i=0;i<fieldstocheck.length;i++) { if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") { alert("Please enter your "+fieldnames[i]); eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()"); return false; } } return true; } function addFieldToCheck(value,name) { fieldstocheck[fieldstocheck.length] = value; fieldnames[fieldnames.length] = name; }
// ]]&gt;</script></p>
<form action="http://feedinternational.org/lists/?p=subscribe&amp;id=1" method="post" name="subscribeform">Email:<input name="email" type="text" value="" /></p>
<p><script type="text/javascript" language="Javascript">// <![CDATA[
addFieldToCheck("email","Email Address");
// ]]&gt;</script><br />
Name: <input name="name" type="text" value="" /><br />
<script type="text/javascript" language="Javascript">// <![CDATA[
addFieldToCheck("name","Name");
// ]]&gt;</script><br />
<input name="list[1]" type="hidden" value="signup" /><br />
<input name="subscribe" type="submit" value="Subscribe" /></p>
</form>
</div>
<div class="one_half last">
<p>&nbsp;</p>
<h3>To sign up for Prayer Requests:</h3>
<p><script type="text/javascript" language="Javascript">// <![CDATA[
var fieldstocheck = new Array();
fieldnames = new Array();
function checkform() {
for (i=0;i<fieldstocheck.length;i++) {
if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
alert("Please enter your "+fieldnames[i]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
return true;
}
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}
// ]]&gt;</script></p>
<form action="http://feedinternational.org/lists/?p=subscribe&amp;id=2" method="post" name="subscribeform">Email:<input name="email" type="text" value="" /></p>
<p><script type="text/javascript" language="Javascript">// <![CDATA[
addFieldToCheck("email","Email Address");
// ]]&gt;</script><br />
Name: <input name="name" type="text" value="" /><br />
<script type="text/javascript" language="Javascript">// <![CDATA[
addFieldToCheck("name","Name");
// ]]&gt;</script><br />
<input name="list[2]" type="hidden" value="signup" /><br />
<input name="subscribe" type="submit" value="Subscribe" /></form>
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: Implementing to a Static html site

Postby Hollywood691 » 11:59pm, Mon 02 Mar, 2015

Fricken WP!!! it kept doing that if you change from html view to visual view and back it throws all kinda crap in it. The code is right now, but still does the same thing.

I did view scource and all the code is right


is there not anywhere in phplist to set that? like only single optin?
Hollywood691
phpLister
 
Posts: 10
Joined: 6:31pm, Mon 16 Feb, 2015

Re: Implementing to a Static html site

Postby Hollywood691 » 5:48am, Tue 03 Mar, 2015

I got it dragonrider........I had to select the "Don't display email address confirmation field"

cant believe I missed that on the way.,....wordpress keeps adding that goofy stuff to code, so I reverted to alittle different form,...anyway, working just like I wanted now and I appreciate all of your help.

Thank you so very much !

Hollywood~
Hollywood691
phpLister
 
Posts: 10
Joined: 6:31pm, Mon 16 Feb, 2015

Re: Implementing to a Static html site

Postby Dragonrider » 8:31am, Tue 03 Mar, 2015

Hollywood691 wrote:I got it dragonrider........I had to select the "Don't display email address confirmation field"

cant believe I missed that on the way.,....wordpress keeps adding that goofy stuff to code, so I reverted to alittle different form,...anyway, working just like I wanted now and I appreciate all of your help.

Thank you so very much !

Hollywood~


That's very good news! Glad I was able to help point you in the right direction. Thanks for confirming the code still works, even on Wordpress. :)
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: Implementing to a Static html site

Postby Dragonrider » 3:09pm, Thu 05 Mar, 2015

For those who need a confirmation email field, here's the page for that as well.

Feel free to look at the source code and adjust it as required for your own site.

Main things are to use your domain and path to your phplist, List and subscribe page IDs, change to match your own.
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom


Return to Questions and Problems after Installing

Who is online

Users browsing this forum: No registered users and 3 guests