Welcome to the Cookbook

loading...

5.4.2.1 Setting up the Layouts

To use both text and html mailing message you need to create layout files for them, just like in setting up your default layouts for the display of your views in a browser, you need to set up default layouts for your email messages. In the app/views/layouts/ directory you need to set up (at a minimum) the following structure

	email/
		html/
			default.ctp
		text/
			default.ctp

  1. email/
  2. html/
  3. default.ctp
  4. text/
  5. default.ctp

These are the files that hold the layout templates for your default messages. Some example content is below

email/text/default.ctp
	<?php echo $content_for_layout; ?>
  1. <?php echo $content_for_layout; ?>
email/html/default.ctp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<body>
		<?php echo $content_for_layout; ?>
	</body>
</html>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <body>
  4. <?php echo $content_for_layout; ?>
  5. </body>
  6. </html>