lakshay lakshay - 3 months ago 17
HTML Question

How to take a string containing HTML tags and php variables into a php string variable?

Suppose I have a string as

Hi, <br><br>
Someone has shared a <?php echo $job_type ?> with you through <?php echo CHtml::link("RimTim", Yii::app()->getBaseUrl(true)); ?>.<br><br>
Title: <?php echo $job_title;?><br><br>
<?php echo CHtml::link("View"." ".ucfirst($job_type)." "."Details", $job_link); ?>

How can I put this whole string into a php variable so that all the php variables are converted into their respective values?


You should try this,

$str.="Hi, <br><br> Someone has shared a ";
$str."with you through";
$str.=CHtml::link("RimTim", Yii::app()->getBaseUrl(true));
$str.=CHtml::link("View"." ".ucfirst($job_type)." "."Details", $job_link);