No, I delete the Inflector function and the 's' is still showing
there.
Here is a little test that i did:
With the same modules_controller.php:
<?php
class ModulesController extends AppController {
function createMenu() {
$modules = $this->Module->findAll();
if(isset($this->params['requested'])) {
return $modules;
}
$this->set(compact('modules'));
}
}
?>
I try two different elements:
<?php
echo "TEST\n";
/*
$modules = $this->requestAction('modules/createMenu');
foreach($modules as $module):
$moduleLabel = $module['Module']['label'];
$moduleLink = Inflector::pluralize($module['Module']['name']);
echo "<li>";
echo $html->link("$moduleLabel", "/admin/$moduleLink/",
array("id"
=> "menu$moduleLabel"));
echo "</li>\n";
endforeach;
*/
?>
In this first version, i comment the most important part of the
element, and i´m only printing a 'TEST' string. The output is correct,
showing only the word "TEST".
The second test element is the followind:
<?php
echo "TEST\n";
$modules = $this->requestAction('modules/createMenu');
/*
foreach($modules as $module):
$moduleLabel = $module['Module']['label'];
$moduleLink = Inflector::pluralize($module['Module']['name']);
echo "<li>";
echo $html->link("$moduleLabel", "/admin/$moduleLink/",
array("id"
=> "menu$moduleLabel"));
echo "</li>\n";
endforeach;
*/
?>
Here I uncomment the call for the action "createMenu" in
modules_controller. Only that line is uncommented.
The result:
TEST
s
The "s" is still showing! So I have to say that my problem is in the
action of the controller that I show before. But I cant find any
error!!!! Can anybody help me please, it´s getting me crazy.
Thanks.
On Nov 8, 2:12 pm, schneimi <[EMAIL PROTECTED]> wrote:
> Must be the s from pluralize with $module['Module']['name'] beeing
> empty.
>
> On 8 Nov., 17:57, mbavio <[EMAIL PROTECTED]> wrote:
>
> > Hi, i´m trying to add a menu using renderElement, all works fine
> > except that Cake is adding an 's' before the generated code... Is it a
> > bug? Or i´m a bug?
>
> > Here is the code...
>
> > In layout 'backend.ctp':
>
> > <ul id="menu">
> > <?php echo $this->element('admin_menu');?>
> > </ul>
>
> > In element 'admin_menu.ctp':
>
> > <?php
> > $modules = $this->requestAction('modules/createMenu');
> > foreach($modules as $module):
> > $moduleLabel = $module['Module']['label'];
> > $moduleLink =
> > Inflector::pluralize($module['Module']['name']);
> > echo "<li>";
> > echo $html->link("$moduleLabel", "/admin/$moduleLink/",
> > array("id"
> > => "menu$moduleLabel"));
> > echo "</li>\n";
> > endforeach;
> > ?>
>
> > In controller 'modules_controller':
>
> > function createMenu() {
> > $modules = $this->Module->findAll();
> > if(isset($this->params['requested'])) {
> > return $modules;
> > }
> > $this->set(compact('modules'));
> > }
>
> > Here is the HTML generated:
>
> > <ul id="menu">
> > s<li><a href="/cake/admin/generals/"
> > id="menuGenerales">Generales</
> > a></li>
> > <li><a href="/cake/admin/listings/" id="menuPropiedades">Propiedades</
> > a></li>
> > <li><a href="/cake/admin/helps/" id="menuAyuda">Ayuda</a></li>
> > </ul>
>
> > The fuck*** s is located after the oppening of the ul...
>
> > Anybody has a clue about this?
>
> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---