Friday, December 7, 2012

Re: Listing menu items from database to layout file

Try writing a plain PHP script (not Cake) that fetches the records and
prints them to the browser. That might help to narrow down where the
problem lies.

As for using divs like that, it's not very good use of HTML.

On Fri, Dec 7, 2012 at 4:17 PM, Trisztán Thar <trisztan94@gmail.com> wrote:
> Hey there lowpass,
> Thanks for this full-fledged explanation, it helped me understand how
> CakePHP works, and i finally am able to use it for (at this time) basic
> things, on my own :)
> About the character thing:
> After all I managed to make my menu with the helper that Tim mentioned
> above, but I have a few problems with it, maybe you could help me out?
> So.. First thing. I rewrote the helper, 'cause, by defaullt, it renders
> menus in unordered lists, but i like to do it in divs, like in the plain
> HTML code i put in the first post. So now it renders this:
> <div class='nav-menu'>
> <div class='menuitems><a href='link'>stuff</a></div>
> <div class='menuitems><a href='link'>stuff</a></div>
> <div class='menuitems><a href='link'>stuff</a></div>
> </div>
>
> My 'calling' of this rendering is made up like this:
> $menu = array(
> 'options' => array('class' => 'menuitems'),
> 'items' => array(
> array('title' => 'Hirek', 'url' => array('controller' => 'posts', 'action'
> => 'index')),
> array('title' => 'Tutorialok', 'url' => array('controller' => 'posts',
> 'action' => 'tutorials')),
> array('title' => 'Munkaim', 'url' => array('controller' => 'posts', 'action'
> => 'jobs')),
> array('title' => 'Kapcsolat', 'url' => array('controller' => 'posts',
> 'action' => 'contact'))
> ));
>
> It works very well, but I have the following problem: If i write "Munkáim"
> instead of "Munkaim" (its the á, a hungarian character) it simply doesn't
> renders it. It created the div, but it's empty, like this:
> <div class='nav-menu'>
> <div class='menuitems'><a href='website/posts'>Hirek</a></div>
> <div class='menuitems'><a
> href='website/posts/tutorials'>Tutorialok</a></div>
> <div class='menuitems'></div>
> <div class='menuitems'><a href='website/posts/contact'>Kapcsolat</a></div>
> </div>
> As you can see, the third item is empty, because i used a non-english
> character. Any way to solve this?
> Also, i'd like to add class names to these menu items (each individual
> item), because of the 960 Grid system i'm using. Tim, maybe you know how to
> do it?
>
> Thanks a lot folks,
> Tristan
>
>
> 2012/12/7 lowpass <zijn.digital@gmail.com>
>>
>> Are you certain that the characters have been inserted into the
>> database correctly? Check that the character encoding is correct for
>> the database and the individual tables.
>>
>> You may also need to check that the browser is correctly rendering the
>> page. Look in the browser's View menu, or check with Firebug, etc.
>>
>> On Thu, Dec 6, 2012 at 4:05 PM, Trisztán Thar <trisztan94@gmail.com>
>> wrote:
>> > One more thing:
>> > I have used this helper, but i have discovered that it won't list menu
>> > items
>> > that have a special character in them. You know, I'm from Hungary, we
>> > have
>> > characters like: é, í, á, ű, ő, ú etc.. So if a menu item contains any
>> > non-english character, it treats it like if it wouldn't be there. Any
>> > idea
>> > how to solve this?
>> >
>> > Cheers,
>> > T
>> >
>> > --
>> > Like Us on FaceBook https://www.facebook.com/CakePHP
>> > Find us on Twitter http://twitter.com/CakePHP
>> >
>> > ---
>> > 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.
>> > Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> >
>> >
>>
>> --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> 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.
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>
>>
>
>
>
> --
> Thar Trisztán
> Web Programozó
> Telefon: 30/657-6134
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.

No comments: