through the blog tutorial (:-)) and now am facing a problem which I
believe is something simple, but can't seem to get it to work. I have
an xml file which I am reading into my view then upon selection of one
of the nodes, call my controller to display the children of that
node. Here are my code snippets:
In my view:
<?php
$registryFile = simplexml_load_file("../models/registry.xml");
$modules = $registryFile->modules;
foreach($modules->children() as $module)
{
$links = $module->links;
echo $this->Html->link($module-
>name,array('action'=>'Modules','$links'));
echo "<br/>";
}
?>
In my controller:
class MyController extends AppController {
function Modules($InParent)
{
echo "<dt>".$InParent."</dt>";
foreach($InParent->children() as $link)
{
echo "<dd>".$link->name."</dd>";
}
}
}
I keep getting an error that "Fatal error: Call to a member function
children() on a non-object".
Any assistance is appreciated.
Thanks. Mocha Man
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment