I will try to help with the view issue.
First look at the 2.x View Template section 
http://book.cakephp.org/2.0/en/views.html
And look into Extending Views.   This will allow you to break up the 
view.  You create a frame work for a controller, then the view can have 
different content in the main section depending on the function.

I would then look at each of these areas that slide in and out might be 
a good fit for an Element. (see same doc page).
You can pass parameters to them to customize them.  I use elements for 
addresses.  I have shipping, billing & other address. It formats the 
address. I pass a title to element to be displayed by element.

you can use the requestAction function in the Elements to get data from 
another controller function. See sample code in same documentation page 
under elements.

This way you have a few main functions and views to go with them. Then 
you have the elements, that may use other functions in the controller or 
possibly other controllers, to get data.  You could do this for a 
dashboard, or to fill these  slide outs that you describe.

You may want to consider adding a Helper to get some of this data for 
the view, if you think you may want the data on multiple views.  The 
helper can make calls via requestAction to this controller, or possibly 
other controllers to get some data, that can be formatted by the 
elements for the view.

Bill

On 4/17/2012 7:30 AM, Timo [via CakePHP] wrote:
> Hello everybody,
>
> since I am fairly new to CakePhp and since my research has not yielded 
> any definitive results concerning my specific problem so far, I 
> figured the best thing to do would be to ask here. :)
> Bear with me, this is going to be rather elaborate, I fear...
>
> I'm creating an application with CakePhp (2.1) and Javascript / 
> JQuery, one basic functionality is that table entries can be viewed in 
> different ways, to which I will come in a moment. My main content area 
> consists of 2 sub divisions, one is the actual main content, the other 
> is a horizontally sliding area which can be toggled on and off (in the 
> following text referred to as "accordion"). I will attach an image at 
> the end of the post to exemplify what I mean.
>
> The afore mentioned different views ( / edits / adds)  are:
>
> *1. Standard view* would be in accordion which is hidden until a table 
> entry is chosen, once the view is triggered, the area is supposed to 
> slide from the right side into the screen and overlap the underlying 
> table, the area can be toggled on and off. Basically it acts as a 
> horizontal accordion window, the user is able  to quickly manipulate 
> table entries, hide the entry to look something up in the table, and 
> show the entry again to continue whatever he was doing before.
> *2. Fullscreen view *is supposed to be rendered in the actual main 
> content area, in this view the table is transferred to the accordion, 
> basically table and table entry swap positions.
>
> Another aspect of the application is that table entries can be stored 
> in "favourites" or "clipboard", those two are small windows which can 
> be shown on any page of the application and which are also part of the 
> start page.
>
> Now that I have started to try to implement this layout, I have 
> encountered some problems, which might result from me being a beginner 
> in CakePhp. After baking controllers and models via the console, I 
> created the index view for one controller ("companies") and went on to 
> the "add" view for this controller. Naive as I was I simply put the 
> generated "add" view code in the accordion div and left the table 
> (index view) code in the main area div which led to errors. So if I 
> understand this correctly, I cannot simply fill 2 divs with different 
> view contents from only one query, which makes sense. My research led 
> me to the "elements" functionality of cake, though I could only find 
> the cookbook entry for 1.3 ( 
> http://book.cakephp.org/1.3/view/1081/Elements ).
> Please tell me whether this will help me with my problem, or if there 
> is a better, simple solution for what I am trying to do. (I might have 
> to fill not only the accordion and the main content area with data 
> entries, but also the "favourites" and "clipboard" area once the user 
> clicks the button to show those). I also searched for a way to "fetch" 
> multiple content in my default layout like
>
> echo $this->fetch('content');
> echo $this->fetch('accordion');
>
> but I did not find anything. So this is my first issue. A second one:
> When the user clicks on a table entry in the table, an option menu is 
> shown at the mouse position from which the user can choose to edit, 
> delete or view the clicked entry. This option menu is also shown when 
> the user clicks on an entry in the favourites or clipboard area. Is 
> there a way to combine PHP and Javascript to determine, which kind of 
> data is clicked (e.g. which controller must be used)?
> And furthermore, is  there a way to integrate (cake)php in code in 
> javascript?
>
> Example:
> $('#listEditButton').click(function(){
>    window.location.href="companyEdit.html";
> });
>
> Instead of window.location.href="companyEdit.html"; the cakephp edit 
> view for the correct controller should be triggered.
>
> *Breathes deeply* Excuse my excessive question, but I just started 
> with CakePhp (did research, went through the blog tutorial - which as 
> far as I can tell does not cover what I need for my application), 
> maybe I even missed some CakePhp functionalities which provide exactly 
> what I am looking for.
>
>
> To sum it up:
> *1. Multiple Views on one page: *How does one for example show the 
> index view AND the view of one entry of a controller on a single page 
> with CakePhp.
> *2. Javascript and CakePhp: *How do you use CakePhp view "calls" in 
> javascript, is this even possible, how would one approach the above 
> problem with the option menu (if there is any way apart from separate 
> option menus for all pages AND for "favourites" and "clipboard").
>
>
> If you have read all the above - Thank you very much! I would have put 
> this in caps but that is just hurting for the eyes. I hope someone can 
> help me and put me on the right way to what I am trying to do :)
>
>
> Kindest regards
>
> Timo
>
>
>
>
>
>
> Attachment:
>
> <https://lh6.googleusercontent.com/--4enSImYE8U/T40rbqL-DFI/AAAAAAAAAAk/SNHq3HD_29Q/s1600/example.png>
>
> -- 
> 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
> [hidden email] </user/SendEmail.jtp?type=node&node=5646347&i=0> For 
> more options, visit this group at http://groups.google.com/group/cake-php
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://cakephp.1045679.n5.nabble.com/Some-Issues-multiple-views-on-one-page-and-help-with-javascript-tp5646347p5646347.html
>  
>
> To start a new topic under CakePHP, email 
> ml-node+s1045679n125572...@n5.nabble.com
> To unsubscribe from CakePHP, click here 
> <http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1255722&code=YmlsbC5zdG9sdHpAYm9vc3RlcndlYnNvbHV0aW9ucy5jb218MTI1NTcyMnwtNTU0NTk2MTUy>.
> NAML 
> <http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>  
>


--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Some-Issues-multiple-views-on-one-page-and-help-with-javascript-tp5646347p5646734.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

Reply via email to