Welcome Guest, Not a member yet? Register   Sign In
[Q] another loading views from DB
#2

[eluser]hvalente13[/eluser]
Hi vlad_ci,

I guess that the older CI and forum users, would tell you to read more the user guide. I recommend that too, and if you notice it's one of the best user guides for this kind of software (framework).

But I give you a hint:

1. Use the models to retrieve all data you want from database. If you want, you may also build the html elements inside the model functions like selects and other tags.

2. Use the controllers to work that data according with the "state of the world".
Here you can make ifs and other conditions, controlling the uri->segments and POST variables, and pass the data to an array. You can reach the data by calling the model:

Code:
$data['example'] = $this->mymodel->getdata($this->uri->segment(3))

3. THIS YOU MIGHT WANT TO KNOW.

Here you put all your data with the names you gave previously in you controller array $data

Code:
<?=$example?>

And if you want to pass a new variable to the view just create it in your controller like this:
Code:
$data['var1'] = "My website rules";

Then you can put it in your view like this:

Code:
<div>&lt;?=$var1?&gt;</div>

Hope this helps!

Good luck


Messages In This Thread
[Q] another loading views from DB - by El Forum - 07-16-2008, 04:51 AM
[Q] another loading views from DB - by El Forum - 07-16-2008, 08:30 AM
[Q] another loading views from DB - by El Forum - 07-18-2008, 06:26 PM
[Q] another loading views from DB - by El Forum - 07-19-2008, 10:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB