Do you know I can set a variable $content with renderPartial?
E.g $content = $this->renderPartial("MyFancyPage.php")
Do you know I can set a variable $content with renderPartial?
E.g $content = $this->renderPartial("MyFancyPage.php")
renderPartial
$this->renderPartial('MyFancyPage',array('variable'=>$foo));
Use the final parameter to renderPartial():
$content = $this->renderPartial('view', array(), true);
Keith, Thank you so much, it works!! but when I try to email the contents , the format is completely different,
echo $content gives me the following out put >>>> 6086
But the same $content, if I try to email, I get it in some other format as >>> 6087
How is it different when I echo the contents and then different when I send it across?
How have you included the CSS rules on the page?
Below is part of HTML which is rendered, you can see that I have actually hardcoded the css , strangely it shows me no formatting in the email … even if I am sending html.
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="/boatapp/assets/6c0d7c5f/bootstrap/css/bootstrap.min.css" />
<title>Boat Application</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Free yii themes, free web application theme">
<meta name="author" content="Webapplicationthemes.com">
<link href='http://fonts.googleapis.com/css?family=Carrois+Gothic' rel='stylesheet' type='text/css'>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Fav and Touch and touch icons -->
<link rel="shortcut icon" href="/boatapp/themes/abound/img/icons/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/boatapp/themes/abound/img/icons/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/boatapp/themes/abound/img/icons/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="/boatapp/themes/abound/img/icons/apple-touch-icon-57-precomposed.png">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<div class"span6">
<span><?php echo CHtml::encode(Yii::app()->name); ?></span>
</div>
<div class="row-fluid span12">
Hello
</div>
<hr>
<section class="main-body">
<div class="container-fluid">
<!-- Include content pages -->
<?php echo $content; ?>
</div>
</section>
</body>
</html>
I suspect that your style sheets aren’t loading in the email client. I don’t have much experience of sending email with complex CSS, but I would suggest you look into best practices for achieving that.
Thanks Keith
Infact, even if I put a simple stylesheet , it shows difference…
<html>
<head>
<link rel="stylesheet" type="text/css" href="/boatapp/assets/6c0d7c5f/bootstrap/css/bootstrap.min.css" />
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<div class"span6">
<span><?php echo CHtml::encode(Yii::app()->name); ?></span>
</div>
<div class="row-fluid span12">
Hello
</div>
<hr>
<section class="main-body">
<div class="container-fluid">
<!-- Include content pages -->
<?php echo $content; ?>
</div>
</section>
</body>
</html>