特定字符串在我的PHTML即時通訊使用的foreach打印答案現在即時得到所有從數據庫ANS但在具體ANS我想強調的是從數據庫如何突出在Magento
<?php $id = $this->getRequest()->getParam('id');
$question = Mage::getModel('example/question')->load($id);
$answer = Mage::getModel('example/answer')->getCollection()->addFieldToFilter('id', $id);
$i = 1;
?>
<h2><?php echo $this->__('Your Question View')?></h2>
<div class="que-view">
<div><?php echo $this->__('<b>'.'Question:'.'</b>') . ' ' . $question->getQuestions();?></div>
<span class='que-view-tag'><?php echo $this->__('<b>'.'Answer'.'</b>'. ' ')?></span>
<?php foreach($answer as $ans):?>
<p class='que-view-ans'><?php echo '<b>' .$i .')</b>'.' '.$ans->getAnswers();?></p>
<?php $i++;?>
<?php endforeach;?>
</div>
獲取數據在上面的代碼中的IM回答。具體的答案意味着我要檢查客戶ID是相同或不若同比我想強調這個問題的答案如何做到這樣的
Que: test
Ans: Ans1 (customerid = 1)
(highlight this Ans) Ans2 (customerid = 2)
Ans3(customerid = 3)
使用這種支架(
這
O/P)僅僅是你可以理解
你能在html中顯示預期的結果嗎?我沒有清楚地理解你,所有外觀你需要像這樣:p class ='que-view-ans <?php if($ customer-> getId()== 555)echo'make-bold'; ?>'併爲類'make-bold'創建css風格 – zhartaunik 2015-04-06 07:33:23
你告訴我,如果條件在p標籤中不可能,因爲所有ans都有diff客戶id。檢查我的更新 – ND17 2015-04-06 07:41:35
我仍然不完全明白這個問題。你在問如何突出顯示標籤'p'?或者你問關於突出顯示的類型?或者您需要幫助來創建客戶檢查的條件? – zhartaunik 2015-04-06 07:49:51