Jump to content


Photo

css layout within <<<EOF ??!!


  • Please log in to reply
8 replies to this topic

#1 dbrimlow

dbrimlow
  • Members
  • PipPipPip
  • Advanced Member
  • 712 posts

Posted 30 August 2006 - 07:44 PM

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):

<?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>

And then just enter my body, <divs> with previously declared database variables within like so:
<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>

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
$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>

then
<?php
$message = <<<EOF
$headers
$body
?>


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 .
Dave

I am always amazed by no matter how much I know, I know I don't know as much as I thought I knew.  - D. Brimlow.

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 30 August 2006 - 07:49 PM

first off, your syntax seems a bit off for the heredoc printing... you have to have a closing "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:
<?php
$myVar = <<<EOT
What's up, {$username}?
EOT;
?>

hope this helps.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 31 August 2006 - 03:54 AM

Wow... not a single mention of DB.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#4 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 31 August 2006 - 12:32 PM

Wow... not a single mention of DB.


???
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 31 August 2006 - 03:22 PM

Wow... not a single mention of DB.


???

obsidian This got moved from MySQL Help. fenway posted that message before I moved it

#6 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 31 August 2006 - 03:27 PM

obsidian This got moved from MySQL Help. fenway posted that message before I moved it


ah, makes sense... sorry i missed that. thanks
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#7 dbrimlow

dbrimlow
  • Members
  • PipPipPip
  • Advanced Member
  • 712 posts

Posted 25 September 2006 - 08:16 PM

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.
Dave

I am always amazed by no matter how much I know, I know I don't know as much as I thought I knew.  - D. Brimlow.

#8 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 26 September 2006 - 10:20 AM

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.

You dont tell IE to wordwarap but PHP. PHP sends the output back to the browser.

#9 dbrimlow

dbrimlow
  • Members
  • PipPipPip
  • Advanced Member
  • 712 posts

Posted 26 September 2006 - 04:25 PM

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
Dave

I am always amazed by no matter how much I know, I know I don't know as much as I thought I knew.  - D. Brimlow.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users