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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php