Jump to content

Archived

This topic is now archived and is closed to further replies.

dbrimlow

css layout within <<<EOF ??!!

Recommended Posts

Whoa.

I am trying to send a tabless css layout via an email. It doesn't look like it likes the style tags because of the # and my <div id=""> or <div class="">. I though you don't need to escape quotes within the EOF.

I enter the page like doctype and head tags like below (sample):

[code]<?php
$message = <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>(no spam here Mysite Lofts Inc.)</title>
<meta name="copyright" content="(c) 2006, Mysite Apartments Inc." />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body {background-color:#fff;margin:0px 0px 0px 5px;padding:0px;font-family: Arial, Verdanas, Sans-serif;font-size: 12px;color: #663300;}a:link{color: #0000FF;}a:visited{color: #0000CC;}a:hover{color: #006699;}...etc.
</style>
</head>[/code]

And then just enter my body, <divs> with previously declared database variables within like so:
[code]<body>
<div id="container">
<div id="heading">
<!-- close headinge -->
</div>
<div id="tabletop">
<div class="spacer2">&nbsp;</div>
  <div class="style35">$title</div>
  <div class="style35">$address></div>
  <div class="spacer">&nbsp;</div>
  <div id="tabletop2">
<div class="spacer"><h2>&pound; $listing</h2></div>
$photo1url
$photo2url
$photo3url
 
</div> [/code]

I am getting a parse error on the last line of the page (close php tag ?>)

Do I need to dynamically create the web page that will be within the EOF using variables for the entire layout - headers, body, <divs>?

Say [code]$headers == <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
etc.
</head>[/code]

then
[code]<?php
$message = <<<EOF
$headers
$body
?>[/code]


It all worked just fine when using html 4.0 and tables - both in quirks mode and standards mode transitional html 4.0 and/or xhtml .

Share this post


Link to post
Share on other sites
first off, your syntax seems a bit off for the heredoc printing... you have to have a [b]closing[/b] "EOF" to end out the heredoc statement.

next, any variables you are wanting to echo within the heredoc, you need to set off with curly braces, so, you'd need something like this:
[code]
<?php
$myVar = <<<EOT
What's up, {$username}?
EOT;
?>
[/code]

hope this helps.

Share this post


Link to post
Share on other sites
Wow... not a single mention of DB.

Share this post


Link to post
Share on other sites
[quote author=fenway link=topic=106306.msg425142#msg425142 date=1156996445]
Wow... not a single mention of DB.
[/quote]

???

Share this post


Link to post
Share on other sites
[quote author=obsidian link=topic=106306.msg425315#msg425315 date=1157027534]
[quote author=fenway link=topic=106306.msg425142#msg425142 date=1156996445]
Wow... not a single mention of DB.
[/quote]

???
[/quote]obsidian This got moved from MySQL Help. fenway posted that message before I moved it

Share this post


Link to post
Share on other sites
[quote author=wildteen88 link=topic=106306.msg425423#msg425423 date=1157037724]
obsidian This got moved from MySQL Help. fenway posted that message before I moved it
[/quote]

ah, makes sense... sorry i missed that. thanks

Share this post


Link to post
Share on other sites
For anyone interested in the solution that finally worked, all I needed to do was tell IE to use a "word wrap" and force a new line as follows:

$description = wordwrap($description, 50, "\n");

What had been happening was that a long url was being "auto" wraped by Outlook.

That's all. Everything else was fine.

Share this post


Link to post
Share on other sites
[quote author=dbrimlow link=topic=106306.msg441259#msg441259 date=1159215385]
For anyone interested in the solution that finally worked, all I needed to do was tell IE to use a "word wrap" and force a new line as follows:

$description = wordwrap($description, 50, "\n");

What had been happening was that a long url was being "auto" wraped by Outlook.

That's all. Everything else was fine.
[/quote]You dont tell IE to wordwarap but PHP. PHP sends the output back to the browser.

Share this post


Link to post
Share on other sites
It wasn't the browser I was having trouble with. The page's purpose is to submit a dynamicly generated html file of an apartment listing that is submitted to subscribers as an html file viewable in the body of the email (using "$message = <<<EOF /* generated php listing html */").

The issue was that outlook was automatically, and indescriminantly, creating a line break for long paragraghs in the description field. It only happened in a certain type of apt listing where the descriptions were written by the agent - which, in effect, at least doubled the size of the paragraghs compared with those written by our listings data entry staff.

When the email appeared, it had a random question mark ("?") proceeding a random word (from listing to listing) in the description - usually somewhere within a 3 sentence range. When looking at the html, we saw that it was also randomly inserting a line return after the question mark.

This only happened in Outlook and not in any online email like yahoo or gmail. We checked the description field data in the DB and there were not line returns embedded within by the data entry person (agent).

So we realized it was an MS specific thing. When studying how Outlook interpruts html, we found that the text portion of the html sent, within the email's body, is editable, while the container fields (divs or tables/cells) are fixed on the page but flexible when editing - sort of like an absolute positioned "layer" Div.

Since other listings, with shorter description paragraphs, didn't have this problem - AS WELL AS when we shortened the paragragh within the effected listings - we realized that Outlook was causing the random line break.

So, we finally realized that all we had to do was modify the $description variable to word wrap and start a new line every 50 characters. Worked like a charm

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.