开发者

Heredoc this PHP-HTML

I'm trying to heredoc the following code:

<?php 
   //some php
   //some more php
   if (some condition) {
?>   
   <label>CMKS1<?php echo $CMKS1_CMKS2_space; ?>CMKS2</label>
   <input name="cmks1" type="text" class="base-cls <?php if ($err1) echo "err-cls"; ?>" />
   <input name="cmks2" type="text" class="base-cls <?php if ($err2) echo "err-cls"; ?>" />    
<?php
   }//if
   //some final php here
?>  

but I'm stuck on the $CMKS1_CMKS2_space variable on the label line and the 2 if conditional statements in input name cmks1 and cmks2. Is the heredoc format able to handle these gracefully? For example the label line in heredoc would look like this:

<label>CMKS1$CMKS1_CMKS2_spaceCMKS2</label>

or 开发者_开发百科should I enforce an extra discretionary space:

<label>CMKS1 $CMKS1_CMKS2_space CMKS2</label>

As for the if conditional statements on the 2 input lines, I'm not even sure how to port these...

TIA


Inside the heredoc, you can use this syntax to specify the correct variable names:

<label>CMKS1{$CMKS1_CMKS2_space}CMKS2</label>

Unfortunately, there is no way to add the conditional statements inside heredoc syntax.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜