Welcome Guest, Not a member yet? Register   Sign In
Retrieving database records using only the View?
#1

[eluser]invision[/eluser]
Hi,

I know it doesn't make much sense. But is there an easy way to retrieve data from the database and display it to the public, using only the View?

Does it make sense to hard code this into a 'View' or perhaps create a module and call it?

There's a particular page on my site I want to list results from a table in the database.

I would do it the normal MVC way, but I think it's pretty tricky with my current setup.

I was going to use something like this:

Code:
if ($id == 4) {        
        $data['docs'] = $this->MPdfs->getAllPdfs();
        echo $data['docs'];
    if (count($docs)){
        foreach ($docs as $key => $list){
            //echo "<h2>".$list['title']."</h2>\n";
            echo anchor('pdfs/download/'.$list['id'],'Download - '.$list['title']);
            echo '<br />';
        }
        echo "<br/><br/>";
    }
  }



Thank you
#2

[eluser]invision[/eluser]
I hate to bump, but really wouldn't mind some thoughts on this.

Is it possible to retrieve data and display it solely in the View?

It would just be for one page of the site.


Thanks for any help.
#3

[eluser]Bart v B[/eluser]
I don't understand the problem sorry. :red:

But why would it only be in the view?

i should do it with a model and controller.
As what is see now is that if the uri_segement is 4 the it should do something.
So what is the problem?

It can be done in a normal MVC way i think.
Maybe some more information would be nice.
#4

[eluser]invision[/eluser]
Aaah. My apologies.

I've actually found a workaround for this problem. Should've thought about it more than post.


Thanks for your post.




Theme © iAndrew 2016 - Forum software by © MyBB