SemicolonAcademy / ci-cms

Automatically exported from code.google.com/p/ci-cms
Other
0 stars 0 forks source link

Can not call Navigation Get Method Multiple times #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
During the pre-release, please update your files with the latest svn 
before reporting a defect
-----

What steps will reproduce the problem?
1. Make Multiple calls to This->navigation->get()

What is the expected output? What do you see instead?
I would expect that each call to this method would return the query 
results from the db navigation table. However, multiple calls to the get() 
method seems to concantinate the current query with any previous value.

Please use labels and text to provide additional information.

Example:

DB Navigation table contains three items:
 Home
 About
 Contact

First call to this->navigation->get() returns:
 Home
 About
 Contact

Next call to $this->navigation->get() returns:
 Home
 About
 Contact
 Home
 About
 Contact

Third call to $this->navigation->get() returns:
 Home
 About
 Contact
 Home
 About
 Contact
 Home
 About
 Contact

Solution:
Edit the library/Navigation.php file so the get() method reads as follows:

        function get()
        {
            if (!$data = $this->obj->cache->get
('navigationarray'.$this->lang, 'navigation'))
            {
                $this->nav = null; // Empty the nav array
                $data = $this->_get();
                $this->obj->cache->save
('navigationarray'.$this->lang, $data, 'navigation',0 );
            }

            return $data;           
        }

Original issue reported on code.google.com by rmorga...@gmail.com on 28 Nov 2008 at 5:32

GoogleCodeExporter commented 9 years ago
To me it doesn't result.

I put this on my template

{{{
<? 
$navs = $this->navigation->get() ;
var_dump($navs);

$navs = $this->navigation->get() ;
var_dump($navs);
?>
}}}

But they show only each one, an instance of menu

Original comment by heriniai...@gmail.com on 28 Nov 2008 at 3:04