Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet? (https://www.warriorforum.com/programming/419783-javascript-php-question-how-produce-embeddable-html-javascript-snippet.html)

bolaji 23rd July 2011 05:32 AM

Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
 
Hi guys -

How would one go about writing a web app that lets you:

1. Pick a bunch of HTML code from a list
-ex- sections of a sales page.
Pick a headline option...
an intro paragraph option...
a closing paragraph option, etc.

2. Click submit, and get a line of javascript that you can use to embed that HTML code on any page

I'm a programming noob... but I'd love to know how to do this for an application idea I have.

Thanks for your ideas!

Bolaji.

YongC 23rd July 2011 05:46 AM

Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
 
You can find the answer here : w3schools.com ...

bolaji 23rd July 2011 06:03 AM

Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
 
Quote:

Originally Posted by YongC (Post 4320956)
You can find the answer here : w3schools.com ...

Thanks, Yong.

I'm actually interested in finding someone to build this for me. :) :)

Since I'm not a programmer, even though it might be simple I don't want to take on the responsibility of managing the code, ensuring it is bug-free, etc.

I'm thinking there may need to be some SQL as well:
I'll want to keep track of which options were selected by each user.

For example:

Yong C selected:
- Headline 5
- Opening paragraph 3
- Middle paragraph 5
- Closing paragraph 2
- Signature 1

all of that became his sales page.

But I'll want to track the:
- number of views he gets on that sales page, and
- number of clicks on the call-to-action link
- and present him with those stats in an admin section on my site.

That way, he can come back, reconfigure his choices after a while, and then sit back and compare the relative improvement.

So maybe this introduces an SQL (MySQL) component... for storing the paragraph options and tracking views+clicks?

Thanks for your help!

Bolaji

YongC 23rd July 2011 06:48 AM

Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
 
To query SQL u can use Ajax combined width php,asp ...
Here : api.jquery.com/jQuery.ajax/

KabanaSoft 23rd July 2011 12:36 PM

Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
 
basically all you need to do is to put the html code you want to output inside a script tag that has document.write's for each line of html you want to include.

Ex:

<script type="text/javascript">
document.write("<p>my html code</p>");
document.write("<span>more html code</span>");
...ect...
</script>

This would have to be generated dynamically based on what the user chooses to include, so you will have to have some sort of PHP script that will output this javascrit code.

You can also do the same thing using PHP using the echo command.

Hope this helps.

bolaji 23rd July 2011 12:48 PM

Re: Javascript+PHP Question: How to Produce Embeddable HTML in Javascript snippet?
 
Quote:

Originally Posted by KabanaSoft (Post 4322836)
basically all you need to do is to put the html code you want to output inside a script tag that has document.write's for each line of html you want to include.

Ex:

<script type="text/javascript">
document.write("<p>my html code</p>");
document.write("<span>more html code</span>");
...ect...
</script>

This would have to be generated dynamically based on what the user chooses to include, so you will have to have some sort of PHP script that will output this javascrit code.

You can also do the same thing using PHP using the echo command.

Hope this helps.

Thanks, KabanaSoft!

That's excellent.

I haven't the slightest idea how to do the PHP part though. :(

Bolaji.


All times are GMT -6. The time now is 09:10 AM.