Re: Some Issues: multiple views on one page and help with javascript

2012-04-22 Thread Timo
Hi :)

thank you both for your advice, it helped me to get going and so far I was 
able to implement the design I had in mind using elements and ajax. Should 
I encounter more difficulties, I will post them here.

Oh and bs28723: No worries that you might've been too basic, I'm always 
glad for any advice, especially since I'm just beginning to learn Cake :)


Timo

-- 
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: Some Issues: multiple views on one page and help with javascript

2012-04-18 Thread bs28723
I don't know a lot about AJAX - Need to learn :-)
What I am doing with the helper, is that I was finding that I was 
repeating code in multiple views or several times in a single view to 
get ready to call an element.  So, I just moved this common code from 
the view to a helper, then made a single to call to the helper.

In Controller
public $helpers = array ('Html', 'Form', 'Session',  'Address');

In view
 $title = "Shipping Address";
Address->makeAddressElements($organization); ?>

In Helper
public function makeAddressElements($organization) {
   // some details removed
 $addresses = 
$this->requestAction('addresses/getByOrg/'.$organization['id']);
 foreach ($addresses as $address) {
 $title = "Not Used Address";
 if ($organization['ship_address_id'] == 
$address['Address']['id'])
 $title = "Shipping Address";
 if ($organization['bill_address_id'] == 
$address['Address']['id'])
 $title = "Billing Address";
 $html .= $this->_View->element('address', array("addr" => 
$address['Address'], "title" => $title));
}
return $html;
   }

 In the Helper in order to call an element that is associated with a 
view, you need to use the call  $this->_View->element().   This will 
used the attached view to help render the element.  This is not well 
documented, but seems to be the way other helpers do this.

You may not need to do this since you are doing Ajax.  You may be able 
to load all this stuff in the beginning and have javascript hide and 
display the details as needed.

As for the controller function mapping to views, while Cakephp will 
defualt create add / index / edit / view functions and views, you are 
not required to use them all. If you want to have everything displayed 
and managed for the controller thru the view function and the view view, 
I don't think this is a problem.  You could then use requestAction, or a 
bunch of set commands to pass information to the view.

This is where my Ajax knowledge puts me on thin ice, but I think you can 
create Ajax or javascript functions that can call other functions in the 
controller, like add or edit, and return information that you updated a 
portion of the screen, so that you don't have to render the entire page.

I guess the way I would look at this is that the view is the webpage.  
If you want everything to be processed in a single page, with pop outs, 
etc. then you only need one view.  It may be complicated, but if you are 
familiar doing this with just PHP and Ajax then it should be fine.   The 
controller is where all the business logic is run. So this can be 
organized based on how you want to process the data.

Not sure if I am getting to basic here, or if this answers your question 
about views.

Bill

On 4/18/2012 7:02 AM, Timo [via CakePHP] wrote:
> Thanks a lot for your answer, it helped me a lot!
>
> I see how elements can be used for what I am trying to do. I tried the 
> simple example from the link you provided, so now I can populate 
> multiple ares of one page with different views - that's great!
>
> What I don't quite grasp is the usefulness of adding a helper as you 
> mentioned in your last paragraph. So basically the helper would get 
> all the data for my elements instead of me calling requestAction 
> multiple times?
>
> I was told that AJAX can be used to put content into element areas 
> (via requestAction, too?), e.g. I have my slideout visible which shows 
> a data entry, then, with my table still visible in the main content 
> area, I choose edit on a different entry and instead of loading the 
> page anew, the slideout element loads new content. How would one go 
> about this task? A simple example would be enough to get me started, 
> since I cannot find any useful ones, e.g. a button that triggers an 
> element to be filled with a different view. I am aware of the .load 
> function in JQuery ( http://api.jquery.com/load/ ), but that does not 
> explain how to include such functionality in a CakePhp environment. 
> Can I simply use something like 'controllername/add' as url parameter 
> for load?
>
> As I see it, one issue remains despite the element solution (which 
> might result from my limited Cake knowledge)  - concrete example: The 
> application has tables for companies, users and posts, each table and 
> corresponding controller has index / add / view(show the data) / edit 
> views. Index is displayed in the main area, the other views are 
> supposed to be displayed in the slideout.
> Would I not need many different element specificat

Re: Some Issues: multiple views on one page and help with javascript

2012-04-18 Thread luca capra



Il 18/04/2012 13:01, Timo ha scritto:

Thanks a lot for your answer, it helped me a lot!

I see how elements can be used for what I am trying to do. I tried the 
simple example from the link you provided, so now I can populate 
multiple ares of one page with different views - that's great!


What I don't quite grasp is the usefulness of adding a helper as you 
mentioned in your last paragraph. So basically the helper would get 
all the data for my elements instead of me calling requestAction 
multiple times?


I was told that AJAX can be used to put content into element areas 
(via requestAction, too?), e.g. I have my slideout visible which shows 
a data entry, then, with my table still visible in the main content 
area, I choose edit on a different entry and instead of loading the 
page anew, the slideout element loads new content. How would one go 
about this task? A simple example would be enough to get me started, 
since I cannot find any useful ones, e.g. a button that triggers an 
element to be filled with a different view. I am aware of the .load 
function in JQuery ( http://api.jquery.com/load/ ), but that does not 
explain how to include such functionality in a CakePhp environment. 
Can I simply use something like 'controllername/add' as url parameter 
for load?

I use it in this way:
$("#someelement").load("/controller/action div.index");
loads html content of div.index in #someelement

You can handle it better with $.post / $.get handling the html response
$.get('controller/action', function(html){
  var myHtml = $(html);
  $("#something").replace( myHtml.find("#something").html() );
});

This works faster if you create an empty layout and print only the 
$content_for_layout, I use it with a custom extension
eg. controlller/index.dhtml give me only the action response, without 
the whole layout code around.





As I see it, one issue remains despite the element solution (which 
might result from my limited Cake knowledge)  -

...
Is there a way to put for example the rendered view of 
"View/Company/add.ctp" into an element?

...


I suggest you to look at the new -cool- templating system (from 2.1 I think)
http://book.cakephp.org/2.0/en/views.html

Luca

--
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: Some Issues: multiple views on one page and help with javascript

2012-04-18 Thread Timo
Thanks a lot for your answer, it helped me a lot!

I see how elements can be used for what I am trying to do. I tried the 
simple example from the link you provided, so now I can populate multiple 
ares of one page with different views - that's great! 

What I don't quite grasp is the usefulness of adding a helper as you 
mentioned in your last paragraph. So basically the helper would get all the 
data for my elements instead of me calling requestAction multiple times?

I was told that AJAX can be used to put content into element areas (via 
requestAction, too?), e.g. I have my slideout visible which shows a data 
entry, then, with my table still visible in the main content area, I choose 
edit on a different entry and instead of loading the page anew, the 
slideout element loads new content. How would one go about this task? A 
simple example would be enough to get me started, since I cannot find any 
useful ones, e.g. a button that triggers an element to be filled with a 
different view. I am aware of the .load function in JQuery ( 
http://api.jquery.com/load/ ), but that does not explain how to include 
such functionality in a CakePhp environment. Can I simply use something 
like 'controllername/add' as url parameter for load?

As I see it, one issue remains despite the element solution (which might 
result from my limited Cake knowledge)  - concrete example: The application 
has tables for companies, users and posts, each table and corresponding 
controller has index / add / view(show the data) / edit views. Index is 
displayed in the main area, the other views are supposed to be displayed in 
the slideout. 
Would I not need many different element specifications depending 
a) on the chosen table
b) the chosen option (add / edit / etc) ?

Is there a way to put for example the rendered view of 
"View/Company/add.ctp" into an element? Because as far as I understand 
requestAction, I can only get the data provided by the controller (which 
makes sense due to the MVC pattern) and this data still has to be echoed 
and styled. And that is the problem since there is not a common style for 
add / edit / view (add and edit would have inputs for data values, view 
would use labels). My thought would be to put those options into one 
element and control which style is used by a parameter given to the 
element, I just want to know if that is viable or if there is another, 
better way to do this. 

I hope that was somewhat intelligible :)
Many thanks in advance for any helpful advice


Timo

-- 
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: Some Issues: multiple views on one page and help with javascript

2012-04-17 Thread bs28723
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

Some Issues: multiple views on one page and help with javascript

2012-04-17 Thread Timo
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/AAk/SNHq

Re: multiple views or one massive view

2011-07-24 Thread nastya
I think it should be something like this:
in your views create the views that you need, ex: game1.ctp,
game2.ctp, etc...
in controller:
if($var==1) $this->render('game1');
if($var==2) $this->render('game2');
etc...

On Jul 23, 10:49 pm, Michael Gaiser  wrote:
> So I am working on a site that would display characters from several
> different games, many of which share the same types of attributes but just
> call them differently. I have a variable setup to tell me which game we are
> currently dealing with so my question is this, do I just have the view
> contain multiple if statements and set it up like a large switch, or is it
> possible to have the controller call a different view depending on that
> variable as would be my preference. Thanks.
>
> ~Michael

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


multiple views or one massive view

2011-07-23 Thread Michael Gaiser
So I am working on a site that would display characters from several
different games, many of which share the same types of attributes but just
call them differently. I have a variable setup to tell me which game we are
currently dealing with so my question is this, do I just have the view
contain multiple if statements and set it up like a large switch, or is it
possible to have the controller call a different view depending on that
variable as would be my preference. Thanks.

~Michael

-- 
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: render multiple views within single layout

2010-04-29 Thread John Andersen
See the CakePHP book regarding elements and their usage:
http://book.cakephp.org/view/97/Elements

Use Elements to present parts of the interface, that can be used in
more than one page/view.
So if your main action is "upload_photos", then in your
"upload_photos" view, you can invoke an element named "edit_progress"
and thus present both of your parts.
Enjoy,
   John

On Apr 29, 5:42 pm, gautam lakum  wrote:
> Hi all bakers,
>
> I have coded like this to render two views in a single controller.
>
> $this->render('upload_photos','layout1');
> $this->viewPath = 'ideas';
> $this->render('edit_progress',null);
>
> But the problem is it renders layout1 completely after rendering
> upload_photos, and then it renders the edit_progress view file along
> with rendering layout2.
> So in a single page, I am getting both layouts and both view files. I
> want upload_photos and edit_progress rendered in layout1's  $content_for_layout; ?> area.
>
> Help me please.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://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


render multiple views within single layout

2010-04-29 Thread gautam lakum
Hi all bakers,

I have coded like this to render two views in a single controller.

$this->render('upload_photos','layout1');
$this->viewPath = 'ideas';
$this->render('edit_progress',null);

But the problem is it renders layout1 completely after rendering
upload_photos, and then it renders the edit_progress view file along
with rendering layout2.
So in a single page, I am getting both layouts and both view files. I
want upload_photos and edit_progress rendered in layout1's  area.

Help me please.

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: Struggeling with MVC and multiple views

2009-07-30 Thread Dr. Loboto

If you want to render non-default view for an action just call $this-
>render('my_view_name') in controller explicitly. This way you can
have more views then actions.

On Jul 5, 8:45 pm, Reinder  wrote:
> Thanks for your response, however I don't think this solves the acl
> part of it, e.g. i would like to archive the following setup;
>
> main index page containing three elements, all with its own acl
> management;
> ->Login form
>   ->If user is logged in show logout view (containing username +
> link), otherwise display standard login form.
> ->Add form
>   ->If user is logged in and allowed to add, show add form, otherwise
> display 'not able to edit message'
> ->View post table
>   ->Always display the last 10 posts.
>
> Does this mean I have to include access managements from within the
> templates or can I control this on the controller level?
>
> Thanks in advanced,
>
> Reinder
>
> On Jul 2, 6:30 pm, brian  wrote:
>
>
>
> > On Thu, Jul 2, 2009 at 7:39 AM, Reinder wrote:
>
> > > Hi,
>
> > > I seem to be struggeling with possibly something so obvious, i can't
> > > find it in the tutorials or books. Hopefully someone here is able to
> > > enlight me. I have made a good number of sites with PHP and just moved
> > > to cakephp as a mvc framework. I completed the blog and auth/acl
> > > tutorials. So far I like the speed of development, however I don't
> > > seem to grasp how to properly create a page combining multiple views,
> > > leaving the mvc framework (with auth in tact).
>
> > > E.g. In the blog tutorial a simple blog is created based on a model
> > > for post. This model has functions for view and add, in the blog
> > > tutorial you either view posts or add a posts.
>
> > > I would like to create a page that shows the last top 10 posts, AND an
> > > add form to add posts when needed, as effectively as possible.
>
> > > The way I ended up doing it is to change the index to display a form
> > > for the add post, linking to add, and a seperate table viewing the
> > > lasts posts. However I basically copied the code for the 'view.ctp'
> > > and add.ctp', which means dublicate code. For this reason this does
> > > not seem to be the proper way. Not only because I have dublicate code,
> > > also because the add form is now visible to everyone while 'guests'
> > > can't posts. (based on the ACL, guests should not be able to add
> > > posts, only view them)
>
> > > I would like to understand what best practice is to cover this in
> > > cakePHP;
> > > -> Create a page seperate from the models;
> > > -> Create elements, in this case to show and add, that calls the
> > > functions controller?
> > > -> Use requestAction to call controller functions from within those
> > > elements?
>
> > > If someone whould have (a link to) an example that would be highly
> > > appreciated.
>
> > > Thanks in advanced for your response,
>
> > > Reinder
>
> > What I usually do for my forms is to put them in an element. So, for
> > Post model, I'd have in views/posts/add.ctp a line with
> > $this->element('posts/form'). And the file
> > views/elements/posts/form.ctp includes all of the logic for creating
> > the form, including whether to show an add or edit form, stuff for
> > admins only, etc.
>
> > switch ($this->params['action'])
> > {
> >         case 'edit':
> >                 echo $form->create('Post', array('action' => 'edit'));
> >                 echo $form->hidden('Post.id');
> >                 echo $form->hidden('Post.user_id');
> >         break;
>
> >         case 'add':
> >         default:
> >                 echo $form->create('Post', array('action' => 'add'));
> >                 echo $form->hidden('Post.user_id', array('value' => 
> > $user_id));
>
> > }
>
> > This way, you can include the form in your add or edit views, as well
> > as in your index view. Put a debug($this->params) in your view
> > somewhere to get an idea how that's set up.- Hide quoted text -
>
> > - Show quoted text -
--~--~-~--~~~---~--~~
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: Struggeling with MVC and multiple views

2009-07-29 Thread Mateo

Any further input on this would be appreciated. I have a very similar
question.

On Jul 5, 7:45 am, Reinder  wrote:
> Thanks for your response, however I don't think this solves theacl
> part of it, e.g. i would like to archive the following setup;
>
> main index page containing three elements, all with its ownacl
> management;
> ->Login form
>   ->If user is logged in show logout view (containing username +
> link), otherwise display standard login form.
> ->Add form
>   ->If user is logged in and allowed to add, show add form, otherwise
> display 'not able to edit message'
> ->View post table
>   ->Always display the last 10 posts.
>
> Does this mean I have to include access managements from within the
> templates or can I control this on the controller level?
>
> Thanks in advanced,
>
> Reinder
>
> On Jul 2, 6:30 pm, brian  wrote:
>
> > On Thu, Jul 2, 2009 at 7:39 AM, Reinder wrote:
>
> > > Hi,
>
> > > I seem to be struggeling with possibly something so obvious, i can't
> > > find it in the tutorials or books. Hopefully someone here is able to
> > > enlight me. I have made a good number of sites with PHP and just moved
> > > to cakephp as a mvc framework. I completed the blog and auth/acl
> > > tutorials. So far I like the speed of development, however I don't
> > > seem to grasp how to properly create a page combining multiple views,
> > > leaving the mvc framework (with auth in tact).
>
> > > E.g. In the blogtutoriala simple blog is created based on a model
> > > for post. This model has functions for view and add, in the blog
> > >tutorialyou either view posts or add a posts.
>
> > > I would like to create a page that shows the last top 10 posts, AND an
> > > add form to add posts when needed, as effectively as possible.
>
> > > The way I ended up doing it is to change the index to display a form
> > > for the add post, linking to add, and a seperate table viewing the
> > > lasts posts. However I basically copied the code for the 'view.ctp'
> > > and add.ctp', which means dublicate code. For this reason this does
> > > not seem to be the proper way. Not only because I have dublicate code,
> > > also because the add form is now visible to everyone while 'guests'
> > > can't posts. (based on theACL, guests should not be able to add
> > > posts, only view them)
>
> > > I would like to understand what best practice is to cover this in
> > > cakePHP;
> > > -> Create a page seperate from the models;
> > > -> Create elements, in this case to show and add, that calls the
> > > functions controller?
> > > -> Use requestAction to call controller functions from within those
> > > elements?
>
> > > If someone whould have (a link to) an example that would be highly
> > > appreciated.
>
> > > Thanks in advanced for your response,
>
> > > Reinder
>
> > What I usually do for my forms is to put them in an element. So, for
> > Post model, I'd have in views/posts/add.ctp a line with
> > $this->element('posts/form'). And the file
> > views/elements/posts/form.ctp includes all of the logic for creating
> > the form, including whether to show an add or edit form, stuff for
> > admins only, etc.
>
> > switch ($this->params['action'])
> > {
> >         case 'edit':
> >                 echo $form->create('Post', array('action' => 'edit'));
> >                 echo $form->hidden('Post.id');
> >                 echo $form->hidden('Post.user_id');
> >         break;
>
> >         case 'add':
> >         default:
> >                 echo $form->create('Post', array('action' => 'add'));
> >                 echo $form->hidden('Post.user_id', array('value' => 
> > $user_id));
>
> > }
>
> > This way, you can include the form in your add or edit views, as well
> > as in your index view. Put a debug($this->params) in your view
> > somewhere to get an idea how that's set up.- Hide quoted text -
>
> > - Show quoted text -

--~--~-~--~~~---~--~~
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: Struggeling with MVC and multiple views

2009-07-05 Thread Reinder

Thanks for your response, however I don't think this solves the acl
part of it, e.g. i would like to archive the following setup;

main index page containing three elements, all with its own acl
management;
->Login form
  ->If user is logged in show logout view (containing username +
link), otherwise display standard login form.
->Add form
  ->If user is logged in and allowed to add, show add form, otherwise
display 'not able to edit message'
->View post table
  ->Always display the last 10 posts.

Does this mean I have to include access managements from within the
templates or can I control this on the controller level?

Thanks in advanced,

Reinder


On Jul 2, 6:30 pm, brian  wrote:
> On Thu, Jul 2, 2009 at 7:39 AM, Reinder wrote:
>
> > Hi,
>
> > I seem to be struggeling with possibly something so obvious, i can't
> > find it in the tutorials or books. Hopefully someone here is able to
> > enlight me. I have made a good number of sites with PHP and just moved
> > to cakephp as a mvc framework. I completed the blog and auth/acl
> > tutorials. So far I like the speed of development, however I don't
> > seem to grasp how to properly create a page combining multiple views,
> > leaving the mvc framework (with auth in tact).
>
> > E.g. In the blog tutorial a simple blog is created based on a model
> > for post. This model has functions for view and add, in the blog
> > tutorial you either view posts or add a posts.
>
> > I would like to create a page that shows the last top 10 posts, AND an
> > add form to add posts when needed, as effectively as possible.
>
> > The way I ended up doing it is to change the index to display a form
> > for the add post, linking to add, and a seperate table viewing the
> > lasts posts. However I basically copied the code for the 'view.ctp'
> > and add.ctp', which means dublicate code. For this reason this does
> > not seem to be the proper way. Not only because I have dublicate code,
> > also because the add form is now visible to everyone while 'guests'
> > can't posts. (based on the ACL, guests should not be able to add
> > posts, only view them)
>
> > I would like to understand what best practice is to cover this in
> > cakePHP;
> > -> Create a page seperate from the models;
> > -> Create elements, in this case to show and add, that calls the
> > functions controller?
> > -> Use requestAction to call controller functions from within those
> > elements?
>
> > If someone whould have (a link to) an example that would be highly
> > appreciated.
>
> > Thanks in advanced for your response,
>
> > Reinder
>
> What I usually do for my forms is to put them in an element. So, for
> Post model, I'd have in views/posts/add.ctp a line with
> $this->element('posts/form'). And the file
> views/elements/posts/form.ctp includes all of the logic for creating
> the form, including whether to show an add or edit form, stuff for
> admins only, etc.
>
> switch ($this->params['action'])
> {
>         case 'edit':
>                 echo $form->create('Post', array('action' => 'edit'));
>                 echo $form->hidden('Post.id');
>                 echo $form->hidden('Post.user_id');
>         break;
>
>         case 'add':
>         default:
>                 echo $form->create('Post', array('action' => 'add'));
>                 echo $form->hidden('Post.user_id', array('value' => 
> $user_id));
>
> }
>
> This way, you can include the form in your add or edit views, as well
> as in your index view. Put a debug($this->params) in your view
> somewhere to get an idea how that's set up.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Struggeling with MVC and multiple views

2009-07-02 Thread brian

On Thu, Jul 2, 2009 at 7:39 AM, Reinder wrote:
>
> Hi,
>
> I seem to be struggeling with possibly something so obvious, i can't
> find it in the tutorials or books. Hopefully someone here is able to
> enlight me. I have made a good number of sites with PHP and just moved
> to cakephp as a mvc framework. I completed the blog and auth/acl
> tutorials. So far I like the speed of development, however I don't
> seem to grasp how to properly create a page combining multiple views,
> leaving the mvc framework (with auth in tact).
>
> E.g. In the blog tutorial a simple blog is created based on a model
> for post. This model has functions for view and add, in the blog
> tutorial you either view posts or add a posts.
>
> I would like to create a page that shows the last top 10 posts, AND an
> add form to add posts when needed, as effectively as possible.
>
> The way I ended up doing it is to change the index to display a form
> for the add post, linking to add, and a seperate table viewing the
> lasts posts. However I basically copied the code for the 'view.ctp'
> and add.ctp', which means dublicate code. For this reason this does
> not seem to be the proper way. Not only because I have dublicate code,
> also because the add form is now visible to everyone while 'guests'
> can't posts. (based on the ACL, guests should not be able to add
> posts, only view them)
>
> I would like to understand what best practice is to cover this in
> cakePHP;
> -> Create a page seperate from the models;
> -> Create elements, in this case to show and add, that calls the
> functions controller?
> -> Use requestAction to call controller functions from within those
> elements?
>
> If someone whould have (a link to) an example that would be highly
> appreciated.
>
> Thanks in advanced for your response,
>
> Reinder
>
> >
>


What I usually do for my forms is to put them in an element. So, for
Post model, I'd have in views/posts/add.ctp a line with
$this->element('posts/form'). And the file
views/elements/posts/form.ctp includes all of the logic for creating
the form, including whether to show an add or edit form, stuff for
admins only, etc.

switch ($this->params['action'])
{
case 'edit':
echo $form->create('Post', array('action' => 'edit'));
echo $form->hidden('Post.id');
echo $form->hidden('Post.user_id');
break;

case 'add':
default:
echo $form->create('Post', array('action' => 'add'));
echo $form->hidden('Post.user_id', array('value' => $user_id));
}

This way, you can include the form in your add or edit views, as well
as in your index view. Put a debug($this->params) in your view
somewhere to get an idea how that's set up.

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



Struggeling with MVC and multiple views

2009-07-02 Thread Reinder

Hi,

I seem to be struggeling with possibly something so obvious, i can't
find it in the tutorials or books. Hopefully someone here is able to
enlight me. I have made a good number of sites with PHP and just moved
to cakephp as a mvc framework. I completed the blog and auth/acl
tutorials. So far I like the speed of development, however I don't
seem to grasp how to properly create a page combining multiple views,
leaving the mvc framework (with auth in tact).

E.g. In the blog tutorial a simple blog is created based on a model
for post. This model has functions for view and add, in the blog
tutorial you either view posts or add a posts.

I would like to create a page that shows the last top 10 posts, AND an
add form to add posts when needed, as effectively as possible.

The way I ended up doing it is to change the index to display a form
for the add post, linking to add, and a seperate table viewing the
lasts posts. However I basically copied the code for the 'view.ctp'
and add.ctp', which means dublicate code. For this reason this does
not seem to be the proper way. Not only because I have dublicate code,
also because the add form is now visible to everyone while 'guests'
can't posts. (based on the ACL, guests should not be able to add
posts, only view them)

I would like to understand what best practice is to cover this in
cakePHP;
-> Create a page seperate from the models;
-> Create elements, in this case to show and add, that calls the
functions controller?
-> Use requestAction to call controller functions from within those
elements?

If someone whould have (a link to) an example that would be highly
appreciated.

Thanks in advanced for your response,

Reinder

--~--~-~--~~~---~--~~
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: Multiple views

2008-11-24 Thread Smelly_Eddie

First you need to create an element that contains the HTML code to
display your data.

Store it in views/elements/.ctp

In that code(the element) you can make a call to any controller action
to get the needed data.

$this->requestAction('/controller/action')   (I think)


Then you would add the code that calls the element to your main page;

$this->element('');




On Nov 23, 9:04 am, Walther <[EMAIL PROTECTED]> wrote:
> I'm using version 1.2RC3
>
> On the front-page of my application I want to be able to display
> numerous other views. For example I may want to display a view of my
> pages controller (for example a welcome message), and a view from my
> calendar controller.
>
> How would I do this?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple views

2008-11-23 Thread Rafael Bandeira aka rafaelbandeira3

> On the front-page of my application I want to be able to display
> numerous other views. For example I may want to display a view of my
> pages controller (for example a welcome message), and a view from my
> calendar controller.
>
> How would I do this?

use View::element(), as such:

$this->element('../controller_name/view_name');
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Multiple views

2008-11-23 Thread Walther

I'm using version 1.2RC3

On the front-page of my application I want to be able to display
numerous other views. For example I may want to display a view of my
pages controller (for example a welcome message), and a view from my
calendar controller.

How would I do this?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Views

2008-09-26 Thread teknoid

Sounds like what you are looking for is elements.
Please refer to the manual on how to use them.

On Sep 26, 3:26 am, deepesh <[EMAIL PROTECTED]> wrote:
> Hi I am a newbie in Cake.
>
> I wan to know if we can load more than one view in a single view .
>
> To be elaborate more lets take an example of Code Igniter
>
> in a view we can call
>
> $this->load->view('view2'); // in a certain portion say in a row
> $this->load->view('view3');/// in other row the the table.
>
> Where view2.php , view3.php are separate view files.
>
> Hope I am clear enough in my views  :)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Multiple Views

2008-09-26 Thread deepesh

Hi I am a newbie in Cake.

I wan to know if we can load more than one view in a single view .

To be elaborate more lets take an example of Code Igniter

in a view we can call

$this->load->view('view2'); // in a certain portion say in a row
$this->load->view('view3');/// in other row the the table.

Where view2.php , view3.php are separate view files.

Hope I am clear enough in my views  :)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Differing Array structures with HABTM find requests? Multiple Views?

2008-01-18 Thread designvoid

Ok, I have had a good search on filtering HABTM and also found your
earlier post on this, but haven't had any joy getting it working, is
it possible you could give a slightly more detailed example?

I really don't want to get beaten by this as I have pretty much
everything else nailed, I've used BAKE and everything working fine,
and I've redesigned all the pages, even got LDAP and multiple
checkboxes working but its just these little extra bits of
functionality imposed by the interface design that are causing
headaches...

Again, thanks for your time!

toby.

On Jan 18, 9:42 am, designvoid <[EMAIL PROTECTED]> wrote:
> Excellent! Many thanks, I will search for more info on this and
> hopefully solve this!
>
> I had searched the group many times, in fact I read thru the group
> daily at the moment as I'm trying to learn as much as poss, its just
> trick sometimes knowing exactly what to search for as I'm still not
> 100% with specific terminology.
>
> Anyways, thanks again for the tip!! :-)
>
> On Jan 18, 9:37 am, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Jan 18, 10:29 am, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > Noone able to add any insight to this?
>
> > There is a lot of insight already listed on the frequent discussions
> > page.
>
> > The really really easy solution is to make a model of your join table
> > and call $this->Project->ProjectsTeam->findAll($conditons); in both
> > cases.
>
> > hth,
>
> > AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Differing Array structures with HABTM find requests? Multiple Views?

2008-01-18 Thread designvoid

Excellent! Many thanks, I will search for more info on this and
hopefully solve this!

I had searched the group many times, in fact I read thru the group
daily at the moment as I'm trying to learn as much as poss, its just
trick sometimes knowing exactly what to search for as I'm still not
100% with specific terminology.

Anyways, thanks again for the tip!! :-)

On Jan 18, 9:37 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Jan 18, 10:29 am, designvoid <[EMAIL PROTECTED]> wrote:
>
> > Noone able to add any insight to this?
>
> There is a lot of insight already listed on the frequent discussions
> page.
>
> The really really easy solution is to make a model of your join table
> and call $this->Project->ProjectsTeam->findAll($conditons); in both
> cases.
>
> hth,
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Differing Array structures with HABTM find requests? Multiple Views?

2008-01-18 Thread AD7six



On Jan 18, 10:29 am, designvoid <[EMAIL PROTECTED]> wrote:
> Noone able to add any insight to this?

There is a lot of insight already listed on the frequent discussions
page.

The really really easy solution is to make a model of your join table
and call $this->Project->ProjectsTeam->findAll($conditons); in both
cases.

hth,

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Differing Array structures with HABTM find requests? Multiple Views?

2008-01-18 Thread designvoid

Noone able to add any insight to this? Sorry to bump, I know its
annoying, but I'm loathed push forward with this app if I'm unsure
about cases like this...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Differing Array structures with HABTM find requests? Multiple Views?

2008-01-17 Thread designvoid

Hi all,

I have a page that displays a list of projects, projects can habtm
teams and vice versa, when the page first loads the $projects array is
populated via:

$this->set('projects', $this->Project->findAll());

Which returns ALL projects. Now on the page there is a select box that
posts back to the controller an id of a team in order to show projects
JUST for that team. This time the projects array is filled via:

$this->set('projects', $this->Project->Team->find(array('Team.id' =>
$_POST['team_id'])));

My problem is that these two requests return different array
structures, so my index.thtml is fine for the initial view all, but
falls over for the other request.

I have currently got around the problem by creating a second view file
and call 'render('secondview')' which is altered to accept the
different array (ie the looping etc)

What I want to know is if this is the correct way of doing this or
have I missed something fundamental?

TIA,

toby.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Views for same controller?

2007-12-28 Thread Ron Chaplin
I have approached as francky06l said. When I moved to 1.2 I found that
using the builtin admin functionality of bake was very nice. It simply
replecates the scaffold views and methods with your choice of prefix, in
my case admin_ . So after my initial bake, I go in and strip the
"public" views and leave the admin views pretty much stock.

HTH

On Fri, 2007-12-28 at 15:25 -0800, francky06l wrote:

> I would build 1 element, for the specific part of admin level .. This
> element would be included in the view in an "if statement".. Maybe
> it's not 100% MVC, but it's (to me) a very convenient way.
> hth
> 
> On Dec 28, 10:36 pm, CodeHooligans <[EMAIL PROTECTED]> wrote:
> > Happy Holidays all,
> >
> > Just getting into Cake this week thanks to some slow holidays.
> >
> > I'm building a Residence Directory system and using Cake. I've built
> > everything initially using bake. The application is coming along well
> > thanks to some examples from the IBM site and downloaded modules on
> > the Bakery site.
> >
> > So my question: I basically have 2 levels of authenticated users. I
> > want one view for the general user. But I want a different view for
> > admin-level users.
> >
> > The Views are not all that different. The admin-level user would see
> > more fields on the list, edit, add forms. Using PHP outside a MVC
> > framework, I would generally wrap the extra admin fields in some
> > conditional statements and move on. But wanted to ask what the
> > 'correct' MVC method for this would be.
> >
> > My apologies if this is a basic question.
> >
> > Regards,
> > Paul
> > 

Thanks,

Ronald Chaplin
Owner - T73 Software and Designs




  http://t73-softdesign.com/

  We'll Make All Of Your Wildest

e-Commerce Dreams Come True!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Views for same controller?

2007-12-28 Thread francky06l

I would build 1 element, for the specific part of admin level .. This
element would be included in the view in an "if statement".. Maybe
it's not 100% MVC, but it's (to me) a very convenient way.
hth

On Dec 28, 10:36 pm, CodeHooligans <[EMAIL PROTECTED]> wrote:
> Happy Holidays all,
>
> Just getting into Cake this week thanks to some slow holidays.
>
> I'm building a Residence Directory system and using Cake. I've built
> everything initially using bake. The application is coming along well
> thanks to some examples from the IBM site and downloaded modules on
> the Bakery site.
>
> So my question: I basically have 2 levels of authenticated users. I
> want one view for the general user. But I want a different view for
> admin-level users.
>
> The Views are not all that different. The admin-level user would see
> more fields on the list, edit, add forms. Using PHP outside a MVC
> framework, I would generally wrap the extra admin fields in some
> conditional statements and move on. But wanted to ask what the
> 'correct' MVC method for this would be.
>
> My apologies if this is a basic question.
>
> Regards,
> Paul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Multiple Views for same controller?

2007-12-28 Thread CodeHooligans

Happy Holidays all,

Just getting into Cake this week thanks to some slow holidays.

I'm building a Residence Directory system and using Cake. I've built
everything initially using bake. The application is coming along well
thanks to some examples from the IBM site and downloaded modules on
the Bakery site.

So my question: I basically have 2 levels of authenticated users. I
want one view for the general user. But I want a different view for
admin-level users.

The Views are not all that different. The admin-level user would see
more fields on the list, edit, add forms. Using PHP outside a MVC
framework, I would generally wrap the extra admin fields in some
conditional statements and move on. But wanted to ask what the
'correct' MVC method for this would be.

My apologies if this is a basic question.

Regards,
Paul

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: One controller action and multiple views

2007-08-16 Thread Grant Cox

Certainly, if you call $this->render() in your controller action you
can specify whichever view file / layout you want.


On Aug 16, 8:41 pm, nitifixis <[EMAIL PROTECTED]> wrote:
> Hi!
>
> Just one question, can one controller action have multiple views and
> select any of them depending on a setting/parameter/whatever?
>
> Regards


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



One controller action and multiple views

2007-08-16 Thread nitifixis

Hi!

Just one question, can one controller action have multiple views and
select any of them depending on a setting/parameter/whatever?


Regards


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple views inside one Layout

2007-05-11 Thread MauroEC04

In my opinion, a view is the visible mode of one controller...
Showing more controllers in one page is responsability to layout,
isn't it?

Like, if I need to change the layout (what's going to appear and where
in the page), I want to edit only the layout and none of views...
That's because I want (and I need) to allow the web-art-designer not
touching any web-programming file.

But, anyway, thanks for the help.
Mauro

On May 9, 8:38 am, AD7six <[EMAIL PROTECTED]> wrote:
> On 7 mayo, 22:06, MauroEC04 <[EMAIL PROTECTED]> wrote:
>
> > Hello people!
>
> > Well. I'm programming a extreme-large portal and using Cake.
>
> > I need to include several (about 6 to 8) views in a layout (including
> > the 1st page).
>
> > I can't just use the requestAction() method in the view classes, it
> > would be very complicated...
>
> Why not?
>
> See the info on the use of  requestAction and elements listed 
> here:http://groups.google.com/group/cake-php/web/frequent-discussions
>
> hth,
>
> AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple views inside one Layout

2007-05-09 Thread AD7six



On 7 mayo, 22:06, MauroEC04 <[EMAIL PROTECTED]> wrote:
> Hello people!
>
> Well. I'm programming a extreme-large portal and using Cake.
>
> I need to include several (about 6 to 8) views in a layout (including
> the 1st page).
>
> I can't just use the requestAction() method in the view classes, it
> would be very complicated...

Why not?

See the info on the use of  requestAction and elements listed here:
http://groups.google.com/group/cake-php/web/frequent-discussions

hth,

AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Multiple views inside one Layout

2007-05-07 Thread MauroEC04

Hello people!

Well. I'm programming a extreme-large portal and using Cake.

I need to include several (about 6 to 8) views in a layout (including
the 1st page).

I can't just use the requestAction() method in the view classes, it
would be very complicated...

Is there some how?

Thanks,
Mauro


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: multiple views in one page?

2006-07-02 Thread Olivier Percebois-Garve

Use RequestAction().

for instance let's say you have controller Registration with method 
edit($step) and you want the output of controller User method 
listening($cat_id)
you use to call the adress registration/edit/1
transform edit($step) in edit($step, cat_id)
inside the method use RequestAction('User/listening'.$cat_id) in 
combination with set()

Look at the manual about RequestAction()

olivvv

PaulM wrote:
> I have a page that consists of a registration form on the left and
> user listing on the right.
> I want the registration page to be separate view or element and the
> user listing another separate element.
>
> How do I create two elements like that. They both have their own
> controllers.
>
> Thanks
>
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



multiple views in one page?

2006-07-02 Thread PaulM

I have a page that consists of a registration form on the left and
user listing on the right.
I want the registration page to be separate view or element and the
user listing another separate element.

How do I create two elements like that. They both have their own
controllers.

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---