Getting Email HTML

There are three ways to get generated HTML from the Revolvapp editor.

API

The first way is to get HTML with the API method getHtml.

<!-- call api -->
<button onclick="console.log($RE('#myemail', 'getHtml'));">Get HTML</button>

<!-- element -->
<div id="myemail"></div>

<!-- init -->
<script>
$RE('#myemail', {
    path: '/revolvapp-dist/',
    template: '/my-folder/template.html'
});
</script>

Callback

The second is to get HTML with the changed callback.

<!-- element -->
<div id="myemail"></div>

<!-- init -->
<script>
$RE('#myemail', {
    path: '/revolvapp-dist/',
    template: '/my-folder/template.html',
    callbacks: {
        changed: function()
        {
            var html = this.getHtml();
            var template = this.getTemplate();
        }
    }
});
</script>

Every time a change occurs in the editor, a changed callback will be called. So you can get HTML or the modified template in the callback function using API methods.

Autosave

Finally, the third way is autosave option.

<!-- element -->
<div id="myemail"></div>

<!-- init -->
<script>
$RE('#myemail', {
    path: '/revolvapp-dist/',
    template: '/my-folder/template.html',
    autosave: '/my-backend-script/'
});
</script>

Just set up the path to your backend script in the autosave option and every time when changes occur in the editor, Revolvapp will be send the post request to your backend. Request has two params:

  • html - generated HTML
  • template - the modified template

Here is the php example of how to get the params:

<?php

$html = $_POST['html'];
$template = $_POST['template'];

?>