'; // Fetch CSS for inlining $cssContent = file_get_contents('assets/css/custom.css'); // Prepare image for ZIP $imageContent = @file_get_contents($imageUrl); $imageFilename = basename(parse_url($imageUrl, PHP_URL_PATH)); if (empty($imageFilename)) { $imageFilename = 'featured-image.jpg'; } // Generate the final HTML content from the selected template structure $templateId = (int)($_POST['template_id'] ?? 1); $selectedTemplate = null; foreach ($templates as $t) { if ($t['id'] === $templateId) { $selectedTemplate = $t; break; } } $templateHtml = $selectedTemplate ? file_get_contents($selectedTemplate['file']) : '
Ebook Cover

' . $title . '

' . $description . '

' . $checkoutHtml . '
'; $templateDom = new DOMDocument(); @$templateDom->loadHTML($templateHtml, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $imgTag = $templateDom->getElementById('previewImage'); if ($imgTag) $imgTag->setAttribute('src', $imageFilename); $titleTag = $templateDom->getElementById('previewTitle'); if ($titleTag) $titleTag->nodeValue = $title; $descTag = $templateDom->getElementById('previewDescription'); if ($descTag) $descTag->nodeValue = $description; $ctaContainer = $templateDom->getElementById('previewCtaContainer'); if ($ctaContainer) { // Clear existing content while ($ctaContainer->hasChildNodes()) { $ctaContainer->removeChild($ctaContainer->firstChild); } if (!empty(trim($checkoutHtml))) { $fragment = $templateDom->createDocumentFragment(); @$fragment->appendXML($checkoutHtml); $ctaContainer->appendChild($fragment); } else { $ctaContainer->nodeValue = $ctaText; // Fallback to simple text if no HTML } } $finalPreviewHtml = $templateDom->saveHTML(); $htmlContent = << $title
$finalPreviewHtml
HTML; // Create a Zip archive $zip = new ZipArchive(); $zipFileName = tempnam(sys_get_temp_dir(), 'ebook') . '.zip'; if ($zip->open($zipFileName, ZipArchive::CREATE) === TRUE) { $zip->addFromString('index.html', $htmlContent); if ($imageContent) { $zip->addFromString($imageFilename, $imageContent); } $zip->close(); // Force download header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="ebook_page.zip"'); header('Content-Length: ' . filesize($zipFileName)); readfile($zipFileName); unlink($zipFileName); exit; } else { error_log('Failed to create the ZIP file.'); exit('Could not create ZIP file.'); } } $template_id = isset($_GET['template_id']) ? (int)$_GET['template_id'] : null; $selectedTemplate = null; $templateContent = ''; if ($template_id) { foreach ($templates as $t) { if ($t['id'] === $template_id) { $selectedTemplate = $t; break; } } if ($selectedTemplate && file_exists($selectedTemplate['file'])) { $templateContent = file_get_contents($selectedTemplate['file']); } else { $template_id = null; // Reset if template not found } } // Read project preview data from environment $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Create and customize your own ebook landing page.'; $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; ?> Ebook Lead Magnet Generator
Contentrepreneur Quick Pages

Customize Your Page

This will replace the default button in the preview. If you use this, uncheck "Show Call to Action Button" above.

How to Deploy Your Ebook Page

A simple guide to get your page online.

1
Unzip the File

The file you downloaded is a ZIP archive. Unzip it to a folder on your computer. You will find an `index.html` file and an image file inside.

2
Upload to Your Hosting

Log in to your web hosting control panel (like cPanel, Plesk, or others) or use an FTP client (like FileZilla). Upload the `index.html` file and the image file to the `public_html` or `www` directory of your domain.

3
Visit Your Page

Once the files are uploaded, you should be able to visit your domain in your browser and see your new ebook landing page live.