Re: Advice on menu setup
Is the menu supposed to be displayed on every page? I gather that the menu is dynamically driven by data in the Db... That tells me that you should have a model for it. If it is to be included on every page, then I would load the menu model in the App Controller, probably in the beforeRender() method. $this->loadModel('Menu'); Don't forget to include it at the top with a use statement. Then you can set whatever variables you need to pass to your view. In that your specifications are vague, I can't tell you exactly what to pass along... Then with the view vars set using the set(), you can use them in the layout or in an element depending on your needs. On Monday, October 19, 2015 at 2:41:44 PM UTC+7, Simon Bradley wrote: > > Hi > > I'm new to cakephp > > I'm using version 3 > > I've been working through an existing site i have built and trying to > replicate it with cakephp > > I did a lot very quickly which is great but the menu is tricky > > Since this is a navigation bar at the top of every page i thought i might > use an element > > The problem there seems to be getting the data into it from the database > > I've read the manual quite a bit and based on that i thought maybe > creating a model and controller for the menu would be the best way to go > > Then i could call the menu controller from the article controller and get > the menu data that way > > It looks like i can pass the data into the menu element from there? > > But then where do i put the code that actually takes the data and > generates the menu? > > I've looked at various tutorials but it's not made things clearer > > I'd really appreciate some advice here folks. > > Cheers. > > > > > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Advice on menu setup
Your existing menu likely is a series of elements each containing (link) elements, yes? Simply replace the ... with Html->link(...) ?>. A good place to do this is app/View/Layouts/default.ctp. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Advice on menu setup
Your existing menu is likely a series of elements with in them, yes? Replace the elements with Html->link() ?> calls. A good place to set this up is in app/View/Layouts/default.ctp. -Rob On Monday, October 19, 2015 at 3:41:44 AM UTC-4, Simon Bradley wrote: > > Hi > > I'm new to cakephp > > I'm using version 3 > > I've been working through an existing site i have built and trying to > replicate it with cakephp > > I did a lot very quickly which is great but the menu is tricky > > Since this is a navigation bar at the top of every page i thought i might > use an element > > The problem there seems to be getting the data into it from the database > > I've read the manual quite a bit and based on that i thought maybe > creating a model and controller for the menu would be the best way to go > > Then i could call the menu controller from the article controller and get > the menu data that way > > It looks like i can pass the data into the menu element from there? > > But then where do i put the code that actually takes the data and > generates the menu? > > I've looked at various tutorials but it's not made things clearer > > I'd really appreciate some advice here folks. > > Cheers. > > > > > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Advice on menu setup
Hi I'm new to cakephp I'm using version 3 I've been working through an existing site i have built and trying to replicate it with cakephp I did a lot very quickly which is great but the menu is tricky Since this is a navigation bar at the top of every page i thought i might use an element The problem there seems to be getting the data into it from the database I've read the manual quite a bit and based on that i thought maybe creating a model and controller for the menu would be the best way to go Then i could call the menu controller from the article controller and get the menu data that way It looks like i can pass the data into the menu element from there? But then where do i put the code that actually takes the data and generates the menu? I've looked at various tutorials but it's not made things clearer I'd really appreciate some advice here folks. Cheers. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Best practice to get menu array
By the look of it what you need is a Plugin and inside the Models for the tables you mentioned and at least an Helper to produce the HTML output. I recently used the MenuBuilder Plugin. You will have to add the logic to retrieve the menu from your Models though. On Saturday, September 13, 2014 10:57:21 AM UTC+2, Sam Clauw wrote: > > I have 2 tables which hold pages information: "pages" and "cms_pages". Now > I want to build a menu on every website page with the records within. > What's the best practice for this? > > Should I make a behavior that loads in the "pages" and "cms_pages" model? > If yes, where (and how) should I make the call to that behavior? In the > AppModel class? > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Best practice to get menu array
Can I bump my topic again? :) I realy hope I'll find an answer on this one, it's all about keeping the MVC as clear as possible ;) -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Best practice to get menu array
I have 2 tables which hold pages information: "pages" and "cms_pages". Now I want to build a menu on every website page with the records within. What's the best practice for this? Should I make a behavior that loads in the "pages" and "cms_pages" model? If yes, where (and how) should I make the call to that behavior? In the AppModel class? -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Read XML data and show into Menu
I am not getting the idea .. how to do this plz urgently send me the solution... -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: CAKEPHP Image slider and Menu
You'd do this with Javascript / jQuery, not sure what you mean by menu. Most solutions for any web projects should be sufficient, a quick google will show you results i.e. jQuery Carousel. On 26 August 2014 19:26, papalifegr wrote: > Hello Community, > > I am looking for an Image Slider and Menu for my Project based on CAKEPHP. > Could someone give me solution ? > > Thanks > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Kind Regards Stephen Speakman -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
CAKEPHP Image slider and Menu
Hello Community, I am looking for an Image Slider and Menu for my Project based on CAKEPHP. Could someone give me solution ? Thanks -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: navigation menu using cakePhp tree
You can build tree based menus using the Tree helper See www.dereuromark.de/2013/02/17/cakephp-and-tree-structures/ echo $this->Tree->generate($categories); Am Dienstag, 15. April 2014 19:41:20 UTC+2 schrieb Naresh Kumar: > > > I am using CakePHP tree to generate my navigation menu . I have > generated it successfully. now i need to show them in navigation behavior. > I have tried. it is working but after this basic code i dont know what to > do after this .. how could i build navigation.. > > > *My HomeController.php* > > App::uses('AppController', 'Controller');class HomeController extends > AppController { > var $name='home'; > public function index() { > $this->layout = "front_end_index"; > $this->loadModel('Category'); > $category_tree = $this->Category->generateTreeList(); > $categories_array = array(); > foreach($category_tree as $k => $v) > { > $categories_array[$k] = $this->Category->find('first', > array('conditions' => array('Category.id' => $k))); > } > > $this->set('cat_info',$categories_array); > > }} > > *My category.ctp* > 'parent_id'] == ''){ ?> 'Category']['name'] ;?> > > *Navigation array sample :* > Array ( [1] => Array ( [Category] => Array ( [id] => 1 [parent_id] => [lft > ] => 1 [rght] => 42 [name] => My Categories [url] => http://google.com ) ) > [2] => Array ( [Category] => Array ( [id] => 2 [parent_id] => 1 [lft] => 2 > [rght] => 17 [name] => Fun [url] => http://google.com ) ) [3] => Array ( [ > Category] => Array ( [id] => 3 [parent_id] => 2 [lft] => 3 [rght] => 8 [ > name] => Sport [url] => http://google.com ) ) > > > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi-level menu with Modified Preorder Tree Traversal
You can find more info here: Scroll down to "Finding the Depth of the Nodes" http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ Il giorno martedì 8 aprile 2014 08:19:40 UTC+2, Marco Sbragi ha scritto: > > Hi Sam, > I don't have time to make test at this moment, and sincerely i think > recursion is the best method to make this work. > I can tell you of a solution i found time ago with cake 1.0 in one of my > application. > The base of the logic is in the query i wrote (the query is simplified i > write here only the significant fields): > Don't know if it is correct but i think that shows the sense of this > approach. > > SELECT node.lft, node.rgt, node.id, node.parent_id, > (COUNT(parent.parent_id) - 1) AS depth, >node.description, node.link FROM menu AS node, menu AS parent >WHERE node.lft BETWEEN parent.lft AND parent.rgt; > > this query return a flat list with a depth field that is the hierarchical > level of indentantion of the item (node). > Then at every change of depth up or down you can write the corresponding > or > This is a logic i used many years ago, whit cake 1.0 at this time with the > new features of cakephp i would never use this method. > HTH > > Il giorno domenica 6 aprile 2014 21:13:39 UTC+2, Sam Clauw ha scritto: >> >> Hi Marco, thanks 4 your answer too! I realy do appreciate those great >> scripts you're sending to me. But right now, I still got the problem that I >> can't write the essence of a multi-level menu (without recursion) on my own >> ;) >> Perhaps, you can tell me if / how I can cross my tree-based database >> table and output it in a realy simple list? No active class of >> whatever, but the real essence would help me a lot! :) >> > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi-level menu with Modified Preorder Tree Traversal
Hi Sam, I don't have time to make test at this moment, and sincerely i think recursion is the best method to make this work. I can tell you of a solution i found time ago with cake 1.0 in one of my application. The base of the logic is in the query i wrote (the query is simplified i write here only the significant fields): Don't know if it is correct but i think that shows the sense of this approach. SELECT node.lft, node.rgt, node.id, node.parent_id, (COUNT(parent.parent_id) - 1) AS depth, node.description, node.link FROM menu AS node, menu AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt; this query return a flat list with a depth field that is the hierarchical level of indentantion of the item (node). Then at every change of depth up or down you can write the corresponding or This is a logic i used many years ago, whit cake 1.0 at this time with the new features of cakephp i would never use this method. HTH Il giorno domenica 6 aprile 2014 21:13:39 UTC+2, Sam Clauw ha scritto: > > Hi Marco, thanks 4 your answer too! I realy do appreciate those great > scripts you're sending to me. But right now, I still got the problem that I > can't write the essence of a multi-level menu (without recursion) on my own > ;) > Perhaps, you can tell me if / how I can cross my tree-based database table > and output it in a realy simple list? No active class of whatever, > but the real essence would help me a lot! :) > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi-level menu with Modified Preorder Tree Traversal
Hi Sam, I don't have time to make test at this moment, and sincerely i think recursion is the best method to make this work. I can tell you of a solution i found time ago with cake 1.0 in one of my application. The base of the logic is in the query i wrote (the query is simplified i write here only the significant fields): SELECT node.lft, node.rgt, node.id, node.parent_id, (COUNT(parent.parent_id) - 1) AS depth, node.description, node.link FROM menu AS node, menu AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt; this query return a flat list with a depth field that is the level of indentantion of the item (node). I think something like this can do the work: $depth = $items['Node'][0]['depth']; echo ''; foreach( $items as $k => $item ) { } Il giorno lunedì 7 aprile 2014 14:44:52 UTC+2, Jacob Stevens ha scritto: > > This is a great article, but doesn't have a lot to do with CakePHP. It > certainly spells it out clearly though, and the examples are in PHP. > > http://www.sitepoint.com/hierarchical-data-database/ > > > > > On Sun, Apr 6, 2014 at 3:13 PM, Sam Clauw > > > wrote: > >> Hi Marco, thanks 4 your answer too! I realy do appreciate those great >> scripts you're sending to me. But right now, I still got the problem that I >> can't write the essence of a multi-level menu (without recursion) on my own >> ;) >> Perhaps, you can tell me if / how I can cross my tree-based database >> table and output it in a realy simple list? No active class of >> whatever, but the real essence would help me a lot! :) >> >> -- >> 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 unsubscribe from this group and stop receiving emails from it, send an >> email to cake-php+u...@googlegroups.com . >> To post to this group, send email to cake...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/cake-php. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi-level menu with Modified Preorder Tree Traversal
This is a great article, but doesn't have a lot to do with CakePHP. It certainly spells it out clearly though, and the examples are in PHP. http://www.sitepoint.com/hierarchical-data-database/ On Sun, Apr 6, 2014 at 3:13 PM, Sam Clauw wrote: > Hi Marco, thanks 4 your answer too! I realy do appreciate those great > scripts you're sending to me. But right now, I still got the problem that I > can't write the essence of a multi-level menu (without recursion) on my own > ;) > Perhaps, you can tell me if / how I can cross my tree-based database table > and output it in a realy simple list? No active class of whatever, > but the real essence would help me a lot! :) > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi-level menu with Modified Preorder Tree Traversal
Hi Marco, thanks 4 your answer too! I realy do appreciate those great scripts you're sending to me. But right now, I still got the problem that I can't write the essence of a multi-level menu (without recursion) on my own ;) Perhaps, you can tell me if / how I can cross my tree-based database table and output it in a realy simple list? No active class of whatever, but the real essence would help me a lot! :) -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi-level menu with Modified Preorder Tree Traversal
Hi Sam, this is a component and helper i forked on github for this purpouse. my implementation is written to work with bootstrap 2.3 and SQLite but originally was achieved to work with superfish https://github.com/msbragi/cakemenu Original fork https://github.com/spiliot/cakemenu Actually i have rewritten the code to work with bootstrap3 and font awesome4 but not updated the repository HTH Il giorno lunedì 31 marzo 2014 18:16:17 UTC+2, Sam Clauw ha scritto: > > Hi all, > > In this <http://www.sitepoint.com/hierarchical-data-database-2/> well > known example, the indention of the levels is done by some 's instead > of 's. > I wonder if there's a way to use MPPT (Modified Preorder Tree Traversal) > logic to dynamically build those multi-level menu without using any > recursion? I can't figure out where I have to close those 's and > 's... :s > > Thx! > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi-level menu with Modified Preorder Tree Traversal
right.. :) Am Dienstag, 1. April 2014 13:04:44 UTC+2 schrieb Sam Clauw: > > Hi euromark, > > I did noticed your article, but I don't want to put the whole Tools plugin > into my system... > In fact, the most important thing is that I can code such a tree by myself > (and with soms exterial forum help of course) ;) > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi-level menu with Modified Preorder Tree Traversal
Hi euromark, I did noticed your article, but I don't want to put the whole Tools plugin into my system... In fact, the most important thing is that I can code such a tree by myself (and with soms exterial forum help of course) ;) -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Multi-level menu with Modified Preorder Tree Traversal
Did you see http://www.dereuromark.de/2013/02/17/cakephp-and-tree-structures/ ? Am Montag, 31. März 2014 18:16:17 UTC+2 schrieb Sam Clauw: > > Hi all, > > In this <http://www.sitepoint.com/hierarchical-data-database-2/> well > known example, the indention of the levels is done by some 's instead > of 's. > I wonder if there's a way to use MPPT (Modified Preorder Tree Traversal) > logic to dynamically build those multi-level menu without using any > recursion? I can't figure out where I have to close those 's and > 's... :s > > Thx! > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Multi-level menu with Modified Preorder Tree Traversal
Hi all, In this <http://www.sitepoint.com/hierarchical-data-database-2/> well known example, the indention of the levels is done by some 's instead of 's. I wonder if there's a way to use MPPT (Modified Preorder Tree Traversal) logic to dynamically build those multi-level menu without using any recursion? I can't figure out where I have to close those 's and 's... :s Thx! -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Dynamic menu content in layout
nice!! i was looking for this information as well. On Wednesday, February 26, 2014 4:58:21 PM UTC-5, euromark wrote: > > Take a look at the ideas here: > https://github.com/MenschDankeGmbH/cake-menu_builder > Maybe that helps. > > > Am Samstag, 22. Februar 2014 11:46:16 UTC+1 schrieb Sam Clauw: >> >> What I'm trying to do is to put two dynamic navigation menus in my >> CakePHP layout (default.ctp). The main menu should have multiple levels >> (with a dropdown functionality). The secondary menu is the one that shows >> the dropdown content of the main menu in a left sidebar. >> >> I've read the CakePHP documentation but I'm confused how to fit those >> menus in the layout. I know that you have 4 different parts in a view layer >> (as documented in http://book.cakephp.org/2.0/en/views.html): >> >>- views >>- elements >>- layouts >>- helpers >> >> But with the knowledge I have right now, I think none of this parts can >> be used to fill my needs. A navigation menu is a part that you only load >> ONES in a layout, so it isn't an element or a helper. So what's the best >> practice... >> >>- ... where to create the menu tree? >>- ... where / how to echo it in the layout file? >> >> Can anybody clearify my issue? Thanks in advance! ;) >> > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Dynamic menu content in layout
What you are really wanting is the ViewModel. CakePHP does not implement that explicitly but you can get the same functionality by creating a helper and accessing your model in the helper keeping the view clean. HTH Tarique On Thu, Feb 27, 2014 at 1:09 AM, Sam Clauw wrote: > Okay, let's suppose I want to put my menu in an element called > "top_menu.ctp". I want to get my data out of the database, so probably, I > shouldn't connect with my > -- = The Conference Schedule Creator : http://shdlr.com PHP for E-Biz : http://sanisoft.com = -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Dynamic menu content in layout
Take a look at the ideas here: https://github.com/MenschDankeGmbH/cake-menu_builder Maybe that helps. Am Samstag, 22. Februar 2014 11:46:16 UTC+1 schrieb Sam Clauw: > > What I'm trying to do is to put two dynamic navigation menus in my CakePHP > layout (default.ctp). The main menu should have multiple levels (with a > dropdown functionality). The secondary menu is the one that shows the > dropdown content of the main menu in a left sidebar. > > I've read the CakePHP documentation but I'm confused how to fit those > menus in the layout. I know that you have 4 different parts in a view layer > (as documented in http://book.cakephp.org/2.0/en/views.html): > >- views >- elements >- layouts >- helpers > > But with the knowledge I have right now, I think none of this parts can be > used to fill my needs. A navigation menu is a part that you only load ONES > in a layout, so it isn't an element or a helper. So what's the best > practice... > >- ... where to create the menu tree? >- ... where / how to echo it in the layout file? > > Can anybody clearify my issue? Thanks in advance! ;) > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Dynamic menu content in layout
No, you don't want to anything in the view that involves querying the database. The controller action for that given page should know what menu to fetch from database and set that to the view. /thomas On 26 Feb 2014, at 20:39, Sam Clauw wrote: > Okay, let's suppose I want to put my menu in an element called > "top_menu.ctp". I want to get my data out of the database, so probably, I > shouldn't connect with my database in that .ctp file. I wonder if that's the > right way to do so? MVC normally split us the model logic and the view logic, > but now you'll all get it in one file? Or am I missing something? ;) -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Dynamic menu content in layout
Okay, let's suppose I want to put my menu in an element called "top_menu.ctp". I want to get my data out of the database, so probably, I shouldn't connect with my database in that .ctp file. I wonder if that's the right way to do so? MVC normally split us the model logic and the view logic, but now you'll all get it in one file? Or am I missing something? ;) -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Dynamic menu content in layout
hi, You can put the tree menu directly in the layout or in a separate menu elements and include them in a specific place on your layout. If you want to highlight active link in your menu, you can do the following: // menu ..link to contacts views ..link to contacts views ... // in Posts/index.ctp // in Posts/view.ctp .. $this->set('active','posts'); If you want to dynamically add or modify the sidebar, use and expand the view blocks http://book.cakephp.org/2.0/en/views.html#extending-views -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Dynamic menu content in layout
What I'm trying to do is to put two dynamic navigation menus in my CakePHP layout (default.ctp). The main menu should have multiple levels (with a dropdown functionality). The secondary menu is the one that shows the dropdown content of the main menu in a left sidebar. I've read the CakePHP documentation but I'm confused how to fit those menus in the layout. I know that you have 4 different parts in a view layer (as documented in http://book.cakephp.org/2.0/en/views.html): - views - elements - layouts - helpers But with the knowledge I have right now, I think none of this parts can be used to fill my needs. A navigation menu is a part that you only load ONES in a layout, so it isn't an element or a helper. So what's the best practice... - ... where to create the menu tree? - ... where / how to echo it in the layout file? Can anybody clearify my issue? Thanks in advance! ;) -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: missing debug menu
This is the DebugKit plugin, see here: https://github.com/cakephp/debug_kit You may already have it in your plugins folder so maybe you just need to update bootstrap, see the instructions on the link above Thanks Stephen On 28 December 2013 16:54, roundrightfarm wrote: > Greetings, > I just switched from cakephp 1.3 to 2.x. in 1.3 there was a debug menu > that would appear when Configure::write('debug', 2); It was a pop-out menu > that started in the upper right hand corner of the screen and would show > you, among other things, which variables were set to a view. > > Is this menu gone from cakephp 2.x, or am I missing something > > Thanks > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/groups/opt_out. > -- Kind Regards Stephen Speakman -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
RE: missing debug menu
I think you are referring to the Debug Kit? You have to have the DebugKit in your Plugin folder then load it in your bootstrap file. Config/bootstrap.php: CakePlugin::load('DebugKit'); Dave From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of roundrightfarm Sent: Saturday, December 28, 2013 1:24 PM To: cake-php@googlegroups.com Subject: missing debug menu Greetings, I just switched from cakephp 1.3 to 2.x. in 1.3 there was a debug menu that would appear when Configure::write('debug', 2); It was a pop-out menu that started in the upper right hand corner of the screen and would show you, among other things, which variables were set to a view. Is this menu gone from cakephp 2.x, or am I missing something Thanks -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
missing debug menu
Greetings, I just switched from cakephp 1.3 to 2.x. in 1.3 there was a debug menu that would appear when Configure::write('debug', 2); It was a pop-out menu that started in the upper right hand corner of the screen and would show you, among other things, which variables were set to a view. Is this menu gone from cakephp 2.x, or am I missing something Thanks -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: sub menu navigation in cake php
Search for "Tree Behavior" on CakePHP´s page Em quinta-feira, 4 de abril de 2013 01h27min50s UTC-3, Bhavya Pallem escreveu: > > Is any one aware of how to create sub menu navigation dynamically in > cakephp -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: sub menu navigation in cake php
you can use cakes built in pages controller to handle your Submenues or copy code there and apply it to any other controller, but please be aware that the index function is routed to the 'display' action this can possibly cause problems... your URL to open souch a Subpage would look like this: YOUR_URL/pages/submenueDir/subpage ... Am Donnerstag, 4. April 2013 06:27:50 UTC+2 schrieb Bhavya Pallem: > > Is any one aware of how to create sub menu navigation dynamically in > cakephp -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
sub menu navigation in cake php
Is any one aware of how to create sub menu navigation dynamically in cakephp -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Building a tree menu with nested lists containing links
the cake 2.3 version of the tree helper can be found at http://www.dereuromark.de/2013/02/17/cakephp-and-tree-structures/ Am Dienstag, 26. März 2013 00:07:07 UTC+1 schrieb cricket: > > Have a look here: > > https://groups.google.com/forum/?fromgroups=#!topic/cake-php/ilQmFGLUZjc > > It's older, so may need some polish for 2.x. > > On Mon, Mar 25, 2013 at 9:13 AM, Carsten Kozianka > > > wrote: > > I am using the tree behavior to create a side-wide category structure > that > > should be displayed as a explorer-style tree menu and/or suckerfish > > dropdowns. > > > > Model, controller and view are created according to the cookbook: > > http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html > > > > Everything works fine BUT: > > > > If I build the menu via generateTreeList the result is a flat list with > > links: > > > > > > Home > > Subcategory > > > > > > I cannot turn his into a tree/drop-down menu with DOM manipulation > because > > the category hierarchy is not reflected in the HTML structure. > > > > To do so, I would need the tree built with nested lists. > > > > So I tried HTMLHelper::nestedList instead. As a result, I get the tree > with > > nested lists but unfortunately without links to the categories. > > > > Now I only see two solutions to my problem: > > > > Use "findThreaded" on the category table and write my own recursive > function > > to build the tree. This would take some time because I am not a > experienced > > programmer. On the other hand, I think if CakePHP has a tree behavior it > > should enable me to easily accomplish this common task. > > Add the missing links to the category name when a new category is saved. > > E.g. category name form data "Home" is saved to the database as " > href="categories/view/1">Home". Then I could use > HTMLHelper::nestedList > > for tree output. > > > > I really would appreciate if somebody could help me with this. > > > > Thanks in advance > > Carsten > > > > -- > > 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 unsubscribe from this group and stop receiving emails from it, send > an > > email to cake-php+u...@googlegroups.com . > > To post to this group, send email to cake...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Building a tree menu with nested lists containing links
Have a look here: https://groups.google.com/forum/?fromgroups=#!topic/cake-php/ilQmFGLUZjc It's older, so may need some polish for 2.x. On Mon, Mar 25, 2013 at 9:13 AM, Carsten Kozianka wrote: > I am using the tree behavior to create a side-wide category structure that > should be displayed as a explorer-style tree menu and/or suckerfish > dropdowns. > > Model, controller and view are created according to the cookbook: > http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html > > Everything works fine BUT: > > If I build the menu via generateTreeList the result is a flat list with > links: > > > Home > Subcategory > > > I cannot turn his into a tree/drop-down menu with DOM manipulation because > the category hierarchy is not reflected in the HTML structure. > > To do so, I would need the tree built with nested lists. > > So I tried HTMLHelper::nestedList instead. As a result, I get the tree with > nested lists but unfortunately without links to the categories. > > Now I only see two solutions to my problem: > > Use "findThreaded" on the category table and write my own recursive function > to build the tree. This would take some time because I am not a experienced > programmer. On the other hand, I think if CakePHP has a tree behavior it > should enable me to easily accomplish this common task. > Add the missing links to the category name when a new category is saved. > E.g. category name form data "Home" is saved to the database as " href="categories/view/1">Home". Then I could use HTMLHelper::nestedList > for tree output. > > I really would appreciate if somebody could help me with this. > > Thanks in advance > Carsten > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Building a tree menu with nested lists containing links
I am using the tree behavior to create a side-wide category structure that should be displayed as a explorer-style tree menu and/or suckerfish dropdowns. Model, controller and view are created according to the cookbook: http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html Everything works fine BUT: If I build the menu via generateTreeList the result is a flat list with links: Home Subcategory I cannot turn his into a tree/drop-down menu with DOM manipulation because the category hierarchy is not reflected in the HTML structure. To do so, I would need the tree built with nested lists. So I tried HTMLHelper::nestedList instead. As a result, I get the tree with nested lists but unfortunately without links to the categories. Now I only see two solutions to my problem: 1. Use "findThreaded" on the category table and write my own recursive function to build the tree. This would take some time because I am not a experienced programmer. On the other hand, I think if CakePHP has a tree behavior it should enable me to easily accomplish this common task. 2. Add the missing links to the category name when a new category is saved. E.g. category name form data "Home" is saved to the database as "Home". Then I could use HTMLHelper::nestedList for tree output. I really would appreciate if somebody could help me with this. Thanks in advance Carsten -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Dropdown list menu
I'm developing a small web app for scanning parcels coming in to a warehouse. I want the functionality of having a dropdownlist where I can choose shipping company to open a new site to scan parcels for this company. I got 2 tables. Parcels and Carriers. In the Carriers table i got id, name. 1, Fedex 2, DHL 3, UPS etc. I want the dropdownlist to show the name. When choosing a name a new popup should open going to http://localhost:/Postlog/parcels/scan/ How can I make a dropdown list doing this? It does'nt matter if the popup opens when choosing the name from the list or by pressing a button after. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Listing menu items from database to layout file
Wow, thanks again for the amazing explanation! The problem was with my server, it was encoding in ANSI, also the database in MySql (phpmyadmin) was misleading somehow. It showed that it's UTF-8, but for some reason it was in north american ANSI.. Managed to change that, thanks to you. Definately going to stay with Cake, one of the best community over here! :D Thanks again, Tristan 2012/12/9 lowpass > On Sat, Dec 8, 2012 at 4:50 AM, Trisztán Thar > wrote: > > > > lowpass: > > Actually, I did, and it has problems with my non-english characters, it > > doesn't display them.. Maybe server configuration? I'm using EasyPHP as > my > > server. > > There are a number of stages where character encoding can cause > problems. You need to ensure that each piece of software is configured > properly. It's similar to colour management in that regard. Even > sending files to the server via FTP can be problematic. > > You didn't mention which OS you're using; if it's Windows I can't help > much. I'm assuming you want UTF-8 encoding, as it's the most useful > and the default in most software these days. > > First, check your editor. Make sure it's saving as UTF-8. If possible, > check to see that it recognises the file as UTF-8 when you open it. > > If you're using Linux or OS X you can run this in a terminal to see > what the encoding actually is: > > file -bi your_file > > Check the database. MySQL still uses Latin1 by default for some > bizarre reason. When you create the database and tables, always > include the character encoding you want if any of the columns will > contain text. > > To see what your existing DB is configured as, log into MySQL and type: > > SHOW FULL COLUMNS FROM your_table; > > Note what the Collation is for the column with the text you're seeing > problems with. > > Also, if you import data into MySQL, always place this at the top of the > file: > > SET NAMES 'utf8'; > SET CHARACTER SET 'utf8'; > > Next, check Cake. It uses UTF-8 by default. Check that the > App.encoding in app/core.php is correct. > > If you can, check that your webserver is behaving properly. In Apache: > > AddDefaultCharset utf-8 > > Check the response headers for the page. There are many ways to do > this. Firebug's Net panel, for example. You should see: > > Content-Typetext/html; charset=UTF-8 > > In your layouts, include this in the head section: > > echo $this->Html->charset(); > > This should create: > > > > View source to be sure. > > -- > 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+unsubscr...@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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Listing menu items from database to layout file
On Sat, Dec 8, 2012 at 4:50 AM, Trisztán Thar wrote: > > lowpass: > Actually, I did, and it has problems with my non-english characters, it > doesn't display them.. Maybe server configuration? I'm using EasyPHP as my > server. There are a number of stages where character encoding can cause problems. You need to ensure that each piece of software is configured properly. It's similar to colour management in that regard. Even sending files to the server via FTP can be problematic. You didn't mention which OS you're using; if it's Windows I can't help much. I'm assuming you want UTF-8 encoding, as it's the most useful and the default in most software these days. First, check your editor. Make sure it's saving as UTF-8. If possible, check to see that it recognises the file as UTF-8 when you open it. If you're using Linux or OS X you can run this in a terminal to see what the encoding actually is: file -bi your_file Check the database. MySQL still uses Latin1 by default for some bizarre reason. When you create the database and tables, always include the character encoding you want if any of the columns will contain text. To see what your existing DB is configured as, log into MySQL and type: SHOW FULL COLUMNS FROM your_table; Note what the Collation is for the column with the text you're seeing problems with. Also, if you import data into MySQL, always place this at the top of the file: SET NAMES 'utf8'; SET CHARACTER SET 'utf8'; Next, check Cake. It uses UTF-8 by default. Check that the App.encoding in app/core.php is correct. If you can, check that your webserver is behaving properly. In Apache: AddDefaultCharset utf-8 Check the response headers for the page. There are many ways to do this. Firebug's Net panel, for example. You should see: Content-Typetext/html; charset=UTF-8 In your layouts, include this in the head section: echo $this->Html->charset(); This should create: View source to be sure. -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Listing menu items from database to layout file
Thank you Tim, again, worked great :) Really helpful community here :) lowpass: Actually, I did, and it has problems with my non-english characters, it doesn't display them.. Maybe server configuration? I'm using EasyPHP as my server. 2012/12/7 Tim Denholm > Hi Tristan, > > To add class names, just alter your $menu array as follows: > > $menu = array( > 'options' => array('class' => 'menuitems'), > 'items' => array( > array('title' => 'Hirek', 'url' => array('controller' => 'posts', > 'action' => 'index'), 'options' => array('class' => 'button1')), > array('title' => 'Tutorialok', 'url' => array('controller' => > 'posts', 'action' => 'tutorials'), 'options' => array('class' => > 'button2')), > array('title' => 'Munkaim', 'url' => array('controller' => > 'posts', 'action' => 'jobs'), 'options' => array('class' => 'button3')), > array('title' => 'Kapcsolat', 'url' => array('controller' => > 'posts', 'action' => 'contact'), 'options' => array('class' => 'button4')) > )); > > I'm not sure how to fix the issue with non-english characters sorry. > > Cheers, > Tim > > > On Sat, Dec 8, 2012 at 8:17 AM, Trisztán Thar 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: >> >> stuff >> stuff >> stuff >> >> >> 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: >> >> Hirek >> > href='website/posts/tutorials'>Tutorialok >> >> Kapcsolat >> >> 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 >> >>> 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 >>> wrote: >>> > One more thing: >>> > I have used this helper, but i have discovered that it won't list menu >>> items >&g
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 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: > > stuff > stuff > stuff > > > 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: > > Hirek > href='website/posts/tutorials'>Tutorialok > > Kapcsolat > > 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 >> >> 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 >> 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+unsubscr...@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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Listing menu items from database to layout file
Hi Tristan, To add class names, just alter your $menu array as follows: $menu = array( 'options' => array('class' => 'menuitems'), 'items' => array( array('title' => 'Hirek', 'url' => array('controller' => 'posts', 'action' => 'index'), 'options' => array('class' => 'button1')), array('title' => 'Tutorialok', 'url' => array('controller' => 'posts', 'action' => 'tutorials'), 'options' => array('class' => 'button2') ), array('title' => 'Munkaim', 'url' => array('controller' => 'posts', 'action' => 'jobs'), 'options' => array('class' => 'button3')), array('title' => 'Kapcsolat', 'url' => array('controller' => 'posts', 'action' => 'contact'), 'options' => array('class' => 'button4')) )); I'm not sure how to fix the issue with non-english characters sorry. Cheers, Tim On Sat, Dec 8, 2012 at 8:17 AM, Trisztán Thar 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: > > stuff > stuff > stuff > > > 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: > > Hirek > href='website/posts/tutorials'>Tutorialok > > Kapcsolat > > 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 > >> 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 >> 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 >>
Re: Listing menu items from database to layout file
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: stuff stuff stuff 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: Hirek Tutorialok Kapcsolat 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 > 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 > 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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Listing menu items from database to layout file
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 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+unsubscr...@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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Listing menu items from database to layout file
You seem to have a few of the concepts wrong here. I'll try to explain. > foreach ($menu as $Menu): This is where the error is happening. The problem is that, in the controller action, you created a view variable named $Menu. But your code here is looking for an array named $menu. You have it backwards. Think of a foreach like this: foreach($data as $item) means: for each element in $data array, create a copy and name it $item for use within this block of code. I generally name my view variables $data because the model name will be a key inside, eg. $data['Menu']['whatever']. (Just don't mix it up with $this->request->data!) The next problem is that you're trying to create a menu that includes a link to the code to create the menu: > array('controller' => 'Menu', 'action' => 'loadmenu') You mentioned that you're doing the blog tutorial so I presume that your menu should be links to all blog posts. If that's the case, you don't need a Menu model or MenusController. Instead, you'll want to find('list') or find('all') from Post to get all of the titles and IDs of each Post. With that you can create a basic menu. Here's a really basic example that may help explain MVC, taken from my own code, but simplified a bit. layout: echo $this->element('Posts/menu'); app/View/Elements/Posts/menu.ctp: $archive = $this->requestAction('/posts/archive'); // die(debug($archive)); Html->link( $item['Post']['title'], array( 'controller' => 'Posts', 'action' => 'view', 'id' => $item['Post['id'] ), array('title' => $item['Post']['title']) ); ?> Uncomment the die(debug()) lines separately to get an understanding of how the array of data is returned, and how foreach works. PostsController: public function archive() { $archive = Cache::read('PostArchive'); if (empty($archive)) { $archive = $this->Post->fetchArchive(); Cache::write('PostArchive', $archive); } return $archive; } Notice that you don't need to set() a view variable here but instead return it. This is because we're calling this controller function with requestAction(). Also, if caching is enabled, we don't need to call the model (and thus the database) to get the archive. Post model: public function fetchArchive() { return $this->find( 'all', array( 'fields' => array( 'Post.id', 'Post.created', 'Post.title' ), 'order' => array( 'Post.created' => 'DESC' ) ) ); } Once again, this is pretty basic. It can be improved upon but it should get you on your way. -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Listing menu items from database to layout file
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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Listing menu items from database to layout file
Thank you Tim, worked like a charm. I'll definately read the info you've given me about MVC, and hopefully will understand it in no time :) Have a nice day! Tristan 2012. december 6., csütörtök 5:03:14 UTC+1 időpontban tim a következőt írta: > > Hi Tristan, > > You should implement this as a Helper. I recommend this one as an example > (I've used it myself): http://nooclear.com/content/cakephp-2x-menuhelper > > Place this class in a file called MenuHelper.php in your > /app/Views/Helpers directory. Then add the following to > /app/Controllers/AppController.php: > > class AppController extends Controller{ > public $helpers = array('Menu'); > } > > Then inside of your views, whether it be your default layout, an > individual view, or a nested view, add this: > > $menu = array( 'options' => array('class' => 'nav-style'), 'items' => > array( array('title' => 'List Users', 'url' => array('controller' => > 'users', 'action' => 'index')), array('title' => 'Add User', 'url' => > array('controller' => 'users', 'action' => 'add')), ) ); print > $this->Menu->render($menu); > > I recommend reading this for a better understanding of MVC ( > http://book.cakephp.org/2.0/en/cakephp-overview/understanding-model-view-controller.html). > > It might be worthwhile searching for some other MVC tutorials as well until > you're comfortable with your understanding of the concept. > > Cheers, > Tim > > > On Thu, Dec 6, 2012 at 5:53 AM, Trisztán Thar > > wrote: > >> Hello >> >> Please bear with my noobness, I am super new to CakePHP, and don't really >> understand it yet. >> >> So, I was messing around with default.ctp, of course to make a layout for >> my site. I followed the Blog Tutorial, and I am planning to build my site >> on that. >> I'd like to add a navigation menu, which would look like this in plain >> HTML: >> >> >> First Page >> >> Second Page >> Third Page >> Fourth Page >> >> >> >> I saw that the layout file uses lots of CakePHP's built in function to >> add divs and links, and I'd like to make this myself as well. >> I have the following code in my default.ctp file: >> >> foreach ($menu as $Menu): >> echo $this->Html->div('grid_12 menubar', $this->Html->div('menuitems >> grid_3', $this->Html->link($menu['Menu']['item'], array('controller' => >> 'Menu', 'action' => 'loadmenu'; >> endforeach; >> unset ($menu); >> >> If i'm right, this would list my 4 menu items from my MySQL database. (I >> didn't find a way to add multiple child items in the div() 'helper(?)', >> this is why I have choosen to do it this way) >> So, from my experiences of the Blog tutorial I made a model named >> Menu.php: >> >> class Menu extends AppMenu{ >> } >> >> And i made a controller for that (MenuController.php) >> (I actually don't understand a bit of this whole Model and Controller >> thing, even thought I read the CookBook and documentation.. guess it'll >> come in time) >> >> class MenuController extends AppController{ >> public function loadmenu(){ >> $this->set('Menu', $this->Menu->find('all')); >> } >> } >> >> Ok so i got all this, let's check how it works. Going to >> localhost/website/posts i find this: >> >> *Notice* (8): Undefined variable: Menu [*APP\View\Layouts\default.ctp*, line >> *44*] >> >> *Warning* (2): Invalid argument supplied for foreach() >> [*APP\View\Layouts\default.ctp*, line *44*] >> >> >> If i understand right, it does not pass the variable Menu from >> MenuController to the layout file. >> >> Could someone please explain me how to do this, and why it didn't work? >> Also, if you've got some free time, and could explain me (the simplest way) >> how models and controller work (with views), i'd be really thankful. >> >> >> Thanks a lot folks, >> >> Tristan >> >> -- >> 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...@googlegroups.com >> . >> To unsubscribe from this group, send email to >> cake-php+u...@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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Listing menu items from database to layout file
Hi Tristan, You should implement this as a Helper. I recommend this one as an example (I've used it myself): http://nooclear.com/content/cakephp-2x-menuhelper Place this class in a file called MenuHelper.php in your /app/Views/Helpers directory. Then add the following to /app/Controllers/AppController.php: class AppController extends Controller{ public $helpers = array('Menu'); } Then inside of your views, whether it be your default layout, an individual view, or a nested view, add this: $menu = array( 'options' => array('class' => 'nav-style'), 'items' => array( array('title' => 'List Users', 'url' => array('controller' => 'users', 'action' => 'index')), array('title' => 'Add User','url' => array('controller' => 'users', 'action' => 'add')), ) ); print $this->Menu->render($menu); I recommend reading this for a better understanding of MVC (http://book.cakephp.org/2.0/en/cakephp-overview/understanding-model-view-controller.html). It might be worthwhile searching for some other MVC tutorials as well until you're comfortable with your understanding of the concept. Cheers, Tim On Thursday, December 6, 2012 5:53:53 AM UTC+11, Trisztán Thar wrote: > > Hello > > Please bear with my noobness, I am super new to CakePHP, and don't really > understand it yet. > > So, I was messing around with default.ctp, of course to make a layout for > my site. I followed the Blog Tutorial, and I am planning to build my site > on that. > I'd like to add a navigation menu, which would look like this in plain > HTML: > > > First Page > > Second Page > Third Page > Fourth Page > > > > I saw that the layout file uses lots of CakePHP's built in function to add > divs and links, and I'd like to make this myself as well. > I have the following code in my default.ctp file: > > foreach ($menu as $Menu): > echo $this->Html->div('grid_12 menubar', $this->Html->div('menuitems > grid_3', $this->Html->link($menu['Menu']['item'], array('controller' => > 'Menu', 'action' => 'loadmenu'; > endforeach; > unset ($menu); > > If i'm right, this would list my 4 menu items from my MySQL database. (I > didn't find a way to add multiple child items in the div() 'helper(?)', > this is why I have choosen to do it this way) > So, from my experiences of the Blog tutorial I made a model named Menu.php: > > class Menu extends AppMenu{ > } > > And i made a controller for that (MenuController.php) > (I actually don't understand a bit of this whole Model and Controller > thing, even thought I read the CookBook and documentation.. guess it'll > come in time) > > class MenuController extends AppController{ > public function loadmenu(){ > $this->set('Menu', $this->Menu->find('all')); > } > } > > Ok so i got all this, let's check how it works. Going to > localhost/website/posts i find this: > > *Notice* (8): Undefined variable: Menu [*APP\View\Layouts\default.ctp*, line > *44*] > > *Warning* (2): Invalid argument supplied for foreach() > [*APP\View\Layouts\default.ctp*, line *44*] > > > If i understand right, it does not pass the variable Menu from MenuController > to the layout file. > > Could someone please explain me how to do this, and why it didn't work? Also, > if you've got some free time, and could explain me (the simplest way) how > models and controller work (with views), i'd be really thankful. > > > Thanks a lot folks, > > Tristan > > -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Listing menu items from database to layout file
Hi Tristan, You should implement this as a Helper. I recommend this one as an example (I've used it myself): http://nooclear.com/content/cakephp-2x-menuhelper Place this class in a file called MenuHelper.php in your /app/Views/Helpers directory. Then add the following to /app/Controllers/AppController.php: class AppController extends Controller{ public $helpers = array('Menu'); } Then inside of your views, whether it be your default layout, an individual view, or a nested view, add this: $menu = array( 'options' => array('class' => 'nav-style'), 'items' => array( array('title' => 'List Users', 'url' => array('controller' => 'users', 'action' => 'index')), array('title' => 'Add User', 'url' => array('controller' => 'users', 'action' => 'add')), ) ); print $this->Menu->render($menu); I recommend reading this for a better understanding of MVC ( http://book.cakephp.org/2.0/en/cakephp-overview/understanding-model-view-controller.html). It might be worthwhile searching for some other MVC tutorials as well until you're comfortable with your understanding of the concept. Cheers, Tim On Thu, Dec 6, 2012 at 5:53 AM, Trisztán Thar wrote: > Hello > > Please bear with my noobness, I am super new to CakePHP, and don't really > understand it yet. > > So, I was messing around with default.ctp, of course to make a layout for > my site. I followed the Blog Tutorial, and I am planning to build my site > on that. > I'd like to add a navigation menu, which would look like this in plain > HTML: > > > First Page > > Second Page > Third Page > Fourth Page > > > > I saw that the layout file uses lots of CakePHP's built in function to add > divs and links, and I'd like to make this myself as well. > I have the following code in my default.ctp file: > > foreach ($menu as $Menu): > echo $this->Html->div('grid_12 menubar', $this->Html->div('menuitems > grid_3', $this->Html->link($menu['Menu']['item'], array('controller' => > 'Menu', 'action' => 'loadmenu'; > endforeach; > unset ($menu); > > If i'm right, this would list my 4 menu items from my MySQL database. (I > didn't find a way to add multiple child items in the div() 'helper(?)', > this is why I have choosen to do it this way) > So, from my experiences of the Blog tutorial I made a model named Menu.php: > > class Menu extends AppMenu{ > } > > And i made a controller for that (MenuController.php) > (I actually don't understand a bit of this whole Model and Controller > thing, even thought I read the CookBook and documentation.. guess it'll > come in time) > > class MenuController extends AppController{ > public function loadmenu(){ > $this->set('Menu', $this->Menu->find('all')); > } > } > > Ok so i got all this, let's check how it works. Going to > localhost/website/posts i find this: > > *Notice* (8): Undefined variable: Menu [*APP\View\Layouts\default.ctp*, line > *44*] > > *Warning* (2): Invalid argument supplied for foreach() > [*APP\View\Layouts\default.ctp*, line *44*] > > > If i understand right, it does not pass the variable Menu from MenuController > to the layout file. > > Could someone please explain me how to do this, and why it didn't work? Also, > if you've got some free time, and could explain me (the simplest way) how > models and controller work (with views), i'd be really thankful. > > > Thanks a lot folks, > > Tristan > > -- > 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+unsubscr...@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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Listing menu items from database to layout file
Hello Please bear with my noobness, I am super new to CakePHP, and don't really understand it yet. So, I was messing around with default.ctp, of course to make a layout for my site. I followed the Blog Tutorial, and I am planning to build my site on that. I'd like to add a navigation menu, which would look like this in plain HTML: First Page Second Page Third Page Fourth Page I saw that the layout file uses lots of CakePHP's built in function to add divs and links, and I'd like to make this myself as well. I have the following code in my default.ctp file: foreach ($menu as $Menu): echo $this->Html->div('grid_12 menubar', $this->Html->div('menuitems grid_3', $this->Html->link($menu['Menu']['item'], array('controller' => 'Menu', 'action' => 'loadmenu'; endforeach; unset ($menu); If i'm right, this would list my 4 menu items from my MySQL database. (I didn't find a way to add multiple child items in the div() 'helper(?)', this is why I have choosen to do it this way) So, from my experiences of the Blog tutorial I made a model named Menu.php: class Menu extends AppMenu{ } And i made a controller for that (MenuController.php) (I actually don't understand a bit of this whole Model and Controller thing, even thought I read the CookBook and documentation.. guess it'll come in time) class MenuController extends AppController{ public function loadmenu(){ $this->set('Menu', $this->Menu->find('all')); } } Ok so i got all this, let's check how it works. Going to localhost/website/posts i find this: *Notice* (8): Undefined variable: Menu [*APP\View\Layouts\default.ctp*, line *44*] *Warning* (2): Invalid argument supplied for foreach() [*APP\View\Layouts\default.ctp*, line *44*] If i understand right, it does not pass the variable Menu from MenuController to the layout file. Could someone please explain me how to do this, and why it didn't work? Also, if you've got some free time, and could explain me (the simplest way) how models and controller work (with views), i'd be really thankful. Thanks a lot folks, Tristan -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: How to save and retrieve the status of a dropdown menu between views?
On Tue, Sep 4, 2012 at 6:09 PM, darkangel wrote: > thanks for your answer but I dont get it You would put that code inside the jquery ready() block. ie: $(function() { // here }); The code runs through each link inside your menu, comparing the href value of the link against the page location. When it finds a match it removes the "close" class on the parent UL (which is set by default) and breaks from the loop. > I was thinking about to write a > parameter with Session->write to read it beforeRender and fill my view > depending on that parameter. > > Is there a way to have that functionality just with Js? You could set a cookie from js and then also read it to find which UL to remove the class from. But it's overkill. The code I provided is much simpler. But this doesn't have anything to do with Cake, in any case. -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: How to save and retrieve the status of a dropdown menu between views?
thanks for your answer but I dont get it, I was thinking about to write a parameter with Session->write to read it beforeRender and fill my view depending on that parameter. Is there a way to have that functionality just with Js? On Tuesday, September 4, 2012 2:27:19 PM UTC-6, cricket wrote: > > Rather than store the state between requests, you could use some js to > open it if necessary. > > $('#mws-navigation a').each(function() > { > if ($(this).attr('href') == location.href) > { > $(this).closest('ul').toggleClass('closed'); > return false; > } > }); > > On Tue, Sep 4, 2012 at 3:11 PM, darkangel > > wrote: > > Hi, I'm almost finishing my first cake app so I'm fixing some UI issues. > > Straight to the point: I have a sidebar menu with a dropdown submenu, > the > > folding state is defined by the css class "closed" so my question is how > can > > I save that status to persist between views? Now when I navigate to > another > > view the class resets to closed. > > > > this is my View (rendered from my sidebar element): > > > > > > > > > > Html->link('Clients', '/clients', > > array('class' => 'mws-i-24 i-group'))?> > > Html->link('Transfers', > '/transfers', > > array('class' => 'mws-i-24 i-power'))?> > > Html->link('Hits', '/hits', > > array('class' => 'mws-i-24 i-alarm-bell-2'))?> > > > > Html->link('Admin', '#', > array('class' > > => 'mws-i-24 i-cog')); ?> > > > > Html->link('Users', > > '/allUsers'); ?> > > Html->link('Groups', > > '/allGroups'); ?> > > Html->link('Permissions', > > '/permissions'); ?> > > > > > > > > > > > > > > > > This is the Js that toggles the submenu when the user click on the > parent > > tag: > > > > $("div#mws-navigation ul li a, div#mws-navigation ul li span") > > .bind('click', function(event) { > > if($(this).next('ul').size() !== 0) { > > $(this).next('ul').slideToggle('fast', function() { > > $(this).toggleClass('closed'); > > }); > > event.preventDefault(); > > } > > }); > > > > > > Thanks for your help, I really appreciate it in advance. > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "CakePHP" group. > > To post to this group, send email to cake...@googlegroups.com. > > > To unsubscribe from this group, send email to > > cake-php+u...@googlegroups.com . > > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. > > > > > -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: How to save and retrieve the status of a dropdown menu between views?
Rather than store the state between requests, you could use some js to open it if necessary. $('#mws-navigation a').each(function() { if ($(this).attr('href') == location.href) { $(this).closest('ul').toggleClass('closed'); return false; } }); On Tue, Sep 4, 2012 at 3:11 PM, darkangel wrote: > Hi, I'm almost finishing my first cake app so I'm fixing some UI issues. > Straight to the point: I have a sidebar menu with a dropdown submenu, the > folding state is defined by the css class "closed" so my question is how can > I save that status to persist between views? Now when I navigate to another > view the class resets to closed. > > this is my View (rendered from my sidebar element): > > > > > Html->link('Clients', '/clients', > array('class' => 'mws-i-24 i-group'))?> > Html->link('Transfers', '/transfers', > array('class' => 'mws-i-24 i-power'))?> > Html->link('Hits', '/hits', > array('class' => 'mws-i-24 i-alarm-bell-2'))?> > > Html->link('Admin', '#', array('class' > => 'mws-i-24 i-cog')); ?> > > Html->link('Users', > '/allUsers'); ?> > Html->link('Groups', > '/allGroups'); ?> > Html->link('Permissions', > '/permissions'); ?> > > > > > > > > This is the Js that toggles the submenu when the user click on the parent > tag: > > $("div#mws-navigation ul li a, div#mws-navigation ul li span") > .bind('click', function(event) { > if($(this).next('ul').size() !== 0) { > $(this).next('ul').slideToggle('fast', function() { > $(this).toggleClass('closed'); > }); > event.preventDefault(); > } > }); > > > Thanks for your help, I really appreciate it in advance. > > -- > 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+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en-US. > > -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
How to save and retrieve the status of a dropdown menu between views?
Hi, I'm almost finishing my first cake app so I'm fixing some UI issues. Straight to the point: I have a sidebar menu with a dropdown submenu, the folding state is defined by the css class "closed" so my question is how can I save that status to persist between views? Now when I navigate to another view the class resets to closed. this is my View (rendered from my sidebar element): Html->link('Clients', '/clients', array('class' => 'mws-i-24 i-group'))?> Html->link('Transfers', '/transfers', array('class' => 'mws-i-24 i-power'))?> Html->link('Hits', '/hits', array('class' => 'mws-i-24 i-alarm-bell-2'))?> Html->link('Admin', '#', array('class' => 'mws-i-24 i-cog')); ?> ** Html->link('Users', '/allUsers'); ?> Html->link('Groups', '/allGroups'); ?> Html->link('Permissions', '/permissions'); ?> This is the Js that toggles the submenu when the user click on the parent tag: $("div#mws-navigation ul li a, div#mws-navigation ul li span") .bind('click', function(event) { if($(this).next('ul').size() !== 0) { $(this).next('ul').slideToggle('fast', function() { $(this).toggleClass('closed'); }); event.preventDefault(); } }); Thanks for your help, I really appreciate it in advance. -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Nested Menu in Cake 2.x
http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html - S On 16 July 2012 02:15, Ain Devonshire wrote: > yeah but i dont have letf and right fields on my database..can you put on > some links as my references? > > > On Friday, July 13, 2012 7:54:26 PM UTC+8, MaJerle.Eu wrote: >> >> you can use Tree Behavior to properly nested menu items, then use >> Model::find('threaded'); and you will get nested array, then just >> recursively go through all array and make html output with ul and li. >> >> Then use css or jQuery for nice user display (Mootools, etc..) >> -- >> Lep pozdrav, Tilen Majerle >> http://majerle.eu >> >> >> >> 2012/7/13 Ain Devonshire >> >>> Hi guys currently my site is only displaying menu and it submenu. How >>> will i display the children of the submenu? >>> >>> -- >>> Our newest site for the community: CakePHP Video Tutorials >>> http://tv.cakephp.org >>> Check out the new CakePHP Questions site http://ask.cakephp.org and >>> help others with their CakePHP related questions. >>> >>> >>> To unsubscribe from this group, send email to >>> cake-php+unsubscribe@**googlegroups.comFor >>> more options, visit this group at >>> http://groups.google.com/**group/cake-php<http://groups.google.com/group/cake-php> >>> >> >> -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to build a category-subcategory menu?
Have you taken a look at http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html HTH Tarique On Mon, Jul 16, 2012 at 9:42 AM, AcidRainZ wrote: > i am facing the same problem but im using cake 2.x > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/How-to-build-a-category-subcategory-menu-tp1271909p5709633.html > Sent from the CakePHP mailing list archive at Nabble.com. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- = PHP for E-Biz: http://sanisoft.com = -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to build a category-subcategory menu?
i am facing the same problem but im using cake 2.x -- View this message in context: http://cakephp.1045679.n5.nabble.com/How-to-build-a-category-subcategory-menu-tp1271909p5709633.html Sent from the CakePHP mailing list archive at Nabble.com. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Nested Menu in Cake 2.x
yeah but i dont have letf and right fields on my database..can you put on some links as my references? On Friday, July 13, 2012 7:54:26 PM UTC+8, MaJerle.Eu wrote: > > you can use Tree Behavior to properly nested menu items, then use > Model::find('threaded'); and you will get nested array, then just > recursively go through all array and make html output with ul and li. > > Then use css or jQuery for nice user display (Mootools, etc..) > -- > Lep pozdrav, Tilen Majerle > http://majerle.eu > > > > 2012/7/13 Ain Devonshire > >> Hi guys currently my site is only displaying menu and it submenu. How >> will i display the children of the submenu? >> >> -- >> Our newest site for the community: CakePHP Video Tutorials >> http://tv.cakephp.org >> Check out the new CakePHP Questions site http://ask.cakephp.org and help >> others with their CakePHP related questions. >> >> >> To unsubscribe from this group, send email to >> cake-php+unsubscr...@googlegroups.com For more options, visit this group >> at http://groups.google.com/group/cake-php >> > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to build a category-subcategory menu?
this code is for cake TO 1.2. This code will fail on newer versions of cake -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/7/13 Ain Devonshire > can you translate this to english?what is maak? > > > On Saturday, June 9, 2007 5:01:29 PM UTC+8, Watcher wrote: >> >> This is how I fixed this kind of thing: >> >> Model: >> class Menu extends AppModel { >> var $name = 'Menu'; >> >> // model validation >> var $validate = array( >> 'naam'**=> VALID_NOT_EMPTY, ** // >> backwards compatible >> ); >> >> function maakMenu($belongs_id = '0') { >> $menu_voor_**view = array(); >> $menuitems = $this->findAll("belongs_to = '$belongs_id'", >> '', >> 'Menu.zwaarte ASC'); >> foreach($**menuitems as $item) { >> $item = $item['Menu']; >> if ($item['url'] == '') { >> ** $submenu = >> $this->maakMenu($item['id']); >> ** $menu_voor_view[$item['naam'**]] = >> $submenu; >> } else if ($item['sub'] == '1') { >> ** $submenu = >> $this->maakMenu($item['id']); >> ** $menu_voor_view[$item['naam'**]] = >> $item['url']; >> ** $menu_voor_view[$item['naam'**].'.sub'] >> = $submenu; >> } else { >> ** $menu_voor_view[$item['naam'**]] = >> $item['url']; >> } >> } >> return $menu_voor_view; >> } >> } >> >> $menu_voor_view = array to return >> naam = link name >> submenu = int to indicate if this menu has submenu's or not, so as to >> allow a topcategory to have a url and subitems (it normally assumes >> that if no url is there, it must have a submenu) >> belongs_to = id of topcategory >> zwaarte = shows the location of a specific menu in the list of all >> >> Controller: >> class MenuController extends AppController { >> var $name = 'Menu'; >> >> function maakMenu($belongs_to = '0') { >> if (isset($this->params['**requested'])) { >> $menu = $this->Menu->maakMenu($**belongs_to); >> return $menu; >> } else { >> $this-**>redirect('/'); >> } >> } >> } >> >> this just returns the menu array made in the model (and as it is >> recursive there, it returns a complete menu array) >> >> To include a menu on a view, I created an element and that is >> rendered: >> $menu = $this->requestAction('menu/**maakMenu'); >> >> function printSubMenu($submenu, $html, $eerste) { >> print '> if ($eerste) { >> print ' id="nav"'; >> } >> print '>'; >> >> foreach($submenu as $naam => $url) { >> // checking for submenu >> if (!ereg('.*\.sub', $naam)) { >> print ''; >> if (is_array($url)) { >> ** echo $html->link($naam, '#'); >> ** printSubMenu($url, $html, false); >> } else if (isset($submenu[$naam.'.sub'])**) { >> ** echo $html->link($naam, '#'); >> ** printSubMenu($submenu[$naam.**'.sub'], >> $html, false); >> } else { >> ** echo $html->link($naam, $url); >> } >> print ''; >> } >> } >> } >> >> // $html is needed to use the $html helper functions! >> printSubMenu($menu, $html, true); >> >> -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Nested Menu in Cake 2.x
you can use Tree Behavior to properly nested menu items, then use Model::find('threaded'); and you will get nested array, then just recursively go through all array and make html output with ul and li. Then use css or jQuery for nice user display (Mootools, etc..) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/7/13 Ain Devonshire > Hi guys currently my site is only displaying menu and it submenu. How > will i display the children of the submenu? > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Nested Menu in Cake 2.x
Hi guys currently my site is only displaying menu and it submenu. How will i display the children of the submenu? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to build a category-subcategory menu?
can you translate this to english?what is maak? On Saturday, June 9, 2007 5:01:29 PM UTC+8, Watcher wrote: > > This is how I fixed this kind of thing: > > Model: > class Menu extends AppModel { > var $name = 'Menu'; > > // model validation > var $validate = array( > 'naam'=> VALID_NOT_EMPTY,// > backwards compatible > ); > > function maakMenu($belongs_id = '0') { > $menu_voor_view = array(); > $menuitems = $this->findAll("belongs_to = '$belongs_id'", > '', > 'Menu.zwaarte ASC'); > foreach($menuitems as $item) { > $item = $item['Menu']; > if ($item['url'] == '') { > $submenu = $this->maakMenu($item['id']); > $menu_voor_view[$item['naam']] = $submenu; > } else if ($item['sub'] == '1') { > $submenu = $this->maakMenu($item['id']); > $menu_voor_view[$item['naam']] = > $item['url']; > $menu_voor_view[$item['naam'].'.sub'] = > $submenu; > } else { > $menu_voor_view[$item['naam']] = > $item['url']; > } > } > return $menu_voor_view; > } > } > > $menu_voor_view = array to return > naam = link name > submenu = int to indicate if this menu has submenu's or not, so as to > allow a topcategory to have a url and subitems (it normally assumes > that if no url is there, it must have a submenu) > belongs_to = id of topcategory > zwaarte = shows the location of a specific menu in the list of all > > Controller: > class MenuController extends AppController { > var $name = 'Menu'; > > function maakMenu($belongs_to = '0') { > if (isset($this->params['requested'])) { > $menu = $this->Menu->maakMenu($belongs_to); > return $menu; > } else { > $this->redirect('/'); > } > } > } > > this just returns the menu array made in the model (and as it is > recursive there, it returns a complete menu array) > > To include a menu on a view, I created an element and that is > rendered: > $menu = $this->requestAction('menu/maakMenu'); > > function printSubMenu($submenu, $html, $eerste) { > print ' if ($eerste) { > print ' id="nav"'; > } > print '>'; > > foreach($submenu as $naam => $url) { > // checking for submenu > if (!ereg('.*\.sub', $naam)) { > print ''; > if (is_array($url)) { > echo $html->link($naam, '#'); > printSubMenu($url, $html, false); > } else if (isset($submenu[$naam.'.sub'])) { > echo $html->link($naam, '#'); > printSubMenu($submenu[$naam.'.sub'], > $html, false); > } else { > echo $html->link($naam, $url); > } > print ''; > } > } > } > > // $html is needed to use the $html helper functions! > printSubMenu($menu, $html, true); > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: cakePhp showing menu or login form
you going to show us some code to help you with, or would you prefer us to write something for you? On Thu, Jul 5, 2012 at 6:07 AM, Peter Nassef wrote: > Hello cakephp team > > i need to make website with admin panel > > but ican't do that > > i need to know who can make admin panel ?? > with session and site and make admin in split section > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: cakePhp showing menu or login form
Hello cakephp team i need to make website with admin panel but ican't do that i need to know who can make admin panel ?? with session and site and make admin in split section -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: cakePhp showing menu or login form
I would create two elements, menu.ctp and login_form.ctp, and load either based on whether the person is logged in. if ($this->Session->read('Auth.User')) { echo $this->element('menu'); } else { echo $this->element('Users/login_form'); } On Wed, Jul 4, 2012 at 3:01 PM, Chris wrote: > I am the beginer in cakePhp. I have a problem. My website has one div, and > inside of it it has to show menu or login form (depends on user login). > Where can I do it? It is repeated in all pages. I think, that I should > create this in layout, to not repeat it in every view, but really havo no > idea how.' > > Thank's for your answers! > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
cakePhp showing menu or login form
I am the beginer in cakePhp. I have a problem. My website has one div, and inside of it it has to show menu or login form (depends on user login). Where can I do it? It is repeated in all pages. I think, that I should create this in layout, to not repeat it in every view, but really havo no idea how.' Thank's for your answers! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to embebedd flash menu buttons on my site?
Seo is less of a concern with flash. If you need to Target mobile devices then requiring flash is bad. If your having issue loading xml/images/content into flash look at setting the base param with $this->Html->url('/'); - S On 14 Feb 2012 09:38, "phpMagpie" wrote: > When you say flash menu buttons, do you mean Adobe Flash or really flashy > graphical buttons? > > If they are Adobe Flash I would consider if using them at all is a good > idea. There is a very really chance that the links within Adobe Flash > buttons may not be indexable (search engines will not be able to follow > them), accessible (less abled people will have trouble using your menu) and > will not work on iOS (apple do not allow flash on their devices). > > HTH, Paul. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to embebedd flash menu buttons on my site?
When you say flash menu buttons, do you mean Adobe Flash or really flashy graphical buttons? If they are Adobe Flash I would consider if using them at all is a good idea. There is a very really chance that the links within Adobe Flash buttons may not be indexable (search engines will not be able to follow them), accessible (less abled people will have trouble using your menu) and will not work on iOS (apple do not allow flash on their devices). HTH, Paul. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to embebedd flash menu buttons on my site?
Once you understand how to src files in webroot all you need to is place the file and ref with you object/embed mark up. Use firebug or such to check that files are found. Unless your using cake internal routing webroot/ should not be part of the url. - S On 12 Feb 2012 21:52, "Devis" wrote: > I own a website based on phpcake. > I bought even a flash buttons menu for my site, but i dont know how to > replace these buttons with the default one. > I tried to read but i am confused. > Someone can help me with this problem? > Thanks in advance to everyone. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How to embebedd flash menu buttons on my site?
I own a website based on phpcake. I bought even a flash buttons menu for my site, but i dont know how to replace these buttons with the default one. I tried to read but i am confused. Someone can help me with this problem? Thanks in advance to everyone. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Menu helper indicating active item and parents?
On Dec 12, 11:47 am, Lucky1968 wrote: > Is there anyone who can give me advise on which menu helper to use in > this case? > > I need to generate an nested tree menu which indicates (adds > class="active") the current li AND all of its parents. > > I tried to do this with > > http://bakery.cakephp.org/articles/AD7six/2008/01/24/tree-helper-1 > > but when adding > > if (some logic) { > > $tree->addItemAttribute('class', 'active'); > > } > > as described in the documentation it seem to add it only to the first > li and not to another one. That's how that's designed to work > > I'm thinking of implementing > > https://github.com/AD7six/mi/blob/master/views/helpers/menu.php > > but because of the lack of documentation it's not clear to me: how to > implement this, if it's necessary to use the whole 'mi'-plugin, and if > it can do what I need? after reading the doc blocs and test case - can you please clarify what documentation you are expecting that you can't find? What have you tried and what happened? Alternatively you may find it's easier to just write your own loop. AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Menu helper indicating active item and parents?
Is there anyone who can give me advise on which menu helper to use in this case? I need to generate an nested tree menu which indicates (adds class="active") the current li AND all of its parents. I tried to do this with http://bakery.cakephp.org/articles/AD7six/2008/01/24/tree-helper-1 but when adding if (some logic) { $tree->addItemAttribute('class', 'active'); } as described in the documentation it seem to add it only to the first li and not to another one. I'm thinking of implementing https://github.com/AD7six/mi/blob/master/views/helpers/menu.php but because of the lack of documentation it's not clear to me: how to implement this, if it's necessary to use the whole 'mi'-plugin, and if it can do what I need? Does anyone have some experience on this who could help me out? Regards, Lucky1968 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Best practice output a Dynamic menu
you can define a protected variable $showMenu = true in AppController, and for those controllers who don't need menu, set this vairable to false and in beforeRender method check this variable to output or not. On Mon, Dec 12, 2011 at 7:08 PM, MetZ wrote: > ;) > > That was what I thought about helpers yes.. > > Helper => will be used to generate the menu > > You would suggest to pull the menu + links fra database in > app_controller beforerender, might work fine not using component for > this. > > As I do not need to get the menues on every page, how would you > suggest to only use the menu database retrival when needed? > > using if this params controller= controller ? or something like that? > or do you know of a better way ? > > Thanks for all help and suggestions this far! > > -Tom > > > On 12 Des, 07:17, Perry wrote: > > helpers should not get data directly, and I remember cakephp doesn't > > suggest get data in components neither( i cant' find the refer), why not > > get menu data in AppController's beforeRender method? > > > > > > > > > > > > > > > > > > > > On Sun, Dec 11, 2011 at 8:16 PM, MetZ wrote: > > > > > Hi. > > > > > I am storing my menues and links(tree behavior) in database. I am > > > using several themes for the system, and hardcoding menues manuallly > > > foreach theme is not an option. > > > > > I have no problem outputting the menues and links with a component and > > > helper in my themes, but i am simply wodering about the best practice > > > to do this? > > > > > Example, get menues and links from db in component, generate menu > > > output with helper. > > > > > Or should i do all this in the helper? > > > > > Thanks! > > > > > tom > > > > > On Dec 8, 11:42 pm, Perry wrote: > > > > why consider components and helpers? > > > > > > do you store your menu structures in database? why not just treat it > as a > > > > data and output it directly in layout? > > > > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ wrote: > > > > > Hi all! > > > > > > > I am looking for a couple of suggestions. > > > > > > > I am currently working on a tree menu part of my app, where > > > > > administrators can create menues, add links to the menues and move > the > > > > > links up and down in the tree. > > > > > > > Now, I am looking how to output this menu with links on the > frontend. > > > > > > > Any suggestions on how I should proceed in this? > > > > > > > Currently, I am getting my menues and links in a component, I am > > > > > initializing the "getmenues" function in component from > > > > > app_controller.php. > > > > > > > And in my views, I call a helper to build the menu ul li li /ul > > > > > > > Do I need to use a component for this task? Or can I just include > > > > > everything in the helper? the database calls I mean? > > > > > > > I have noe experience with helpers and components from before, so > > > > > please be gentle with me ;) > > > > > > > Thanks for any and all help on this issue!! > > > > > > > BTW: Cake 1.3.13 > > > > > > > -Tom > > > > > > > -- > > > > > Our newest site for the community: CakePHP Video Tutorials > > > > >http://tv.cakephp.org > > > > > Check out the new CakePHP Questions > sitehttp://ask.cakephp.organdhelp > > > > > others with their CakePHP related questions. > > > > > > > To unsubscribe from this group, send email to > > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this > > > group > > > > > athttp://groups.google.com/group/cake-php > > > > > > -- > > > > Perry | 彭琪http://pengqi.me > > > > > -- > > > Our newest site for the community: CakePHP Video Tutorials > > >http://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > cake-php+unsubscr...@googlegroups.com For more options, visit this > group > > > athttp://groups.google.com/group/cake-php > > > > -- > > Perry | 彭琪http://pengqi.me > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Perry | 彭琪 http://pengqi.me -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Best practice output a Dynamic menu
such components may get their data automatically that's what some are for, after all :) even a helper may use data passed down form the controller/component automatically. at least in 2.0 - with $_View being officially available now. On 12 Dez., 12:08, MetZ wrote: > ;) > > That was what I thought about helpers yes.. > > Helper => will be used to generate the menu > > You would suggest to pull the menu + links fra database in > app_controller beforerender, might work fine not using component for > this. > > As I do not need to get the menues on every page, how would you > suggest to only use the menu database retrival when needed? > > using if this params controller= controller ? or something like that? > or do you know of a better way ? > > Thanks for all help and suggestions this far! > > -Tom > > On 12 Des, 07:17, Perry wrote: > > > > > > > > > helpers should not get data directly, and I remember cakephp doesn't > > suggest get data in components neither( i cant' find the refer), why not > > get menu data in AppController's beforeRender method? > > > On Sun, Dec 11, 2011 at 8:16 PM, MetZ wrote: > > > > Hi. > > > > I am storing my menues and links(tree behavior) in database. I am > > > using several themes for the system, and hardcoding menues manuallly > > > foreach theme is not an option. > > > > I have no problem outputting the menues and links with a component and > > > helper in my themes, but i am simply wodering about the best practice > > > to do this? > > > > Example, get menues and links from db in component, generate menu > > > output with helper. > > > > Or should i do all this in the helper? > > > > Thanks! > > > > tom > > > > On Dec 8, 11:42 pm, Perry wrote: > > > > why consider components and helpers? > > > > > do you store your menu structures in database? why not just treat it as > > > > a > > > > data and output it directly in layout? > > > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ wrote: > > > > > Hi all! > > > > > > I am looking for a couple of suggestions. > > > > > > I am currently working on a tree menu part of my app, where > > > > > administrators can create menues, add links to the menues and move the > > > > > links up and down in the tree. > > > > > > Now, I am looking how to output this menu with links on the frontend. > > > > > > Any suggestions on how I should proceed in this? > > > > > > Currently, I am getting my menues and links in a component, I am > > > > > initializing the "getmenues" function in component from > > > > > app_controller.php. > > > > > > And in my views, I call a helper to build the menu ul li li /ul > > > > > > Do I need to use a component for this task? Or can I just include > > > > > everything in the helper? the database calls I mean? > > > > > > I have noe experience with helpers and components from before, so > > > > > please be gentle with me ;) > > > > > > Thanks for any and all help on this issue!! > > > > > > BTW: Cake 1.3.13 > > > > > > -Tom > > > > > > -- > > > > > Our newest site for the community: CakePHP Video Tutorials > > > > >http://tv.cakephp.org > > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > > > others with their CakePHP related questions. > > > > > > To unsubscribe from this group, send email to > > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this > > > group > > > > > athttp://groups.google.com/group/cake-php > > > > > -- > > > > Perry | 彭琪http://pengqi.me > > > > -- > > > Our newest site for the community: CakePHP Video Tutorials > > >http://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > others with their CakePHP related questions. > > > > To unsubscribe from this group, send email to > > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > > athttp://groups.google.com/group/cake-php > > > -- > > Perry | 彭琪http://pengqi.me -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Best practice output a Dynamic menu
;) That was what I thought about helpers yes.. Helper => will be used to generate the menu You would suggest to pull the menu + links fra database in app_controller beforerender, might work fine not using component for this. As I do not need to get the menues on every page, how would you suggest to only use the menu database retrival when needed? using if this params controller= controller ? or something like that? or do you know of a better way ? Thanks for all help and suggestions this far! -Tom On 12 Des, 07:17, Perry wrote: > helpers should not get data directly, and I remember cakephp doesn't > suggest get data in components neither( i cant' find the refer), why not > get menu data in AppController's beforeRender method? > > > > > > > > > > On Sun, Dec 11, 2011 at 8:16 PM, MetZ wrote: > > > Hi. > > > I am storing my menues and links(tree behavior) in database. I am > > using several themes for the system, and hardcoding menues manuallly > > foreach theme is not an option. > > > I have no problem outputting the menues and links with a component and > > helper in my themes, but i am simply wodering about the best practice > > to do this? > > > Example, get menues and links from db in component, generate menu > > output with helper. > > > Or should i do all this in the helper? > > > Thanks! > > > tom > > > On Dec 8, 11:42 pm, Perry wrote: > > > why consider components and helpers? > > > > do you store your menu structures in database? why not just treat it as a > > > data and output it directly in layout? > > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ wrote: > > > > Hi all! > > > > > I am looking for a couple of suggestions. > > > > > I am currently working on a tree menu part of my app, where > > > > administrators can create menues, add links to the menues and move the > > > > links up and down in the tree. > > > > > Now, I am looking how to output this menu with links on the frontend. > > > > > Any suggestions on how I should proceed in this? > > > > > Currently, I am getting my menues and links in a component, I am > > > > initializing the "getmenues" function in component from > > > > app_controller.php. > > > > > And in my views, I call a helper to build the menu ul li li /ul > > > > > Do I need to use a component for this task? Or can I just include > > > > everything in the helper? the database calls I mean? > > > > > I have noe experience with helpers and components from before, so > > > > please be gentle with me ;) > > > > > Thanks for any and all help on this issue!! > > > > > BTW: Cake 1.3.13 > > > > > -Tom > > > > > -- > > > > Our newest site for the community: CakePHP Video Tutorials > > > >http://tv.cakephp.org > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this > > group > > > > athttp://groups.google.com/group/cake-php > > > > -- > > > Perry | 彭琪http://pengqi.me > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php > > -- > Perry | 彭琪http://pengqi.me -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Best practice output a Dynamic menu
helpers should not get data directly, and I remember cakephp doesn't suggest get data in components neither( i cant' find the refer), why not get menu data in AppController's beforeRender method? On Sun, Dec 11, 2011 at 8:16 PM, MetZ wrote: > > Hi. > > I am storing my menues and links(tree behavior) in database. I am > using several themes for the system, and hardcoding menues manuallly > foreach theme is not an option. > > I have no problem outputting the menues and links with a component and > helper in my themes, but i am simply wodering about the best practice > to do this? > > Example, get menues and links from db in component, generate menu > output with helper. > > Or should i do all this in the helper? > > Thanks! > > tom > > On Dec 8, 11:42 pm, Perry wrote: > > why consider components and helpers? > > > > do you store your menu structures in database? why not just treat it as a > > data and output it directly in layout? > > > > > > > > > > > > > > > > > > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ wrote: > > > Hi all! > > > > > I am looking for a couple of suggestions. > > > > > I am currently working on a tree menu part of my app, where > > > administrators can create menues, add links to the menues and move the > > > links up and down in the tree. > > > > > Now, I am looking how to output this menu with links on the frontend. > > > > > Any suggestions on how I should proceed in this? > > > > > Currently, I am getting my menues and links in a component, I am > > > initializing the "getmenues" function in component from > > > app_controller.php. > > > > > And in my views, I call a helper to build the menu ul li li /ul > > > > > Do I need to use a component for this task? Or can I just include > > > everything in the helper? the database calls I mean? > > > > > I have noe experience with helpers and components from before, so > > > please be gentle with me ;) > > > > > Thanks for any and all help on this issue!! > > > > > BTW: Cake 1.3.13 > > > > > -Tom > > > > > -- > > > Our newest site for the community: CakePHP Video Tutorials > > >http://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > cake-php+unsubscr...@googlegroups.com For more options, visit this > group > > > athttp://groups.google.com/group/cake-php > > > > -- > > Perry | 彭琪http://pengqi.me > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Perry | 彭琪 http://pengqi.me -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Best practice output a Dynamic menu
Hi. I am storing my menues and links(tree behavior) in database. I am using several themes for the system, and hardcoding menues manuallly foreach theme is not an option. I have no problem outputting the menues and links with a component and helper in my themes, but i am simply wodering about the best practice to do this? Example, get menues and links from db in component, generate menu output with helper. Or should i do all this in the helper? Thanks! tom On Dec 8, 11:42 pm, Perry wrote: > why consider components and helpers? > > do you store your menu structures in database? why not just treat it as a > data and output it directly in layout? > > > > > > > > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ wrote: > > Hi all! > > > I am looking for a couple of suggestions. > > > I am currently working on a tree menu part of my app, where > > administrators can create menues, add links to the menues and move the > > links up and down in the tree. > > > Now, I am looking how to output this menu with links on the frontend. > > > Any suggestions on how I should proceed in this? > > > Currently, I am getting my menues and links in a component, I am > > initializing the "getmenues" function in component from > > app_controller.php. > > > And in my views, I call a helper to build the menu ul li li /ul > > > Do I need to use a component for this task? Or can I just include > > everything in the helper? the database calls I mean? > > > I have noe experience with helpers and components from before, so > > please be gentle with me ;) > > > Thanks for any and all help on this issue!! > > > BTW: Cake 1.3.13 > > > -Tom > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php > > -- > Perry | 彭琪http://pengqi.me -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Best practice output a Dynamic menu
why consider components and helpers? do you store your menu structures in database? why not just treat it as a data and output it directly in layout? On Fri, Dec 9, 2011 at 9:31 AM, MetZ wrote: > Hi all! > > I am looking for a couple of suggestions. > > I am currently working on a tree menu part of my app, where > administrators can create menues, add links to the menues and move the > links up and down in the tree. > > Now, I am looking how to output this menu with links on the frontend. > > Any suggestions on how I should proceed in this? > > Currently, I am getting my menues and links in a component, I am > initializing the "getmenues" function in component from > app_controller.php. > > And in my views, I call a helper to build the menu ul li li /ul > > Do I need to use a component for this task? Or can I just include > everything in the helper? the database calls I mean? > > I have noe experience with helpers and components from before, so > please be gentle with me ;) > > Thanks for any and all help on this issue!! > > BTW: Cake 1.3.13 > > -Tom > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Perry | 彭琪 http://pengqi.me -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Best practice output a Dynamic menu
Hi all! I am looking for a couple of suggestions. I am currently working on a tree menu part of my app, where administrators can create menues, add links to the menues and move the links up and down in the tree. Now, I am looking how to output this menu with links on the frontend. Any suggestions on how I should proceed in this? Currently, I am getting my menues and links in a component, I am initializing the "getmenues" function in component from app_controller.php. And in my views, I call a helper to build the menu ul li li /ul Do I need to use a component for this task? Or can I just include everything in the helper? the database calls I mean? I have noe experience with helpers and components from before, so please be gentle with me ;) Thanks for any and all help on this issue!! BTW: Cake 1.3.13 -Tom -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: how to use this Menu Helper
http://www.flipflops.org) * @package app * @subpackage app.views.helpers * @version 1.0 * @lastmodified 2009-09-29 * * This helper is designed to work with the data arrays returned by the Tree behaviour or $model->find('threaded'); * More specifically it is designed to generate menus composed of nested ULs for use in CMS systems where all the URLs are pretty: * - naviagtion menus (usually at the top of the page) * - context menus (usually found at the side) and showing the links in the current branch * - sitemaps * * Overview (A bit of history) * * The helper is designed to deal with navigation / page structures organised in simple /parent/child/grand-child like structures * for instance: * * /home * /about * /about/company-history * /about/company-history/gallery * /about/ethos * /about/vacancies * /news * /news/2009/jan * /news/2009/feb * /news/2009/mar * /contact * (etc.) * * --- * URLs are generated in the model or controller not in the view / helper * --- * In the system from which this is taken, I create a full slug for each page on $model->save(); * Some of the pages are actual pages of text and others are palceholders for content in other models * but they allow you do things like control the content of left / right columns, set default meta tags etc. * The purpose being to create really easy site structures with nice urls, the * In the example above /home, /about etc. are all from a single model 'Article' which is my master model * /news however is a placeholder for the 'News' model and /contact for the 'Contact' model * * * * Required Fields * -- * title / name (defaults to 'title') * page url (defaults to 'slug_url' e.g. /about/ethos) * * Optional Fields * -- * title_for_navigation * redirect_url * redirect_target * * Example data * -- * [Article] => Array ( [name] => Find out about us [slug_url] => /about-us [title_for_navigation] => About Us [redirect_url] => [redirect_target] => [lft] => 15 [id] => 105 [rght] => 24 [parent_id] => ) [children] => Array ( [0] => Array ( [Article] => Array ( [name] => Philosophy [slug_url] => /about-us/philosophy [title_for_navigation] => [redirect_url] => [redirect_target] => [lft] => 16 [id] => 111 [rght] => 21 [parent_id] => 105 ) * * * * * Usage: * * Include the helper in your controller as usual. * * The helper operates in 2 modes 'tree' (which is default) and 'context' * 'tree' will produce a whole list of nested Uls - can be used to generate top level navigation (works well with things like suckerfish) * 'context' will only produce nested ULs for the current branch * * Using the example above if you were on the /about/ethos page and you wanted the navigation fragment in the sidebar you would use context * /about * /about/company-history * /about/company-history/gallery * /about/ethos * /about/vacancies * * In a view / element to generate complete menu * echo $menu->setup($menu_data, array('selected' => $this->here)); * * In a view / element to generate a context menu from the same data, set the class of the parent UL * echo $menu->setup($menu_data, array('selected' => $this->here, 'type' => 'context', 'menuClass' => 'context-menu')); * * * In a view / element to generate a sitemap from different data, let the helper know to use the 'Sitemap' model rather than the default 'Article' model and set the parent UL class. * $sitemap = new MenuHelper(); * echo $sitemap->setup($data, array('modelName' => 'Sitemap', 'menuClass' => 'sitemap')); * * Version Details * * 1.0 * + Initial release. */ class MenuHelper extends AppHelper { /** * Current page in application * * @var string */ private $selected = ''; /** Internal variable for the data * * @var array */ private
how to use this Menu Helper
http://www.flipflops.org/2009/09/29/cakephp-menu-helper-for-tree-data/ i read this helper but cant understand how to use this helper...any one help me please,,it is useful helper -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: how to use tree behavior to build multilevel menu category
in index method use $this->Category->find('threaded'); instead of $this->Category->generatetreelist(); what you will get returned look here: http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#find-threaded Then you need recursively check every category if has any children and display it :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/12/3 ahmed fakher > i want to build nav menu from main and subcategory,,i tried more > things and choose tree behavior,,the problem is how to use The > extracted data to build dropdown menu like this > > categories/index.ctp > > // this code for extract main and sub category from tree behavior > echo $html->link("Add Category",array('action'=>'add')); > echo ""; > foreach($categories as $key=>$value){ > > echo "$value "; > } > echo ""; > ?> > /// i want to extract tree data like this code > > > >Home > >// the main category >Products > > // the sub category >New >Used >Featured >Top Rated > > > > > > > categories_controller.php > > class CategoriesController extends AppController { > var $name = 'Categories'; > function index() { > $categories = $this->Category->generatetreelist(null, null, null, > ' '); > // debug ($this->data); die; > $this->set(compact('categories')); > > } > > function add() { > > if (!empty($this -> data) ) { > $this->Category->save($this -> data); > $this->Session->setFlash('A new category has been added'); > $this->redirect(array('action' => 'index')); > } else { > $parents[0] = "[ Top ]"; > $categories = $this->Category->generatetreelist(null,null,null," - > "); > if($categories) { > foreach ($categories as $key=>$value) > $parents[$key] = $value; > } > $this->set(compact('parents')); > } > > } > > function edit($id=null) { > if (!empty($this->data)) { > if($this->Category->save($this->data)==false) > $this->Session->setFlash('Error saving Category.'); > $this->redirect(array('action'=>'index')); > } else { > if($id==null) die("No ID received"); > $this->data = $this->Category->read(null, $id); > $parents[0] = "[ Top ]"; > $categories = $this->Category->generatetreelist(null,null,null," - > "); > if($categories) > foreach ($categories as $key=>$value) > $parents[$key] = $value; > $this->set(compact('parents')); > } > } > function delete($id=null) { > if($id==null) > die("No ID received"); > $this->Category->id=$id; > if($this->Category->removeFromTree($id,true)==false) > $this->Session->setFlash('The Category could not be deleted.'); > $this->Session->setFlash('Category has been deleted.'); > $this->redirect(array('action'=>'index')); > } > > > } > ?> > > database table > > -- Table structure for table `categories` > -- > > CREATE TABLE IF NOT EXISTS `categories` ( > `id` int(10) unsigned NOT NULL AUTO_INCREMENT, > `parent_id` int(10) DEFAULT NULL, > `lft` int(10) DEFAULT NULL, > `rght` int(10) DEFAULT NULL, > `name` varchar(255) DEFAULT '', > PRIMARY KEY (`id`) > ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; > > -- > -- Dumping data for table `categories` > -- > > INSERT INTO `categories` (`id`, `parent_id`, `lft`, `rght`, `name`) > VALUES > (1, NULL, 1, 14, 'Tutorials'), > (2, 1, 2, 7, 'PHP'), > (3, 1, 8, 13, 'MySQL'), > (4, 2, 3, 4, 'CakePHP'), > (5, 2, 5, 6, 'cake'), > (6, 3, 9, 10, 'phpmyadmin'), > (7, 3, 11, 12, 'sql'); > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
how to use tree behavior to build multilevel menu category
i want to build nav menu from main and subcategory,,i tried more things and choose tree behavior,,the problem is how to use The extracted data to build dropdown menu like this categories/index.ctp link("Add Category",array('action'=>'add')); echo ""; foreach($categories as $key=>$value){ echo "$value "; } echo ""; ?> /// i want to extract tree data like this code Home // the main category Products // the sub category New Used Featured Top Rated categories_controller.php Category->generatetreelist(null, null, null, ' '); // debug ($this->data); die; $this->set(compact('categories')); } function add() { if (!empty($this -> data) ) { $this->Category->save($this -> data); $this->Session->setFlash('A new category has been added'); $this->redirect(array('action' => 'index')); } else { $parents[0] = "[ Top ]"; $categories = $this->Category->generatetreelist(null,null,null," - "); if($categories) { foreach ($categories as $key=>$value) $parents[$key] = $value; } $this->set(compact('parents')); } } function edit($id=null) { if (!empty($this->data)) { if($this->Category->save($this->data)==false) $this->Session->setFlash('Error saving Category.'); $this->redirect(array('action'=>'index')); } else { if($id==null) die("No ID received"); $this->data = $this->Category->read(null, $id); $parents[0] = "[ Top ]"; $categories = $this->Category->generatetreelist(null,null,null," - "); if($categories) foreach ($categories as $key=>$value) $parents[$key] = $value; $this->set(compact('parents')); } } function delete($id=null) { if($id==null) die("No ID received"); $this->Category->id=$id; if($this->Category->removeFromTree($id,true)==false) $this->Session->setFlash('The Category could not be deleted.'); $this->Session->setFlash('Category has been deleted.'); $this->redirect(array('action'=>'index')); } } ?> database table -- Table structure for table `categories` -- CREATE TABLE IF NOT EXISTS `categories` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `parent_id` int(10) DEFAULT NULL, `lft` int(10) DEFAULT NULL, `rght` int(10) DEFAULT NULL, `name` varchar(255) DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; -- -- Dumping data for table `categories` -- INSERT INTO `categories` (`id`, `parent_id`, `lft`, `rght`, `name`) VALUES (1, NULL, 1, 14, 'Tutorials'), (2, 1, 2, 7, 'PHP'), (3, 1, 8, 13, 'MySQL'), (4, 2, 3, 4, 'CakePHP'), (5, 2, 5, 6, 'cake'), (6, 3, 9, 10, 'phpmyadmin'), (7, 3, 11, 12, 'sql'); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
menu Model
hi guys,... can some one tell me whats wrong whit this...? this is a Model Menu that I use for version 1.2.0 and it works perfect. but now I need to upgrade to 1.2.8 or higher and this model seems to me is not responding... thanks url = $url; $this->name = $name; $this->style = $style; } function parse($html, $current_url) { if($html->url($this->url) == $current_url) $this->style['class'] = array_key_exists('class', $this- >style) ? $this->style['class'] . ' current' : 'current'; return '' . $html->link($this->name, $this->url, $this->style, false, false) . ''; } } class Menu { var $id = false; var $links = array(); var $selected = false; function Menu($id) { $this->id = $id; } function setSelected($selected) { $this->selected = $selected; } function addLink($url, $name, $style = array()) { $this->links[] = new Link($url, $name, $style); } function parse($html) { $output = ''; if(!empty($this->links)) { $current_url = $this->selected ? $html->url($this->selected) : $html->url(); $output = ''; foreach($this->links as $link) $output .= $link->parse($html, $current_url); $output .= ''; } return $output; } } ?> -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
database design help - menu, menu items and controllers within
Hello, I am having some issues setting up the database for my base CMS to use for all clients. My thoughts were to have the following: blocks table - this is simply the html, title, description etc for each page (i.e. home, about us) menus table - simply contains the menu name (i.e. top navigation or footer links etc) menu_items table - this would contain the menu_id, the parent_id (from this same table), the title of the link in the menu and then there would be a controller field which would contain the name of the controller i.e. blocks and then the next field to contain the actual block id such as the home id for the link. This is how I can see that I can easily add additional controllers such as galleries, pdfs, blogs etc and they could be within the menus quite easily by adding in contoller => pdfs, controller_id => 3 (the pdf id or whatever) Below is the SQL I have come up with, I wanted to get some advise to see if there was an easy way or better way to do this. Ideally I want to be able to generate the list of controllers on the add/edit field and then their assigning ids when adding menu_items. Thankyou CREATE TABLE IF NOT EXISTS `blocks` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(150) NOT NULL, `title` varchar(150) DEFAULT NULL, `show_title` tinyint(1) DEFAULT '1', `content` longtext, `metadescription` text, `metakeywords` text, `stepback` longtext, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; # Data exporting was unselected. # Dumping structure for table siteadmin.menus CREATE TABLE IF NOT EXISTS `menus` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; # Data exporting was unselected. # Dumping structure for table siteadmin.menu_items CREATE TABLE IF NOT EXISTS `menu_items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `menu_id` int(11) DEFAULT NULL, `parent_id` int(11) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `controller` varchar(255) DEFAULT NULL, `controller_id` int(11) DEFAULT NULL, `published` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; == -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Administrator Menu with ACL
Thank you majna. I just try to use it on cakephp 1.38 but it is very very slow, it do 19.000 query at time and the variable $menu is empty to the end of the process. In addition I don't undestand well how can I use it. Thank you On May 16, 6:17 pm, majna wrote: > https://github.com/markstory/cakephp_menu_component > > On May 16, 11:57 am, Carachi wrote: > > > > > > > > > Hello, > > I want to ask if someone know a package to create a dynamic > > administrator menu based on ACL settings. > > So if a user login as administrator, he can see all function in his > > menu; if he isn't the administrator, he can see only the allow > > function for his group. > > > Thank you very much > > Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Administrator Menu with ACL
https://github.com/markstory/cakephp_menu_component On May 16, 11:57 am, Carachi wrote: > Hello, > I want to ask if someone know a package to create a dynamic > administrator menu based on ACL settings. > So if a user login as administrator, he can see all function in his > menu; if he isn't the administrator, he can see only the allow > function for his group. > > Thank you very much > Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Administrator Menu with ACL
Hello, I want to ask if someone know a package to create a dynamic administrator menu based on ACL settings. So if a user login as administrator, he can see all function in his menu; if he isn't the administrator, he can see only the allow function for his group. Thank you very much Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How can I customise sorting order for dropdown field (menu) for foreign-key values
Thanks Jeremy, you've saved my time! I didn't know it was that simple. On May 13, 4:05 pm, Jeremy Burns | Class Outfit wrote: > In you Region model: > > var $order = 'name'; > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 13 May 2011, at 15:03, mthabisi mlunjwa wrote: > > > > > > > > > My add view looks like this: > > > > echo $form->create('Practice'); > > echo $form->input('region_id'); > > echo $form->input('name'); > > echo $form->end('save Practise'); > > ?> > > > region table has the following columns: > > ->id(primary key) > > ->region > > > practice table has the following columns: > > ->id > > ->region_id > > ->name > > > the region_id dropdown menu displays a menu list of all the regions in > > the database. They are automatically sorted using the region > > id(primary key) field. > > > How can I change it so that it sorts by region instead of id? > > > Please help. Thanks in advance. > > > -- > > Our newest site for the community: CakePHP Video > > Tutorialshttp://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How can I customise sorting order for dropdown field (menu) for foreign-key values
In you Region model: var $order = 'name'; Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 13 May 2011, at 15:03, mthabisi mlunjwa wrote: > My add view looks like this: > > echo $form->create('Practice'); > echo $form->input('region_id'); > echo $form->input('name'); > echo $form->end('save Practise'); > ?> > > region table has the following columns: > ->id(primary key) > ->region > > practice table has the following columns: > ->id > ->region_id > ->name > > the region_id dropdown menu displays a menu list of all the regions in > the database. They are automatically sorted using the region > id(primary key) field. > > How can I change it so that it sorts by region instead of id? > > Please help. Thanks in advance. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How can I customise sorting order for dropdown field (menu) for foreign-key values
My add view looks like this: create('Practice'); echo $form->input('region_id'); echo $form->input('name'); echo $form->end('save Practise'); ?> region table has the following columns: ->id(primary key) ->region practice table has the following columns: ->id ->region_id ->name the region_id dropdown menu displays a menu list of all the regions in the database. They are automatically sorted using the region id(primary key) field. How can I change it so that it sorts by region instead of id? Please help. Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How build a menu?
Hi, I want build a dynamic menu for my website. Can you say me how can I do? There is some tutorial about that? Thank you Bye -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Select menu population based on previous selection
Hi, Did you consider using page reloads? Everybody seems to take the - painful - ajax route, but you might not need to do that. This means that every time you enter a value in a select box you submit the page and the next select box is filled using a simple find. As soon as you submit all fields you can start processing the data. Regards, Maurits On 02/07/2011 08:41 PM, OldWest wrote: I am currently trying to work out populating select boxes based on the previous select box. For example, if I am adding a new Item and select a Product (within the item/add.ctp), and that specific product hasMany Category, I want the categories that product is associated with to populate in the category select box, so I don't need to sift through all unrelated categories. Can anyone give me some advice on the best route for this or guide me to a tutorial? Thanks : ) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Select menu population based on previous selection
In CakePHP 1.2 I use $ajax->observeField() to call an ajax function in my controller which then updates a div in the view with the next select box. I'm not sure if this is supported the same way in 1.3, so I found this: http://bakery.cakephp.org/articles/Calderoy/2011/01/18/how_to_create_an_observefield_equivalent_in_the_new_jshelper On 7 February 2011 19:41, OldWest wrote: > I am currently trying to work out populating select boxes based on the > previous select box. For example, if I am adding a new Item and select a > Product (within the item/add.ctp), and that specific product hasMany > Category, I want the categories that product is associated with to populate > in the category select box, so I don't need to sift through all unrelated > categories. > > Can anyone give me some advice on the best route for this or guide me to a > tutorial? Thanks : ) > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Select menu population based on previous selection
I am currently trying to work out populating select boxes based on the previous select box. For example, if I am adding a new Item and select a Product (within the item/add.ctp), and that specific product hasMany Category, I want the categories that product is associated with to populate in the category select box, so I don't need to sift through all unrelated categories. Can anyone give me some advice on the best route for this or guide me to a tutorial? Thanks : ) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Drop down menu not retrieving last inserted element in IE
On Wed, Nov 24, 2010 at 1:31 AM, Master Ram...! wrote: > > Yes. recently-added record? is not fetching to menu. > > how to salve this problem. You have to tell IE not to cache your page by setting some headers. Search for "IE cache +header" or similar. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Drop down menu not retrieving last inserted element in IE
Yes. recently-added record? is not fetching to menu. how to salve this problem. On Wed, Nov 24, 2010 at 12:27 AM, cricket wrote: > On Tue, Nov 23, 2010 at 6:10 AM, Master Ram wrote: > > Hi.. all > > > > I have problem with IE drop down menu. > > > > i have inserted one element its stored in the DB. i am fetching that > > field in the drop down menu. but the last > > > > inserted element is not retrieving in the drop down menu. In IE. but > > its working in Firefox. > > Seems like a browser problem, then, and nothing to do with Cake. Do > you see it when you view source? > > By "last element" do you mean a recently-added record? Could the page > simply be cached? > > 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+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Master Ram. Founder n Director of rgPlanets Pvt. Ltd. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Drop down menu not retrieving last inserted element in IE
Internet Explorer is known to be very buggy in such things. Can you post the HTML source code? On Tue, Nov 23, 2010 at 7:57 PM, cricket wrote: > On Tue, Nov 23, 2010 at 6:10 AM, Master Ram wrote: >> Hi.. all >> >> I have problem with IE drop down menu. >> >> i have inserted one element its stored in the DB. i am fetching that >> field in the drop down menu. but the last >> >> inserted element is not retrieving in the drop down menu. In IE. but >> its working in Firefox. > > Seems like a browser problem, then, and nothing to do with Cake. Do > you see it when you view source? > > By "last element" do you mean a recently-added record? Could the page > simply be cached? > > 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+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Drop down menu not retrieving last inserted element in IE
On Tue, Nov 23, 2010 at 6:10 AM, Master Ram wrote: > Hi.. all > > I have problem with IE drop down menu. > > i have inserted one element its stored in the DB. i am fetching that > field in the drop down menu. but the last > > inserted element is not retrieving in the drop down menu. In IE. but > its working in Firefox. Seems like a browser problem, then, and nothing to do with Cake. Do you see it when you view source? By "last element" do you mean a recently-added record? Could the page simply be cached? 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en