0
好像我沒有真正想到交換機是如何工作的,導致它不可能(對我來說)正確。交換機中的佈局問題
我有這樣的代碼:
foreach ($this->timeofday as $key => $node) {
if (get_class($node) === 'DOMElement') {
if ($node->hasAttribute('class')) {
switch ($node->getAttribute('class')) {
case "cmil_salong":
echo '<h3>'.$node->nodeValue. '</h3>';
break;
case "cmil_time":
echo $node->nodeValue .' ';
break;
case "mv_3d":
echo '<span class="label label-info">3D</span> ';
break;
case "cmil_rs":
echo '<span class="label label-info">Platser ' . $node->nodeValue . '</span> ';
break;
case "mv_txt":
echo '<span class="label label-info">Textad</span><br>';
break;
}
}
}
if (get_class($node) === 'DOMAttr') {
if ($node->nodeName === 'href') { ?>
<a href="<?php echo $node->nodeValue ?>"><button type="button" class="btn btn-success btn-xs">book! <span class="glyphicon glyphicon-new-window"></span></button></a><br>
<?php
}
}
}
產生這樣的:
但這是預期的結果:
最好
<div>
11:30 <span class="label label-info">3D</span> <span class="label label-info">textad</span> <span class="label label-info">platser 379</span>
<span class="label label-warning"> Du kan inte längre köpa biljetter till den här förestäs;llningen</span>
</div>
,或者取決於if ($node->nodeName === 'href')
是真實的:
<div>
11:30 <span class="label label-info">3D</span> <span class="label label-info">textad</span> <span class="label label-info">platser 379</span>
<button type="button" class="btn btn-success btn-xs">book! <span class="glyphicon glyphicon-new-window"></span></button>
</div>
我的問題:
- 我怎麼使它看起來像:第二圖像:http://i.stack.imgur.com/QyTTO.png
謝謝!但我仍然沒有得到預期的結果 – Adam