Combining Appended Values in PHP Function Output -
i have following php function "renders" output appended values:
protected function getfieldrow($label, $value, $encode = true) { if (empty($value)) { return ''; } return foxhtmlelem::create()->append(foxhtmlelem::create('div')->classes('field-title')->text(jfilterinput::getinstance()->clean($label .= ": ")))->append(foxhtmlelem::create('div')->classes('field-content')->html($encode ? nl2br(foxhtmlencoder::encode(jfilterinput::getinstance()->clean($value))) : $value))->render(); }
which outputs list this:
<div class="field-title">label : </div><div class="field-content">value</div> <div class="field-title">label : </div><div class="field-content">value</div> <div class="field-title">label : </div><div class="field-content">value</div>
how can change function combines 2 appended values inside same div this:
<div class="field-content">label : value</div> <div class="field-content">label : value</div> <div class="field-content">label : value</div>
thank you.
it looks want this:
<?php return foxhtmlelem::create() ->append(foxhtmlelem::create('div') ->classes('field-content') ->html( jfilterinput::getinstance()->clean($label .= ": "). ($encode ? nl2br(foxhtmlencoder::encode(jfilterinput::getinstance()->clean($value))) : $value)))->render();
just move label variable html method instead of creating separate div.
Comments
Post a Comment