Welcome Guest, Not a member yet? Register   Sign In
MVC Style Question... put data in view vs controller
#1

[eluser]oldblueday[/eluser]
Hello all,

I have a style question. I'm writing a testing script which has a lot of text describing a disaster scenario interspersed with questions about the scenario. The questions are generated by php/CI.

Is there a best practice on how to approach this? Right now I have a controller with a lot of HTML in it. Alternatively, I can have a view with some PHP in it.

Thanks,

- Rahul

Code:
// okay this part gets messy, not sure how to do it
        // I got a lot of HTML but I need to mix some PHP in there, too
        // should I put it in the controller or the view?
        $html_quiz .= '                        
                            <div class="case1">
                            <h2>Lunch at Blue Rice Ski Resort</h2>';    
        $html_quiz .= image_asset('scenario/blue_rice_trail.png','',array('class' =>'float_center'));
        $html_quiz .= '                <p>The Blue Rice trail is crowded by skiers when suddenly, from the north side of Snow Rice, a big thunder is heard and a white cloud rises...</p>
                            <p>SLAB AVALANCHE!</p>
                            <p>Not far from the Blue Rice trail, around 50 skiers are having a lunch in a shelter beside the ski run.</p>';
        $html_quiz .= image_asset('scenario/avalanche_1.png','',array('class' =>'float_left'));
        $html_quiz .= image_asset('scenario/avalanche_2.png','',array('class' =>'float_right'));
        $html_quiz .= '                    <div class="clearer"></div>
                            <p>Loose snow avalanche!!!!</p>
                            <p>The avalanche roared down crushing one of the shelter\'s walls and covering the shelter with up to 3 meters of snow. Many of the people made it out of the shelter on their own, but others had to be assisted.</p>
                        </div>';

        $this->_print_scenario_question($scenario_questions[0], $html_quiz, $ans_key);
        $this->_print_scenario_question($scenario_questions[1], $html_quiz, $ans_key);
        $this->_print_scenario_question($scenario_questions[2], $html_quiz, $ans_key);


Messages In This Thread
MVC Style Question... put data in view vs controller - by El Forum - 08-16-2010, 11:24 PM
MVC Style Question... put data in view vs controller - by El Forum - 08-17-2010, 12:17 AM
MVC Style Question... put data in view vs controller - by El Forum - 08-17-2010, 01:38 AM
MVC Style Question... put data in view vs controller - by El Forum - 08-18-2010, 09:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB