3.0 - setting data from models to the view

2014-02-26 Thread Thomas von Hassel
In 2.x when you have an array from a model query, you just set that to the 
view, and work from there.

What is best practice in 3.x ? Just set the array of model objects directly 
to the view or ... ?

/thomas

-- 
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

2014-02-26 Thread Sam Clauw
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

2014-02-26 Thread Thomas von Hassel
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 i...@bellewaerdefun.be 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

2014-02-26 Thread euromark
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.


How to configure file router with array url

2014-02-26 Thread Nguyễn Cường
I have one form with content as follows
?php
echo $this-Form-create('Post',array('url'='/Posts/result'));
...
echo $this-Form-end(__('Submit'));
?
I to run the application on localhost.
I want path after updated takes the form : 
 localhost/project/bai-viet/ket-qua
What can I do ?
Thank you to all !

-- 
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.


Question about cakephp forms and JS

2014-02-26 Thread Thomas Goeminne
Hi,

I am trying to make a form which collects data on submit. Maybe someone can 
help me.

I have a  canvas id=canvas

Then I have a form:

?php
echo $this-Form-create('Drawing');
echo $this-Form-input('id');
echo $this-Form-input('name');
echo $this-Form-input('description');
echo $this-Form-input('canvas');
echo $this-Form-end(__('Submit'));
?

When the user clicks submit, I want the page to collect the canvas data, 
and send it along with the rest of the post data.

How would I do this?

var canvas = document.getElementById('canvas');
var dataURL = canvas.toDataURL();

Also after submit I would like to store it. Normally I use the upload 
plugin from Jose gonzalez, but not sure if it can handle the raw data. So 
maybe I need save it first to the server. This will not be a problem. The 
main problem is how I can get the dataURL into the forms canvas. 

Greets,
Thomas


-- 
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.