thank you for the reply
I'm affraid that is not the problem as I have $uses declared as an array();
here's the pages controller listing below:
<?php
class PagesController extends AppController{
var $name = 'Pages';
var $helpers = array('Html','Tree');
var $uses = array('Menu');
function display() {
if (!func_num_args()) {
$this->redirect('/');
}
$path=func_get_args();
if (!count($path)) {
$this->redirect('/');
}
$count =count($path);
$page =null;
$subpage=null;
$title =null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title = ucfirst($path[$count - 1]);
}
$this->set('page', $page);
$this->set('subpage', $subpage);
$this->set('title', $title);
#homepage
$this->pageTitle = "mywebsite";
$this->set('news', $this->News->findAll());
$this->render(join('/', $path));
}
}
?>
here's my router.php as well:
<?php
$Route->connect('/', array('controller' => 'pages', 'action' =>
'display', 'home'));
$Route->connect('/pages/*', array('controller' => 'pages', 'action' =>
'display'));
$Route->connect('/*', array('controller' => 'pages', 'action' =>
'display'));
?>
thank you,
Kasia
On 26/04/07, rtconner <[EMAIL PROTECTED]> wrote:
>
>
> Well I think you are making slightly improper use of the pages
> controller. You can deal with it though. In the pages controller,
> change
> var $uses = null;
> to
> var $uses = array();
>
> On Apr 26, 10:27 am, "Katarzyna Gogolek"
> <[EMAIL PROTECTED]> wrote:
> > hi
> >
> > I seem to have a weird problem with app_controller.
> > Website that I'm building has got a navigation system based on menu,
> that
> > get's it values from a database.
> > menu is built as an element, that uses Tree.php helper, modified by me.
> > below you can find my app_controller.php file:
> >
> > class AppController extends Controller {
> >
> > var $helpers = array('Html', 'Tree');
> > var $uses = array('Menu');
> >
> > function beforeRender(){
> > # setting the menu right #
> > $conditions['live']="1";
> > $order='position ASC';
> > $this->set('menu_t',
> > $this->Menu->findAllThreaded($conditions,null,$order));
> > $this->set('menu',
> $this->Menu->findAll($conditions,null,$order));
> > ##########################
> > }
> >
> > }
> >
> > as far as it shows the menu in a correct manner
> onhttp://www.mywebsite.com/
> > it comes up with this error when I try to access an item from menu here:
> http://www.mywebsite.com/pages/menu_item/
> >
> > *Fatal error*: Call to a member function on a non-object in *
> > /homepages/24/d111656091/htdocs/CMS2/app/app_controller.php* on line *49
> >
> > *line that it is refering to is : $this->set('menu_t',
> > $this->Menu->findAllThreaded($conditions,null,$order));
> >
> > I don't understand what is wrong with it - I tried to change my settings
> in
> > routes, but they don't seem to work, would be much gratefull if anyone
> would
> > be able to help
> >
> > Thanks!
> > Kasia
> > *
> > *
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---