Removing logic from template file

I have a .ctp file here.

I’d like to move lines 16 - 18 to an external function which I call from the CTP file.

You’ve been marvelous so far.

Again, thankyou,


Y u not use helper :smiley: ?

Simply put the condition inside of a helper method and call it something like this in your view:

$selected_val = $this->Utility->selectedVal(INPUT_POST);

(Used “UtilityHelper”-name just as an example)