Welcome Guest, Not a member yet? Register   Sign In
Displaying Results -- Best Practice Question
#2

[eluser]nate_02631[/eluser]
I'm not *quite* clear on what you're getting at, but I don't see any reason why you couldn't just loop through the options in the view. Plus, I think it's a good idea to keep display logic in the view, no matter how much of it there is (though I don't think you'd need a lot).

I might set up an array to match the unfriendly array keys of the options with friendlier names, then use that in your view:
Code:
$niceNames = array ('doc_ref_num' => 'Document/Ref. Number'... );
Then, in the view, you can loop through the array as normal and use the niceNames... and of course, simple logic to display the option if it even exists..
Code:
<? while (list($key, $value) = each ($option)): ?>
  &lt;?= $value ? '<p>'.$niceNames($key).': '.$value.'</p>' : '' ?&gt;
&lt;? endwhile ?&gt;
Which would display the option only if it were set... Of course, if you kept the key's quasi-friendly, like document_reference_number, you could use a simple helper to convert them to friendly names and ditch the $niceNames array altogether...

P.S. Nice looking site... was thinking of moving to that area myself. Nice to know there's a demand for quality web services down there Wink


Messages In This Thread
Displaying Results -- Best Practice Question - by El Forum - 11-16-2007, 03:28 PM
Displaying Results -- Best Practice Question - by El Forum - 11-17-2007, 06:40 PM
Displaying Results -- Best Practice Question - by El Forum - 11-18-2007, 11:15 AM
Displaying Results -- Best Practice Question - by El Forum - 11-18-2007, 01:02 PM
Displaying Results -- Best Practice Question - by El Forum - 11-18-2007, 03:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB