Re: Running sql queries in cake

2010-08-29 Thread Walther
You should not use the query function except for incredibly complex
queries.

CakePHP 1.3 introduced the virtualFields parameter to help with this
exact problem.

Do:

$this-Question-virtualFields = array(
  'maxQSet' = 'max(qset'),
);

$max = $this-Question-find('first', array('fields' = array(
'maxQSet',
),
'conditions' = array(
'Question.category_id' = $this-Session-read('categoryid'),
),
));

You also don't give enough information to help solve your problem.
What errors do you get, what does your sql dump look like, have you
saved 'categoryid' into your session vars, have you included the
Session component in your controller, etc...

If you'd like some real time help you should join the IRC channel on
freenode. Or you can try asking your question on the cakeqs.org site
which is much nicer than this Google Group.

On Aug 29, 6:32 am, Muthuvel Subramani jmsmuthu...@gmail.com wrote:
 Thanks for the reply...

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: Form Submit Mystery

2010-08-29 Thread O.J. Tibi
I think you might want to use the $this-Form-submit() method
instead.

On Aug 29, 7:34 am, Dave Maharaj m...@davemaharaj.com wrote:
 I cant figure out why my button says submit Query (1.3.3)

 I have ?php echo $this-Form-button('Login', array ('type' = 'submit')
 );?

 If I use ?php echo $this-Form-button('Login', array ('type' = 'submit' ,
 'value' = 'Login') );? with the value it show login but that's not how
 it should work. correct?

 Thanks

 Dave

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


pagination sorting with unbound fields?

2010-08-29 Thread Greg Skerman
Hi,

I've got a query i've created in cakephp using a lot of join arrays. I've
also unbound associated arrays for the purpose of this query so that i can
get the results exactly as I need them.

The resulting query is:

SELECT `forums`.`id`, `Thread`.`id`, `firstpost`.`title`,
`lastpost`.`title`, (SELECT COUNT(1) FROM posts WHERE posts.thread_id =
Thread.id) AS postcount FROM `threads` AS `Thread` INNER JOIN posts AS
`firstpost` ON (`firstpost`.`thread_id` = `Thread`.`id` AND `firstpost`.`id`
= (SELECT MIN(id) FROM posts WHERE `posts`.`thread_id` = `Thread`.`id`))
INNER JOIN posts AS `lastpost` ON (`lastpost`.`thread_id` = `Thread`.`id`
AND `lastpost`.`id` = (SELECT MAX(id) FROM posts WHERE `posts`.`thread_id` =
`Thread`.`id`)) INNER JOIN forums ON (`forums`.`id` = `Thread`.`forum_id`)
LEFT JOIN `forums` AS `Forum` ON (`Thread`.`forum_id` = `Forum`.`id`) WHERE
`forums`.`id` = 1 LIMIT 20

(note, the limit is applied by the paginator automatically).

My problem is when it comes to sorting.

Sorting on Thread.id works perfectly fine ( echo $paginator-sort('Thread',
'Thread.id'); )

but sorting wont work when I try to sort by lastpost or postcount  (
echo $paginator-sort('Posts','postcount'); )

Is this not possible with out of the box pagination? or am I missing
something?

For reference, here's the value of the query inside the $this-paginate
variable:

return array(
'fields' = array(
'forums.id',
'Thread.id',
'firstpost.title',
'lastpost.title',
'(SELECT COUNT(1) FROM posts WHERE posts.thread_id =
Thread.id) AS postcount'
),
'conditions' = array('forums.id' = $id),
'order' = array('Thread.created' = 'asc'),
'joins' = array(
array(
'table' = 'posts',
'alias' = 'firstpost',
'type' = 'INNER',
'conditions' = array(
'firstpost.thread_id = Thread.id',
'firstpost.id = (SELECT MIN(id) FROM posts WHERE
posts.thread_id = Thread.id)'
)
),
array(
'table' = 'posts',
'alias' = 'lastpost',
'type' = 'INNER',
'conditions' = array(
'lastpost.thread_id = Thread.id',
'lastpost.id = (SELECT MAX(id) FROM posts WHERE
posts.thread_id = Thread.id)'
)
),
array(
'table' = 'forums',
'type' = 'INNER',
'conditions' = array(
'forums.id = Thread.forum_id'
)
)
)
);

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


missing controller in wamp advanced installation

2010-08-29 Thread rogwei
Apologies if this has already been discussed in the group, but I could
not find it. I have an advanced installation on Windows running wamp,
which I tested first with the app folder containing webroot at the
document root and the cake libraries above the document root. The
initial test setup worked as expected. I then moved the app folder to
the same level as the cake core libraries and left the webroot folder
in the document root. This is when I began to get the missing
controller error.

My installation uses the following structure.

from StartRunnotepad \wamp\www\testweb\index.php

if (!defined('ROOT')) {
define('ROOT', DS.'wamp'.DS.'cake'.DS.'1.3.x');
}
if (!defined('APP_DIR')) {
define('APP_DIR', 'test');
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', 
DS.'wamp'.DS.'cake'.DS.'1.3.x');
}

When I load http://localhost/testweb/, I get the default home view
with four green bars. I have a controller and model set up as follows.

StartRun\wamp\cake\1.3.x\test\controllers\profiles_controller.php:

?php
class ProfilesController extends AppController {
var $name = 'Profiles';
var $scaffold;
}
?

StartRun\wamp\cake\1.3.x\test\models\profile.php:

?php
class Profile extends AppModel {
var $name = 'Profile';
}
?

When I load http://localhost/testweb/profiles, I get the missing
controller message.


CakePHP: the rapid development php framework

Missing Controller
Error: ProfilesController could not be found.

Error: Create the class ProfilesController below in file: test
\controllers\profiles_controller.php

?php
class ProfilesController extends AppController {

var $name = 'Profiles';
}
?
Notice: If you want to customize this error message, create test\views
\errors\missing_controller.ctp

My take is that for some reason the core libraries are in scope but
the app is not, and I really have no clue as to why.

Apache returns a 200 status code on the request which suggests that
the .htaccess is set up correctly.
127.0.0.1 - - [29/Aug/2010:00:36:58 -0700] GET /testweb/profiles HTTP/
1.1 200 1470

My cake console works as expected, so my paths for cake and php must
be good. Seems like something internal to cake. I am very discouraged
to be fumbling around with this problem and would love it if someone
would point out what I am missing.

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


replacing html code in my view with an included html-file`

2010-08-29 Thread Tomfox Wiranata
hi everyone,

in my view i have a lot of html/php code to make a form. this makes my
view really big. i was wondering if it is possible, to source this
code out in a html file to include it?? makes it more transparent.

ls that possible?

thx a lot :)

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: replacing html code in my view with an included html-file`

2010-08-29 Thread Tilen Majerle
emmmake elements and then include it in view :D

--
LP,
Tilen Majerle http://majerle.eu


2010/8/29 Tomfox Wiranata tomfox.wiran...@gmail.com

 hi everyone,

 in my view i have a lot of html/php code to make a form. this makes my
 view really big. i was wondering if it is possible, to source this
 code out in a html file to include it?? makes it more transparent.

 ls that possible?

 thx a lot :)

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  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


opening a file (xls, doc, pdf etc) through a link

2010-08-29 Thread Tomfox Wiranata
hi,

how can i reference to file on my hdd with cake, that this file opens
a soon as i click the link? for example on my site there will be a
link, shown as a icon with text. if you click the link i want cake to
open that file...

how can i do that? does it work with href somehow?

looking forward to your feedback. thx

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


Grouping related plugins together under the plugins/ directory

2010-08-29 Thread keymaster
In cake1.3, has as anyone tried to group related plugins together, in
a subfolder, under the plugins/ directory?

eg.

plugins/
  ecommerce/
 ... all my ecommerce related plugins ...
  cms/
 ... all my cms related plugins ...

I was not able to get cake to accept this, even by adding plugins/
ecommerce/ and plugins/cms/ as additional plugin paths in
bootstrap.php.

The only way I could get any kind of plugin grouping to work, was to
create a totally separate base_plugins/ directory, and then create
additional plugin paths to them.

eg.

base_plugins/
  ecommerce/
... all my ecommerce related plugins ...
  cms/
... all my cms related plugins ...


Has anyone been successful doing this under the main plugins
directory?

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: opening a file (xls, doc, pdf etc) through a link

2010-08-29 Thread Jeremy Burns | Class Outfit
Look at media views... http://book.cakephp.org/view/1094/Media-Views

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 29 Aug 2010, at 10:58, Tomfox Wiranata wrote:

 hi,
 
 how can i reference to file on my hdd with cake, that this file opens
 a soon as i click the link? for example on my site there will be a
 link, shown as a icon with text. if you click the link i want cake to
 open that file...
 
 how can i do that? does it work with href somehow?
 
 looking forward to your feedback. thx
 
 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


passing variables to controller function from JS

2010-08-29 Thread Tomfox Wiranata
hi,

i have this function called in my view. it is JS.

ajaxUpload(form,'processFlyer','flyer_css','img src=\'../img/icons/
loader.gif\' width=\'16\' height=\'16\' border=\'0\' /','Fehler beim
Upload');

the processFlyer is a function in my controller. how can i pass
variables with this call?

i know it works with jquery like this
$('#flyer_preview').('countattachments', {attachmentcount: count});


but not with pure JS...

big thx  :)

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


Dynamic menu based on deep relationships

2010-08-29 Thread Bryan Paddock
Hey all,

I've looked through pretty much every menu tutorial out there for cakephp
and have sat for ages to try and think up how I can achieve this but to no
avail.

I have a semi-complex database structure of establishments (restaurants,
hotels etc).

Province - Region - Suburb - Establishment

as well as

Category - Subcategory - Establishment

Now the user needs to be able to select the province from the list, have it
show the regions under that province, then the suburbs, then a list of
subcategories under that province that contain establishments. I can handle
the fetching the data (eg how to pull out the list using containable etc)
but it's the starting foundation I'm having problems figuring out. IT will
be done in ajax but the actual ajax part I could probably do myself.

I would like to have the menu also build itself from the page that the user
is on (eg the user can browse around the menu in itself but if he also goes
to the a related page (eg suburbs/view/cape-town) then the menu should know
where the user is)

I honestly can't think of even where I should start here. Building a menu is
simple in plain php with simple relationships but it's getting pretty tricky
with all the extra levels.

Does anyone have any advice on a starting point which I could work with...
I'm trying to make it extendable in the sense that I don't want to hard code
anything.

I'm starting to think it may be better off to handle the menu separately in
a menu model and update the menu on each of the related models afterSave(),
etc callback but that seems a bit unnecessary as it would just be duplicated
data.

Thanks in advance!

Bryan

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: Running sql queries in cake

2010-08-29 Thread Muthuvel Subramani
hello Walter,
actually i saved the query result variable and also included the Session
Component in the controller. Actually when  i dump the variable i get
in the view file:
var_dump('max');
in the controller:
Array1Array

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: Running sql queries in cake

2010-08-29 Thread Muthuvel Subramani
I am  Extremely sorry Walther for addressing wrongly as Walter

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: opening a file (xls, doc, pdf etc) through a link

2010-08-29 Thread Tomfox Wiranata
thx jeremy i will take a look at it...did hear from media view until
now :)

On 29 Aug., 13:26, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 Look at media views...http://book.cakephp.org/view/1094/Media-Views

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 29 Aug 2010, at 10:58, Tomfox Wiranata wrote:

  hi,

  how can i reference to file on my hdd with cake, that this file opens
  a soon as i click the link? for example on my site there will be a
  link, shown as a icon with text. if you click the link i want cake to
  open that file...

  how can i do that? does it work with href somehow?

  looking forward to your feedback. thx

  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


giving a session a name with variable value in it

2010-08-29 Thread Tomfox Wiranata
hi.

i have a variable stored in a session:

$this-Session-write('Link.Attachment.Count', $count);

this is about uploaded attachments and i want to save the path for
each attachment. lets say i want to save the 3rd attachment that was
uploaded, then i wanna have this name for my session:

$this-Session-write('Linkable.Attachment.3.path', valuexyz);

so the number is related to the 'Link.Attachment.Count value...but
how do i code this? this seems not pretty nor correct, but you get an
idea of my problem:

$this-Session-write('Linkable.Attachment.$this-Session-
read('Link.Attachment.Count').path;

thx :)

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


giving a session a name with variable value in it

2010-08-29 Thread Tomfox Wiranata
hi.

i have a variable stored in a session:

$this-Session-write('Link.Attachment.Count', $count);

this is about uploaded attachments and i want to save the path for
each attachment. lets say i want to save the 3rd attachment that was
uploaded, then i wanna have this name for my session:

$this-Session-write('Link.Attachment.3.path', valuexyz);

so the number is related to the 'Link.Attachment.Count value...but
how do i code this? this seems not pretty nor correct, but you get an
idea of my problem:

$this-Session-write('Link.Attachment.$this-Session-

read('Link.Attachment.Count').path;

thx :)

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: giving a session a name with variable value in it

2010-08-29 Thread Muthuvel Subramani
hi I want put some conditions for virtual fields.. can any one please give
the syntax ..

thank you

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


Function documentation?

2010-08-29 Thread geoB
I am trying to get started with CakePHP and am experiencing some
frustration with the documentation.  (fwiw, I am moderately well
experienced with PHP.)  For example, I was following the blog tutorial
at the CakePHP website, only trying to adapt it to the database I
intend to work with.  I learned that the index() function was
referring to an index of a table.  So I started to look for the syntax
of the index() function to no avail.  There does not appear to be a
function reference anywhere that I can find.

In general, how does one learn the syntax of a specific function?  I
hope it's not trial and error.  Please point me in the right direction
for documentation resources.

Thanks.

George

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


2 user choosing fields in view

2010-08-29 Thread Baker
Hello,

I am building a huge portal using the CakePHP and now I stumbled upon
a problem.
I want one user to send message to another. So when I click Send
Message it opens up my view file send.ctp and I write title, message
and so on. But I also need to select user to which I am sending the
message.
In messages table I have receiver_id row in which I want to put
receiver's id.
I actually need a select box when I can select from other members
except from myself. Then, when I select his username his ID is put
into receiver_id so that later that user could read that message.

I have been struggling with this for a while, so I need some help on
how to do this.

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: Function documentation?

2010-08-29 Thread j.blotus
i think you need to start again from the beginning of the manual.
index() is controller action. It gets records from the Model and sends
them to the view. It sounds like you don't really understand the way
CakePHP uses MVC. Also, the core has an extensive API  for versions
1.1, 1.2, and 1.3.

On Aug 28, 1:08 pm, geoB truckeetr...@yahoo.com wrote:
 I am trying to get started with CakePHP and am experiencing some
 frustration with the documentation.  (fwiw, I am moderately well
 experienced with PHP.)  For example, I was following the blog tutorial
 at the CakePHP website, only trying to adapt it to the database I
 intend to work with.  I learned that the index() function was
 referring to an index of a table.  So I started to look for the syntax
 of the index() function to no avail.  There does not appear to be a
 function reference anywhere that I can find.

 In general, how does one learn the syntax of a specific function?  I
 hope it's not trial and error.  Please point me in the right direction
 for documentation resources.

 Thanks.

 George

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: Function documentation?

2010-08-29 Thread geoB
I have searched Google, CakePHP Google Group, API Controller
documentation (versions 1.2, 1.3), API AppController documentation
(versions 1.2, 1.3) and have found no useful information on the
parameters used by the index method.  Search terms include index
method, index method  documentation, Index method  syntax.  I
ain't no dummy, and I don't expect to be spoon-fed.

Sure, my understanding isn't what it could be.  That's why I read the
documentation.  But reading alone does not create comprehension.
Actual use of the material to observe its effects is required as
well.  But I can't try to recreate something I cannot find
documentation on.

Perhaps a more specific reference would be useful.  I have read the
manual at least twice now, and I know I'm not ready for the exam.

g

On Aug 29, 1:18 pm, j.blotus j.blo...@gmail.com wrote:
 i think you need to start again from the beginning of the manual.
 index() is controller action. It gets records from the Model and sends
 them to the view. It sounds like you don't really understand the way
 CakePHP uses MVC. Also, the core has an extensive API  for versions
 1.1, 1.2, and 1.3.

 On Aug 28, 1:08 pm, geoB truckeetr...@yahoo.com wrote:

  I am trying to get started with CakePHP and am experiencing some
  frustration with the documentation.  (fwiw, I am moderately well
  experienced with PHP.)  For example, I was following the blog tutorial
  at the CakePHP website, only trying to adapt it to the database I
  intend to work with.  I learned that the index() function was
  referring to an index of a table.  So I started to look for the syntax
  of the index() function to no avail.  There does not appear to be a
  function reference anywhere that I can find.

  In general, how does one learn the syntax of a specific function?  I
  hope it's not trial and error.  Please point me in the right direction
  for documentation resources.

  Thanks.

  George

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


is it possible to define empty virtual fields?

2010-08-29 Thread Greg Skerman
Hi,

Wondering if its possible to define virtual fields without actually defining
what the virtual field points at?

I want to do this later on in my query via a join, but need to define the
virtual field so that pagination will work as expected.

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: Function documentation?

2010-08-29 Thread Greg Skerman
the index() method in your controllers wont have any parameters...or maybe
it will - its up to you.

Hell you don't even have to define one if you don't want to.

When someone browsers to /controller/index, it calls the index() method for
the controller, which usually contains a find call for the model associated
with the controller and sets a variable which is available in the index view
for the controller in question.

Take a look at the blog tutorial in the book - it'll show you exactly how
this works.


On Mon, Aug 30, 2010 at 10:57 AM, geoB truckeetr...@yahoo.com wrote:

 I have searched Google, CakePHP Google Group, API Controller
 documentation (versions 1.2, 1.3), API AppController documentation
 (versions 1.2, 1.3) and have found no useful information on the
 parameters used by the index method.  Search terms include index
 method, index method  documentation, Index method  syntax.  I
 ain't no dummy, and I don't expect to be spoon-fed.

 Sure, my understanding isn't what it could be.  That's why I read the
 documentation.  But reading alone does not create comprehension.
 Actual use of the material to observe its effects is required as
 well.  But I can't try to recreate something I cannot find
 documentation on.

 Perhaps a more specific reference would be useful.  I have read the
 manual at least twice now, and I know I'm not ready for the exam.

 g

 On Aug 29, 1:18 pm, j.blotus j.blo...@gmail.com wrote:
  i think you need to start again from the beginning of the manual.
  index() is controller action. It gets records from the Model and sends
  them to the view. It sounds like you don't really understand the way
  CakePHP uses MVC. Also, the core has an extensive API  for versions
  1.1, 1.2, and 1.3.
 
  On Aug 28, 1:08 pm, geoB truckeetr...@yahoo.com wrote:
 
   I am trying to get started with CakePHP and am experiencing some
   frustration with the documentation.  (fwiw, I am moderately well
   experienced with PHP.)  For example, I was following the blog tutorial
   at the CakePHP website, only trying to adapt it to the database I
   intend to work with.  I learned that the index() function was
   referring to an index of a table.  So I started to look for the syntax
   of the index() function to no avail.  There does not appear to be a
   function reference anywhere that I can find.
 
   In general, how does one learn the syntax of a specific function?  I
   hope it's not trial and error.  Please point me in the right direction
   for documentation resources.
 
   Thanks.
 
   George

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  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: Function documentation?

2010-08-29 Thread geoB
When someone browsers to /controller/index, it calls the index()
method for
the controller, which usually contains a find call for the model
associated
with the controller and sets a variable which is available in the
index view
for the controller in question. 

This is the kind of information I was looking for.  I am more of a
deductive than inductive logic person.  The use of the method in the
tutorial doesn't explain to me what it's doing there or how it is
used.  (I've not found any mention of an index() method in any
controller.  Why is that?)

Thanks immensely for clearing this up.

George

On Aug 29, 7:01 pm, Greg Skerman gsker...@gmail.com wrote:
 the index() method in your controllers wont have any parameters...or maybe
 it will - its up to you.

 Hell you don't even have to define one if you don't want to.

 When someone browsers to /controller/index, it calls the index() method for
 the controller, which usually contains a find call for the model associated
 with the controller and sets a variable which is available in the index view
 for the controller in question.

 Take a look at the blog tutorial in the book - it'll show you exactly how
 this works.

 On Mon, Aug 30, 2010 at 10:57 AM, geoB truckeetr...@yahoo.com wrote:
  I have searched Google, CakePHP Google Group, API Controller
  documentation (versions 1.2, 1.3), API AppController documentation
  (versions 1.2, 1.3) and have found no useful information on the
  parameters used by the index method.  Search terms include index
  method, index method  documentation, Index method  syntax.  I
  ain't no dummy, and I don't expect to be spoon-fed.

  Sure, my understanding isn't what it could be.  That's why I read the
  documentation.  But reading alone does not create comprehension.
  Actual use of the material to observe its effects is required as
  well.  But I can't try to recreate something I cannot find
  documentation on.

  Perhaps a more specific reference would be useful.  I have read the
  manual at least twice now, and I know I'm not ready for the exam.

  g

  On Aug 29, 1:18 pm, j.blotus j.blo...@gmail.com wrote:
   i think you need to start again from the beginning of the manual.
   index() is controller action. It gets records from the Model and sends
   them to the view. It sounds like you don't really understand the way
   CakePHP uses MVC. Also, the core has an extensive API  for versions
   1.1, 1.2, and 1.3.

   On Aug 28, 1:08 pm, geoB truckeetr...@yahoo.com wrote:

I am trying to get started with CakePHP and am experiencing some
frustration with the documentation.  (fwiw, I am moderately well
experienced with PHP.)  For example, I was following the blog tutorial
at the CakePHP website, only trying to adapt it to the database I
intend to work with.  I learned that the index() function was
referring to an index of a table.  So I started to look for the syntax
of the index() function to no avail.  There does not appear to be a
function reference anywhere that I can find.

In general, how does one learn the syntax of a specific function?  I
hope it's not trial and error.  Please point me in the right direction
for documentation resources.

Thanks.

George

  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.comcake-php%2bunsubscr...@googlegroups.comFor
   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: opening a file (xls, doc, pdf etc) through a link

2010-08-29 Thread Nilz
It will work with href.

1. Save the file within CakePHP /app/webroot/ folder.

2. Now point to that location in your href.

You should not have a problem, I hope.

On Aug 29, 2:58 pm, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 hi,

 how can i reference to file on my hdd with cake, that this file opens
 a soon as i click the link? for example on my site there will be a
 link, shown as a icon with text. if you click the link i want cake to
 open that file...

 how can i do that? does it work with href somehow?

 looking forward to your feedback. thx

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: passing variables to controller function from JS

2010-08-29 Thread Anthony
I make use of the automatic url parsing and pass my URLs in the form
controller/action/var1:value1/var2:value2/etc:etc

This provides two benefits, one you setup your actions like this:

function action_name(var1, var2) {  if your always going to submit in
the same order

or you can make use of the named variables so that order no longer
matters.

you then setup your action to not use any parameters and instead check
the named variables existence and value like this:

function action_name() {
if (!empty( $this-params['named'][var1'] ) {
   $var1 = $this-params['named'][var1'];
}
else {
 die('var1 is empty');
}



On Aug 29, 8:14 am, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 hi,

 i have this function called in my view. it is JS.

 ajaxUpload(form,'processFlyer','flyer_css','img src=\'../img/icons/
 loader.gif\' width=\'16\' height=\'16\' border=\'0\' /','Fehler beim
 Upload');

 the processFlyer is a function in my controller. how can i pass
 variables with this call?

 i know it works with jquery like this
 $('#flyer_preview').('countattachments', {attachmentcount: count});

 but not with pure JS...

 big thx  :)

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: replacing html code in my view with an included html-file`

2010-08-29 Thread Anthony
yup, then you can use that portion repeatedly.


On Aug 29, 4:55 am, Tilen Majerle tilen.maje...@gmail.com wrote:
 emmmake elements and then include it in view :D

 --
 LP,
 Tilen Majerlehttp://majerle.eu

 2010/8/29 Tomfox Wiranata tomfox.wiran...@gmail.com

  hi everyone,

  in my view i have a lot of html/php code to make a form. this makes my
  view really big. i was wondering if it is possible, to source this
  code out in a html file to include it?? makes it more transparent.

  ls that possible?

  thx a lot :)

  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.comcake-php%2bunsubscr...@googlegroups.comFor
   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: Function documentation?

2010-08-29 Thread mark_story
There is no documentation for an index() method in the API docs
because no such method exists.  Its a method you create as part of the
tutorial to handle requests for a list of posts.  Controller actions,
or controller methods are accessible by the url.  Generally these
methods are created by you the application developer.

-Mark

On Aug 29, 10:31 pm, geoB truckeetr...@yahoo.com wrote:
 When someone browsers to /controller/index, it calls the index()
 method for
 the controller, which usually contains a find call for the model
 associated
 with the controller and sets a variable which is available in the
 index view
 for the controller in question. 

 This is the kind of information I was looking for.  I am more of a
 deductive than inductive logic person.  The use of the method in the
 tutorial doesn't explain to me what it's doing there or how it is
 used.  (I've not found any mention of an index() method in any
 controller.  Why is that?)

 Thanks immensely for clearing this up.

 George

 On Aug 29, 7:01 pm, Greg Skerman gsker...@gmail.com wrote:







  the index() method in your controllers wont have any parameters...or maybe
  it will - its up to you.

  Hell you don't even have to define one if you don't want to.

  When someone browsers to /controller/index, it calls the index() method for
  the controller, which usually contains a find call for the model associated
  with the controller and sets a variable which is available in the index view
  for the controller in question.

  Take a look at the blog tutorial in the book - it'll show you exactly how
  this works.

  On Mon, Aug 30, 2010 at 10:57 AM, geoB truckeetr...@yahoo.com wrote:
   I have searched Google, CakePHP Google Group, API Controller
   documentation (versions 1.2, 1.3), API AppController documentation
   (versions 1.2, 1.3) and have found no useful information on the
   parameters used by the index method.  Search terms include index
   method, index method  documentation, Index method  syntax.  I
   ain't no dummy, and I don't expect to be spoon-fed.

   Sure, my understanding isn't what it could be.  That's why I read the
   documentation.  But reading alone does not create comprehension.
   Actual use of the material to observe its effects is required as
   well.  But I can't try to recreate something I cannot find
   documentation on.

   Perhaps a more specific reference would be useful.  I have read the
   manual at least twice now, and I know I'm not ready for the exam.

   g

   On Aug 29, 1:18 pm, j.blotus j.blo...@gmail.com wrote:
i think you need to start again from the beginning of the manual.
index() is controller action. It gets records from the Model and sends
them to the view. It sounds like you don't really understand the way
CakePHP uses MVC. Also, the core has an extensive API  for versions
1.1, 1.2, and 1.3.

On Aug 28, 1:08 pm, geoB truckeetr...@yahoo.com wrote:

 I am trying to get started with CakePHP and am experiencing some
 frustration with the documentation.  (fwiw, I am moderately well
 experienced with PHP.)  For example, I was following the blog tutorial
 at the CakePHP website, only trying to adapt it to the database I
 intend to work with.  I learned that the index() function was
 referring to an index of a table.  So I started to look for the syntax
 of the index() function to no avail.  There does not appear to be a
 function reference anywhere that I can find.

 In general, how does one learn the syntax of a specific function?  I
 hope it's not trial and error.  Please point me in the right direction
 for documentation resources.

 Thanks.

 George

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.comcake-php%2bunsubscr...@googlegroups.c
omFor 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: Function documentation?

2010-08-29 Thread Anthony
The documentation covers this but you REALLY gotta read into it

These two pages are vital to getting cake IMO.

http://book.cakephp.org/view/890/Understanding-Model-View-Controller
http://book.cakephp.org/view/901/CakePHP-Conventions

Once these two really begin sinking in these two pages will likely
become your next best source of info:

http://book.cakephp.org/view/1039/Associations-Linking-Models-Together
http://book.cakephp.org/view/1017/Retrieving-Your-Data

I'm with you in that some of the documentation is lacking on examples
on doing things the cake way but really good on the technical side
once you figure out the cake way.

FWIW, I've been building a site in my spare time but have restructured
everything twice because I find something new in cake that makes most
of what I've already done redundant.  IE: not making use of elements
or not understanding how bad-ass contain is, or realizing that
ultimately I have the control and the index, view, delete, add
functions that the tutorial goes on about aren't really important, its
all in the naming, keying and structuring.


On Aug 29, 9:31 pm, geoB truckeetr...@yahoo.com wrote:
 When someone browsers to /controller/index, it calls the index()
 method for
 the controller, which usually contains a find call for the model
 associated
 with the controller and sets a variable which is available in the
 index view
 for the controller in question. 

 This is the kind of information I was looking for.  I am more of a
 deductive than inductive logic person.  The use of the method in the
 tutorial doesn't explain to me what it's doing there or how it is
 used.  (I've not found any mention of an index() method in any
 controller.  Why is that?)

 Thanks immensely for clearing this up.

 George

 On Aug 29, 7:01 pm, Greg Skerman gsker...@gmail.com wrote:

  the index() method in your controllers wont have any parameters...or maybe
  it will - its up to you.

  Hell you don't even have to define one if you don't want to.

  When someone browsers to /controller/index, it calls the index() method for
  the controller, which usually contains a find call for the model associated
  with the controller and sets a variable which is available in the index view
  for the controller in question.

  Take a look at the blog tutorial in the book - it'll show you exactly how
  this works.

  On Mon, Aug 30, 2010 at 10:57 AM, geoB truckeetr...@yahoo.com wrote:
   I have searched Google, CakePHP Google Group, API Controller
   documentation (versions 1.2, 1.3), API AppController documentation
   (versions 1.2, 1.3) and have found no useful information on the
   parameters used by the index method.  Search terms include index
   method, index method  documentation, Index method  syntax.  I
   ain't no dummy, and I don't expect to be spoon-fed.

   Sure, my understanding isn't what it could be.  That's why I read the
   documentation.  But reading alone does not create comprehension.
   Actual use of the material to observe its effects is required as
   well.  But I can't try to recreate something I cannot find
   documentation on.

   Perhaps a more specific reference would be useful.  I have read the
   manual at least twice now, and I know I'm not ready for the exam.

   g

   On Aug 29, 1:18 pm, j.blotus j.blo...@gmail.com wrote:
i think you need to start again from the beginning of the manual.
index() is controller action. It gets records from the Model and sends
them to the view. It sounds like you don't really understand the way
CakePHP uses MVC. Also, the core has an extensive API  for versions
1.1, 1.2, and 1.3.

On Aug 28, 1:08 pm, geoB truckeetr...@yahoo.com wrote:

 I am trying to get started with CakePHP and am experiencing some
 frustration with the documentation.  (fwiw, I am moderately well
 experienced with PHP.)  For example, I was following the blog tutorial
 at the CakePHP website, only trying to adapt it to the database I
 intend to work with.  I learned that the index() function was
 referring to an index of a table.  So I started to look for the syntax
 of the index() function to no avail.  There does not appear to be a
 function reference anywhere that I can find.

 In general, how does one learn the syntax of a specific function?  I
 hope it's not trial and error.  Please point me in the right direction
 for documentation resources.

 Thanks.

 George

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.comcake-php%2bunsubscr...@googlegroups.comFor
more options, visit this group at
  http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site 

Re: Function documentation?

2010-08-29 Thread Anthony
The documentation covers this but you REALLY gotta read into it

These two pages are vital to getting cake IMO.

http://book.cakephp.org/view/890/Understanding-Model-View-Controller
http://book.cakephp.org/view/901/CakePHP-Conventions

Once these two really begin sinking in these two pages will likely
become your next best source of info:

http://book.cakephp.org/view/1039/Associations-Linking-Models-Together
http://book.cakephp.org/view/1017/Retrieving-Your-Data

I'm with you in that some of the documentation is lacking on examples
on doing things the cake way but really good on the technical side
once you figure out the cake way.

FWIW, I've been building a site in my spare time but have restructured
everything twice because I find something new in cake that makes most
of what I've already done redundant.  IE: not making use of elements
or not understanding how bad-ass contain is, or realizing that
ultimately I have the control and the index, view, delete, add
functions that the tutorial goes on about aren't really important, its
all in the naming, keying and structuring.


On Aug 29, 9:31 pm, geoB truckeetr...@yahoo.com wrote:
 When someone browsers to /controller/index, it calls the index()
 method for
 the controller, which usually contains a find call for the model
 associated
 with the controller and sets a variable which is available in the
 index view
 for the controller in question. 

 This is the kind of information I was looking for.  I am more of a
 deductive than inductive logic person.  The use of the method in the
 tutorial doesn't explain to me what it's doing there or how it is
 used.  (I've not found any mention of an index() method in any
 controller.  Why is that?)

 Thanks immensely for clearing this up.

 George

 On Aug 29, 7:01 pm, Greg Skerman gsker...@gmail.com wrote:

  the index() method in your controllers wont have any parameters...or maybe
  it will - its up to you.

  Hell you don't even have to define one if you don't want to.

  When someone browsers to /controller/index, it calls the index() method for
  the controller, which usually contains a find call for the model associated
  with the controller and sets a variable which is available in the index view
  for the controller in question.

  Take a look at the blog tutorial in the book - it'll show you exactly how
  this works.

  On Mon, Aug 30, 2010 at 10:57 AM, geoB truckeetr...@yahoo.com wrote:
   I have searched Google, CakePHP Google Group, API Controller
   documentation (versions 1.2, 1.3), API AppController documentation
   (versions 1.2, 1.3) and have found no useful information on the
   parameters used by the index method.  Search terms include index
   method, index method  documentation, Index method  syntax.  I
   ain't no dummy, and I don't expect to be spoon-fed.

   Sure, my understanding isn't what it could be.  That's why I read the
   documentation.  But reading alone does not create comprehension.
   Actual use of the material to observe its effects is required as
   well.  But I can't try to recreate something I cannot find
   documentation on.

   Perhaps a more specific reference would be useful.  I have read the
   manual at least twice now, and I know I'm not ready for the exam.

   g

   On Aug 29, 1:18 pm, j.blotus j.blo...@gmail.com wrote:
i think you need to start again from the beginning of the manual.
index() is controller action. It gets records from the Model and sends
them to the view. It sounds like you don't really understand the way
CakePHP uses MVC. Also, the core has an extensive API  for versions
1.1, 1.2, and 1.3.

On Aug 28, 1:08 pm, geoB truckeetr...@yahoo.com wrote:

 I am trying to get started with CakePHP and am experiencing some
 frustration with the documentation.  (fwiw, I am moderately well
 experienced with PHP.)  For example, I was following the blog tutorial
 at the CakePHP website, only trying to adapt it to the database I
 intend to work with.  I learned that the index() function was
 referring to an index of a table.  So I started to look for the syntax
 of the index() function to no avail.  There does not appear to be a
 function reference anywhere that I can find.

 In general, how does one learn the syntax of a specific function?  I
 hope it's not trial and error.  Please point me in the right direction
 for documentation resources.

 Thanks.

 George

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.comcake-php%2bunsubscr...@googlegroups.comFor
more options, visit this group at
  http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site 

Re: 2 user choosing fields in view

2010-08-29 Thread Sam
Something along the lines of

In controller:
$recievers = $this-User-find('list', array('conditions' =
array('User.id NOT' = $this-Auth-User('id';
$this-set('recievers', $recievers);

in view:
echo $html-input('reciever_id');

On Aug 29, 5:23 am, Baker prjan...@gmail.com wrote:
 Hello,

 I am building a huge portal using the CakePHP and now I stumbled upon
 a problem.
 I want one user to send message to another. So when I click Send
 Message it opens up my view file send.ctp and I write title, message
 and so on. But I also need to select user to which I am sending the
 message.
 In messages table I have receiver_id row in which I want to put
 receiver's id.
 I actually need a select box when I can select from other members
 except from myself. Then, when I select his username his ID is put
 into receiver_id so that later that user could read that message.

 I have been struggling with this for a while, so I need some help on
 how to do this.

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: Dynamic menu based on deep relationships

2010-08-29 Thread Sam
I think I know what you want but I'm not sure... let me know if I'm
close.

I'd do it one of two ways

1) User selects a province, page refreshes and now there are two
dropdown boxes, first one has province selected, in the second user
chooses region(and so forth)
2) User selects a province, select box appears with regions in that
province(and so on and so forth)

For method 1 I'd have the javascript submit the page each time a
dropdown is changed- then the controller can figure out which menu
items to load for the next select box. If several select boxes have
been chosen, such as province, region and suburb, and province is
changed, then the form would basically reset to only show the province
and region select boxes.

For method 2 I'd either use ajax to query the database based on the
change in any of the select boxes, and reload the values in the select
boxes. When the last select is chosen it loads the proper view.

As for the menu knowing where the user is, simply set the relevant
fields(province_id, region_id, suburb_id and establishment_id) based
on the data that is loaded... if you load a suburb it should be
relatively easy to get the region_id and province_id for that suburb.

On Aug 29, 10:59 am, Bryan Paddock bryanpadd...@gmail.com wrote:
 Hey all,

 I've looked through pretty much every menu tutorial out there for cakephp
 and have sat for ages to try and think up how I can achieve this but to no
 avail.

 I have a semi-complex database structure of establishments (restaurants,
 hotels etc).

 Province - Region - Suburb - Establishment

 as well as

 Category - Subcategory - Establishment

 Now the user needs to be able to select the province from the list, have it
 show the regions under that province, then the suburbs, then a list of
 subcategories under that province that contain establishments. I can handle
 the fetching the data (eg how to pull out the list using containable etc)
 but it's the starting foundation I'm having problems figuring out. IT will
 be done in ajax but the actual ajax part I could probably do myself.

 I would like to have the menu also build itself from the page that the user
 is on (eg the user can browse around the menu in itself but if he also goes
 to the a related page (eg suburbs/view/cape-town) then the menu should know
 where the user is)

 I honestly can't think of even where I should start here. Building a menu is
 simple in plain php with simple relationships but it's getting pretty tricky
 with all the extra levels.

 Does anyone have any advice on a starting point which I could work with...
 I'm trying to make it extendable in the sense that I don't want to hard code
 anything.

 I'm starting to think it may be better off to handle the menu separately in
 a menu model and update the menu on each of the related models afterSave(),
 etc callback but that seems a bit unnecessary as it would just be duplicated
 data.

 Thanks in advance!

 Bryan

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: 2 user choosing fields in view

2010-08-29 Thread Jeremy Burns | Class Outfit
Just a thought...if your site is a HUGE portal, won't this select list become a 
little HUGE too?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 30 Aug 2010, at 05:41, Sam wrote:

 Something along the lines of
 
 In controller:
 $recievers = $this-User-find('list', array('conditions' =
 array('User.id NOT' = $this-Auth-User('id';
 $this-set('recievers', $recievers);
 
 in view:
 echo $html-input('reciever_id');
 
 On Aug 29, 5:23 am, Baker prjan...@gmail.com wrote:
 Hello,
 
 I am building a huge portal using the CakePHP and now I stumbled upon
 a problem.
 I want one user to send message to another. So when I click Send
 Message it opens up my view file send.ctp and I write title, message
 and so on. But I also need to select user to which I am sending the
 message.
 In messages table I have receiver_id row in which I want to put
 receiver's id.
 I actually need a select box when I can select from other members
 except from myself. Then, when I select his username his ID is put
 into receiver_id so that later that user could read that message.
 
 I have been struggling with this for a while, so I need some help on
 how to do this.
 
 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