Welcome Guest, Not a member yet? Register   Sign In
newbie question: using templates
#1

[eluser]aligator[/eluser]
Hello,
I started to read some codeIgniter tutorials and try some code in a new project, to learn.
I am using templates to create a view. I mean i have separate php files for each component of a page(view): header, footer, left panel etc.
I stumbled upon this problem:
1. this is the view:
Code:
<!-- left panel quote box -->            
<?php $this->load->view('includes/quoteBox'); ?>
// quoteBox is a php file that has some html code for displaying

2. in the controller i have this:
Code:
$data['quote'] = $this->leftpanel_model->getLeftQuoteBox();
// the left panel exists and so the function. this function just retrives the content of a column in a table. Previous actions of getting data from db worked, so the connection or db stuff is not a problem.

3. in the view situated in the view folder: 'includes/quoteBox.php' has this code:
Code:
<?php
                    echo '<p>'.''.$quote.'</p>';
                ?&gt;



The flow is this: from controller send variable to the view. this view has that html part added dynamically, the code is in another php file.


My questions are these:
a) is a variable usable if is in another php file that is included in a view?
b) in the application/autoload.php i added the neccesary model. dunno why i need to do this? somebody suggested to add all models there so i can use them in a controller. can't i use multiple models in a controller without declaring them in the autoload.php file?

thank you, even if u took the time to read till here.


Messages In This Thread
newbie question: using templates - by El Forum - 10-31-2010, 10:40 AM
newbie question: using templates - by El Forum - 10-31-2010, 11:04 AM
newbie question: using templates - by El Forum - 10-31-2010, 11:12 AM
newbie question: using templates - by El Forum - 10-31-2010, 11:18 AM
newbie question: using templates - by El Forum - 10-31-2010, 11:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB