Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8912419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:11:34+00:00 2026-06-15T04:11:34+00:00

In CFML there is the construct: <cfsavecontent name=HTML_content> <div class=test_div style=color:#FFF;>Test</div> </cfsavecontent> Within PHP

  • 0

In CFML there is the construct:

<cfsavecontent name="HTML_content">
    <div class="test_div" style="color:#FFF;">Test</div>
</cfsavecontent>

Within PHP there seems to be no way of doing this without some really hacky function or escaping double quotes. I’m trying to create emails (large html documents) within the same page by saving the email content and simply mailing it but it seems like there’s no way of doing this within PHP without using $var = "\"bad code\"";

Can somebody point me in the right direction?


I’v tried the answer by deceze below

$var = <<<HTML
    <div class="test_div" style="color:#FFF;">Test</div>
HTML;

But I get the following error:

Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_END_HEREDOC or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in C:\vhosts\jpl\pages\about\testimonials.php on line 29

For anyone else that is stuck on this,
The HTML; part at the end of the HEREDOCS example needs to be right at the beginning (no tabs, spaces or anything) of the end.

So newline HTML; not newline [tab or space] HTML;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:11:35+00:00Added an answer on June 15, 2026 at 4:11 am
    $var = '<div class="test_div" style="color:#FFF;">Test</div>';
    
    $var = <<<HTML
        <div class="test_div" style="color:#FFF;">Test</div>
    HTML;
    

    So many ways to quote a string… http://php.net/manual/en/language.types.string.php

    Also consider putting the email contents into a separate file and includeing it where needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can function argument have hint in cfscript (CF9)? CFML style: <cffunction name=myFunc output=false returntype=void>
I need to use my own java class in a cfml page. This entry
I'm trying to execute the following CFML: <cfquery name=koppelData datasource=#request.DataSource#> INSERT INTO t_user_profile (Username,
I have a problem with my cfml code. The ListAppend() function doesn't seem to
I have some problem with my cfml website. I have used the below code
I have this nice big Dev Kit written in PHP, but the application I'm
There are lots of similar questions to this, but they all seem to involve
In Coldfusion / CFML I need to convert 0.85035035035 to 85%. I looked at
I can't believe I just read this: Using the CFML event gateway for asynchronous
How to handle timezones in CFML? So far all apps I've wrote just use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.