help on naming url and routing

2010-04-23 Thread sooraj francis
hi all,

can any one just me out to solve the following problem..

i have done an application named xyz. inside that i have named the
correspoding controller name and actions. for example

http://localhost/xyz/admin/login for administrator login. now the
problem is that i have change the url to the following way

http://localhost/asd/xyz/admin/login...is this possible?

another one doubt on error routing in case user provides an
invalid link http://localhost/asd/xyz/abc/sdasd..
it should be redirected to

http://localhost/unauthorised/xyz/errorpage.

how i can do this? should i have to change any routing or .htacss
file.

thanks



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: doing complex sql using query or find? outpit with tablecell()?

2010-04-23 Thread WebbedIT
My main tip: Stop trying to force your own model names and fieldnames
and use cakes conventions, makes life a whole lot easier!

Why are you joining Meal/meals when you're not pulling any fields from
it, or have you missed out some fields?

If you were conforming to Cake's conventions you would run the
following (I have included an echo debug at the bottom so you can see
the way the data array is structured which tells you how to access the
data in your view.):

$this-data = $this-BookingPosition-find('all', array(
  'fields' = array(
'DISTINCT BookingPosition.anreise_datum',
'BookingPosition.abreise_datum',
'Request.name',
'Request.anzahl_erwachsene',
'Request.anzahl_jugendliche',
'Request.anzahl_kinder',
'Request.meal_0_id', // for scalability I would replace these with
a hasMany association
'Request.meal_1_id', // for scalability I would replace these with
a hasMany association
'Request.meal_2_id', // for scalability I would replace these with
a hasMany association
'Booking.name',
'Lodging.zimmernummer',
'CONCAT (CS.name, ': ', CS.Firma, ': ', CS.Vorname, ', ',
CS.Nachname) AS kunde'
  ),
  'order' = array('BookingPosition.anreise_datum')
));
echo debug($this-data);

HTH

Paul

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: How to display form submitted data without using model and with model in the same controller

2010-04-23 Thread WebbedIT
For values that are to be saved to the database it is good practice to
name your form fields as Model.field_name, makes life a whole lot
easier in the long run, and you would access this in the controller as
$this-data['Model']['field_name'];

As for extra fields which are not to be saved to the table you can
still name them as Model.field_name and the model will ignore them if
they do not exist in the table, you can even apply validation rules to
them within the model, but the model will not try to save this data.

Main thing is when having problems with the structure of $this-data
is to use echo debug($this-data);

HTH

Paul

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


wordpress integration without seperate url

2010-04-23 Thread meximex
hi,
i would like to include wordpress into my cakephp application but i
dont want it to be on a seperate url like /blog.

reasons for that are that the users looses his session inside the
site, looses the usermenu (i know i could do that by ajax..)

isnt there a way to just include the blog files?


btw. i am looking for a forum that can be included very easy
too... ;-)

regards,
mex

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: 'multiple' validation rule

2010-04-23 Thread WebbedIT
Thanks for that, always felt I should generate a ticket, but have
never done so before and seen so many tickets be rejected for not
being structured correctly etc that I kept putting it off.

Would have deflated me even more to go to the trouble of doing so with
test cases etc to just be told there are workarounds so we're not
resolving it at present.

However, to date I think this is my only beef with the core and the
dev team so they remain in my eyes demi-gods for producing such an
excellent open-source framework!!!

Paul

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: $html-css() is giving the wrong path

2010-04-23 Thread WebbedIT
.htaccess rewrite rules negate the need for webroot to be included in
any path to files in the CakePHP app.

Bare in mind that these same rules also divert /app/controller/action
through an index file in your /app/webroot folder with variables that
allow Cake to then fetch and process the right Controller, Action and
View.

HTH

Paul.

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: Where to draw the line?

2010-04-23 Thread Sam Sherlock
@Ed

which is quick and easier to make changes to?

a) a mixture of mainly html tags and a scattering of php vars
with occasional conditionals?

b) using cake's html helper to make the same page

my editor color codes HTML in my cake views.

it turned out to be quite the project to code the entire layout that way


 the file size nearly tripled


 the two points suggest option b is between based solely on ease
of maintenance ; even though the others are reason enough

@Jeremy - why para, div and tag exist

I often make and test static html versions of the site using variational css
(etc) whilst building the site I like to be able to move chunks to my views
with minimal effort

views are for light php var output within html marked cake templates
(ctp) vars are sent to the view ready for output with little/no extra
manipulation - some use of conditionals

helpers assist in keeping views light, if you needing to put larger chunks
of code in views I feel that moving the code to a helper (with little effort
it can become something reusable)

models are better fat and controllers skinny - this is the counter part for
views/helpers

building a string and returning that from helper methods gets complicated
and I find the html helper methods 'helpful' in such cases

to me thats better MVC

- S



On 23 April 2010 01:22, Ed Propsner crotchf...@gmail.com wrote:

 as never any doubt that I would ultimately take a hit somewhere ... how
 much of one was really the question. I agree that in a sense you are adding
 an extra step but that's not entirely accurate either. I would think to
 avoid that extra step the page would need to be straight html and that's
 it. Your first php tag adds the extra step regardless of what the output is.
 So now I would think that it would hold true for the flip side of the coin
 as well ... think of it as saving an extra step. If you know part of the
 page is going to have to be processed through the server anyhow why no

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: $html-css() is giving the wrong path

2010-04-23 Thread Psyber Netik
so if webroot doesn't need to be included... how do I make it so the css
is actually working? As far as I can tell, the reference in the page
isn't working. I haven't worked with .htaccess files at all; aside from
the basic security access.

Psyber Netik
psyber.ne...@gmail.com




smime.p7s
Description: S/MIME Cryptographic Signature


Re: saveAll() with $fieldList problem

2010-04-23 Thread marco.rizze...@gmail.com
I try this :

$this-ModelA-saveAll($this-
data,array('fieldList'=array('ModelA.field_name','ModelB.field_name')));

But it doesn't work (I use cakephp 1.2)

On 21 Apr, 15:45, Jeremy Burns jeremybu...@me.com wrote:
 Prefix all of your fields with the model name (it's good practice everywhere 
 really). So ModelA.field_name, ModelB.field_name etc.

 Jeremy Burns
 jeremybu...@me.com
 On 21 Apr 2010, at 14:40, marco.rizze...@gmail.com wrote:

  I want use Model-saveAll() with fieldList to avoid to save some
  field
  My problem is that I have in the related model two fields with the
  same name but one field (of first model (ModelA) ) should be saved and
  the other (of second model(ModelB)) shouldn't be save.
  How do I set the fieldList in  saveAll to save the field of ModelA and
  not save the ifield of ModelB
  Many Thanks

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


Re: Where to draw the line?

2010-04-23 Thread AD7six


On Apr 23, 10:24 am, Sam Sherlock sam.sherl...@gmail.com wrote:
 @Ed

Would you write your static pages - with cake? from your description -
you would (?).

For contrast/discussion this is the style I write (or more accurately
bake):
http://github.com/AD7six/time/blob/master/views/updates/multi_edit.ctp

I can't stand this style:
...
div id=?php echo ($something)?$something:''; ? class=?php echo
empty($anotherBlankAttribute)?'':'moist'; ? etc.
But even that has a (limited) use if it's clear to do so and the html
structure doesn't change. e.g.
http://github.com/AD7six/time/blob/master/views/layouts/default.ctp

it's also appropriate to do:

?php if (test): ?
 div
  pSomething vaguely static
  ... etc.
?php else: ?
 div
  pSomething not appropriate to build with php logic
  ... etc.
?php endif: ?

There's nothing wrong IMO putting echo 'tag'; ... echo '/tag';
inside your php code block if the sole reason to 'leave' is to
generate the tag and return/continue php logic.

In conclusion - You find a happy medium, and change your mind whenever
you find your choice was wrong for the direction your coding is
going ;).

Hth,

AD

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


Correct places to insert authentication code

2010-04-23 Thread Bryan Paddock
Hey guys,

I'm having some difficulties with my authentication code. I'm wondering if
anyone can point me in the right direction.

I have 3 routes set. admin / adminjudge / judge.

admin + adminjudge are hardcoded logins as they will never change and use
the User model to authenticate.
judge uses the Judge model.

I have the judge working nicely and it uses the Judge model alright.

But something is a bit awol in my beforeFilter and isAuthorized etc code.

Where is the best place to put the code for my login process?

Upon logging in I need to ensure that I have set the correct layout (each
route uses its own layout) and I need to redirect the user to the correct
place upon login.

Where should it all go? At the moment I have very messy code in the
beforeFilter and isAuthorized but I'm not 100% clued up on where it should
all go.

Could someone shed some light on the situation?

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


How can u write the order and unorder list

2010-04-23 Thread chandrasekhar reddy
Hi friends i am new to cake php. sorry for asking simple queries also

how to write order and unordered list cakephp .

i my coding they are mentioned  like this. I don`tknow how to write in cake
php ?
 can any one plz help me. thats is more help for me.


*My Store Groups*



   - *Admin Store Group http://192.168.1.155/zapop/index.php#*

  *Branch Code**Store Name**Store Type**Division*
  - 9644AlbertonFamily StoreGauteng Division
  - 3741BethlehemSupermarketNorthern Cape and O.F.S Division
  - 2543BluffSupermarketNatal Division


   - *Gauteng Division http://192.168.1.155/zapop/index.php#*

  *Branch Code**Store Name**Store Type**Division*
  - 9644AlbertonFamily StoreGauteng Division
  - 5436Germiston Family StoreFamily StoreGauteng Division


   - *Group http://192.168.1.155/zapop/index.php#*

  *Branch Code**Store Name**Store Type**Division*
  - 9644AlbertonFamily StoreGauteng Division
  - 5436Germiston Family StoreFamily StoreGauteng Division
  - 9283UitenhageSupermarketEastern Cape Division


   - *My Group http://192.168.1.155/zapop/index.php#*

  *Branch Code**Store Name**Store Type**Division*
  - 9989Boston Family Store ( Family store )Family StoreWestern Cape
  Division
  - 2663Brackenfell Family StoreFamily StoreWestern Cape Division
  - 5552La LuciaSupermarketNatal Division


   - *rakesh http://192.168.1.155/zapop/index.php#*

  *Branch Code**Store Name**Store Type**Division*
  - 9644AlbertonFamily StoreGauteng Division
   -

thank you very much.

regards,
chandu.

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: saveAll troubles

2010-04-23 Thread cricket
On Apr 22, 6:42 pm, Lucca Mordente luccamorde...@gmail.com wrote:
 To use 'validate'=false as you are, disables the validation!

Sorry, I should have mentioned that disabling validation was just
something I was trying to see if that was the problem. The data is not
saved either way.

 So, this way, saveAll will always return 1

That doesn't make any sense to me. I don't think the method should
return true if the save does not occur, regardless of whether
validation is disabled or not.

I'm using 1.2.6, btw. Bad me for not specifying that.

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


How to attach model association belongsTo on the fly?

2010-04-23 Thread Ziki
How to attach model association belongsTo on the fly? I ama developing
plugin so I need that, to attach somewhere in my component.

Help 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: Checking multiple columns for duplication checking in model

2010-04-23 Thread euromark
i am afraid you are wrong about that, john
(if i understand you right)

my method checks if a set of given data already exists in the db - and
if so, return a duplicate content error (if you add the appropriate
text message)
and instead of only one pair as the core function this can check on
multiple dependencies as well
just as swanny asked


On 23 Apr., 07:26, John Andersen j.andersen...@gmail.com wrote:
 Sorry Andy,
 It is just that your stripped down version doesn't show that :) I
 stand corrected!
 Enjoy,
    John

 On Apr 23, 12:55 am, Andy Dirnberger andy.dirnber...@gmail.com
 wrote: My example does not compare field1 and field2 for uniqueness against
  each other, it compares field1 and field2 against the database. When
  creating a new record, it will check that the combination of
  field1+field2 doesn't already exist in the database. When updating a
  record it will check that the combination of field1+field2 doesn't
  exist in the database unless the primary key of the submitted data
  matches the primary key of the record in the database.

 [snip]

 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


Re: Correct places to insert authentication code

2010-04-23 Thread cricket
On Apr 23, 5:56 am, Bryan Paddock bryanpadd...@gmail.com wrote:
 Hey guys,

 I'm having some difficulties with my authentication code. I'm wondering if
 anyone can point me in the right direction.

 I have 3 routes set. admin / adminjudge / judge.

 admin + adminjudge are hardcoded logins as they will never change and use
 the User model to authenticate.
 judge uses the Judge model.

 I have the judge working nicely and it uses the Judge model alright.

 But something is a bit awol in my beforeFilter and isAuthorized etc code.

 Where is the best place to put the code for my login process?

 Upon logging in I need to ensure that I have set the correct layout (each
 route uses its own layout) and I need to redirect the user to the correct
 place upon login.

 Where should it all go? At the moment I have very messy code in the
 beforeFilter and isAuthorized but I'm not 100% clued up on where it should
 all go.

 Could someone shed some light on the situation?

My inclination would be to use User for all of them.

In AppController::beforeFilter():

$this-Auth-autoRedirect = false;

Then, set the layout based on type of User. Upon login, this will
still be default.

In your login() method, set redirect based on the type of User.
Because you're redirecting, AppController::beforeFilter() will run
again, and the layout will then be changed.

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: $this-something

2010-04-23 Thread cricket
On Apr 22, 11:47 pm, Ed Propsner crotchf...@gmail.com wrote:
 Okay, dumb question ...

 Can someone explain the difference between :

 [code]  $this-Html-something  [/code]

 and

 [code]  $html-something  [/code]

 OOP is a bit of a new road for me.

 $html-something works fine most everywhere for me but for some reason
 my custom helpers will only place nice with $this-Html-something.

I believe the difference is that you're calling it both from within
the View and your Helper. Helpers can have their own Helpers. In any
case, I think that 1.3 also has some changes in this regard.

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: ACL and Auth -- Who's logged in and what group are they in?

2010-04-23 Thread cricket
On Apr 22, 7:02 pm, paws_galuten jason.galu...@gmail.com wrote:
 It is very difficult to understand, but I'm finally getting ACL and
 Auth working in my app. I have a User model and a Group model (pretty
 much copied from the Cookbook). I have figured out a few things but
 there are still things that are not clear. Here's what I know:

 In order to allow public access to a specific action I can use 
 $this-Auth-allowedActions = array('actionName'); in the beforeFilter.

 Then, if I want specific permissions I can set those with an entry in
 the aros_acos table which references the aco and aro tables by id.
 That works great if I'm just restricting and granting access to entire
 actions. But what if I want to check who's logged in and do things a
 little differently (display different links, etc.) depending upon what
 group they belong to?

 Here's where I get a bit confused. First of all, if I do the shell
 command cake acl view aro I get this:

   [1]Group.1

     [4]User.1

     [5]User.2

   [2]Group.2

   [3]Group.3

 So, I'm not seeing the names of the groups or the names of the users
 and it's hard to figure out what's what.
 When I do this in the view:

 ? debug($session-read('Auth')); ?

 I get this:

 Array
 (
     [User] = Array
         (
             [id] = 1
             [username] = jason
             [group_id] = 1
         )

 )

 I don't get any group info... How is this supposed to work?

Auth holds onto just the User data. But you can store some other info
in the session upon login. See this recent thread:

http://groups.google.com/group/cake-php/browse_thread/thread/9bb8720feb0750b0

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: saveAll troubles

2010-04-23 Thread Lucca Mordente
Check if any error occurs on database level.
In debug output, see if there is a 'rollback'. If so, make sure all
queries that should be executed on saveAll are there. If they are, try
to execute the transaction directly on database and make sure that it
works fine.
I had an experience with an error on database level which has not
invalidated the saveAll.

On Friday, April 23, 2010, cricket zijn.digi...@gmail.com wrote:
 On Apr 22, 6:42 pm, Lucca Mordente luccamorde...@gmail.com wrote:
 To use 'validate'=false as you are, disables the validation!

 Sorry, I should have mentioned that disabling validation was just
 something I was trying to see if that was the problem. The data is not
 saved either way.

 So, this way, saveAll will always return 1

 That doesn't make any sense to me. I don't think the method should
 return true if the save does not occur, regardless of whether
 validation is disabled or not.

 I'm using 1.2.6, btw. Bad me for not specifying that.

 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


-- 
Lucca Mordente

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: postgres tree behavior

2010-04-23 Thread cricket
On Apr 21, 4:12 pm, Chris Turner ctismyusern...@gmail.com wrote:
 Hello -

 I'm new to cake, and am attempting to prototype an application for
 evaluation,
 using postgres as the backend.

 I'm trying to create a business products catalog using the 'Tree'
 behaviour, and
 currently the 'moveup()'/'movedown()' features are not working

 (although it appears that setting the parent directly is)

 I'm using the cake docs themselves along with this tutorial:

 http://bvirtual.nl/2009/11/easy-trees-with-tree-behavior-in.html

 (of course I adapted the schema to match the pg standard mapping)

 I don't mind debugging this a bit - but I'm not quite sure where to
 start -
 basically, it seems to me like the 'lft' and 'rght' values are not
 being set
 properly, which makes the moveup/movedown calls fail, but I'm not
 100% sure as I can't find anything suggesting what algorithm these
 should be.

Are you certain that the values are correct to begin with? I know that
I flubbed that at first.


 I guess my questions are:
 - any pointers as to the state of pg w/cake

Check the the new 1.2.7 release. There are several PG-related fixes in
the changelog.

http://groups.google.com/group/cake-php/browse_thread/thread/3ab39f1de4e3d1a5#

 - anyone looking at this particular problem / usage (Tree+pg)
 - any pointers to documenting tree algorithms

 I'll likely setup a mysql db to cross-test against.. but thought I'd
 ask here
 first..

It may be worthwhile to test it with MySQL to be sure the trouble is
with PG.

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: saveAll troubles

2010-04-23 Thread cricket
On Apr 23, 7:03 am, Lucca Mordente luccamorde...@gmail.com wrote:
 Check if any error occurs on database level.
 In debug output, see if there is a 'rollback'. If so, make sure all
 queries that should be executed on saveAll are there. If they are, try
 to execute the transaction directly on database and make sure that it
 works fine.
 I had an experience with an error on database level which has not
 invalidated the saveAll.

Good idea. If I place a die(debug($this-data)); just after the call
to saveAll() I see only START TRANSACTION followed by COMMIT.
There's nothing else of any consequence in the logs.

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: saveAll troubles

2010-04-23 Thread cricket
On Apr 23, 7:30 am, cricket zijn.digi...@gmail.com wrote:
 On Apr 23, 7:03 am, Lucca Mordente luccamorde...@gmail.com wrote:

  Check if any error occurs on database level.
  In debug output, see if there is a 'rollback'. If so, make sure all
  queries that should be executed on saveAll are there. If they are, try
  to execute the transaction directly on database and make sure that it
  works fine.
  I had an experience with an error on database level which has not
  invalidated the saveAll.

 Good idea. If I place a die(debug($this-data)); just after the call
 to saveAll() I see only START TRANSACTION followed by COMMIT.
 There's nothing else of any consequence in the logs.

BTW, $this-ElectionVote-validationErrors is also empty.

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: saveAll troubles

2010-04-23 Thread cricket
Solved. The holdup was this line in Model::saveAll()

if (Set::numeric(array_keys($data))) {

So I needed to be saving like:

$this-ElectionVote-saveAll($this-data['ElectionVote'])

And, indeed, the Cookbook's example is:

$this-Article-saveAll($data['Article']);

It all makes perfect sense to do it this way but it's a damned easy
thing to miss.

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: Checking multiple columns for duplication checking in model

2010-04-23 Thread John Andersen
I again stand corrected :)
You are right!

My main concern was that the database already can provide this check
for duplicate records, so why code it!

Anyway, if Swanny is happy, then who am I to complain :D
Enjoy,
   John

On Apr 23, 1:49 pm, euromark dereurom...@googlemail.com wrote:
 i am afraid you are wrong about that, john
 (if i understand you right)

 my method checks if a set of given data already exists in the db - and
 if so, return a duplicate content error (if you add the appropriate
 text message)
 and instead of only one pair as the core function this can check on
 multiple dependencies as well
 just as swanny asked

 On 23 Apr., 07:26, John Andersen j.andersen...@gmail.com wrote:


[snip]

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


ajax+jquery with cake

2010-04-23 Thread MANOJ DHAMAL
I m new with cake. i m usung jquery and ajax both with cake . when i
include prototype.js in project then jquery not works . Any solution
for that.
   thanks.

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


jquery tooltip

2010-04-23 Thread priya dhakane
i want to display dynamic content in tooltip taken from database how
to access database field details for each image.and how to display
tooltip using jquery.

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


cake/VERSION.txt

2010-04-23 Thread Leonel Quinteros
Hey guys, in the 1.2.7 release, the file cake/VERSION.txt still says
1.2.6.

Regards

Leonel Quinteros

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


making changed to app_controller in cake folder

2010-04-23 Thread shardul
Hi all,

Want to chack weather is it ok to make the changes to
app_controller in cake folder. Does it affect in case of upgrade , is
it consider as a good practice or bad? Is there any other alternative
to this?

shardul

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


facebook connect issue

2010-04-23 Thread devilinc
i integrated a facebook connect(from google search) with my cakephp
site(which i am developing from scratch)...
my issue in detail
once the facebook connect is clicked a pop-up window opens...i login
with my facebook credentialsi get logged into my website, i.e.
correct login after authentication occurs but in the pop-up window
onlyi am expecting the child window to close and my parent window
to show my website after login... is it something to do with facebook
application settings or changes to the plugin code?

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


CakePHP 1.2.6 - problem with displaying form error messages

2010-04-23 Thread Anna P
Hello all.
I have a problem with displaying error messages after form validation.

Model user.php:

  var $validate = array(
'fname' = array(
  'rule' = array('custom','/^[A-Za-z\ ]{2,30}$/'),
  'message' = 'Supply real first name',
  'allowEmpty' = false,
),
'lname' = array(
  'rule' = array('custom','/^[A-Za-z\ ]{2,40}$/'),
  'message' = 'Supply real last name',
  'allowEmpty' = false,
),
  );

In controller, I use $this-User-set($this-data) and $this-User-
validates() to validate inputs.
If form hasn't been filled correcty $this-validateErrors($this-User)
returns invalid fields.

The problem is, error message, with the use of:
$form-error('fname')   or   $form-error('lname')
is not displaying.

Model is validated correctly (it returns information that fname or
lname are not correctly filled, it even creates div class=error-
message/div div for both fields. But there is no message in the
div.
When I type:
$form-error('fname','Supply real first name')
error message is displayed.

But I don't want to put error messages in the view. I rather want to
hold it in model's $validate variable.

What do I do wrong? Or maybe it's some king of bug in 1.2.6?

Many thanks in advance:)

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: making changed to app_controller in cake folder

2010-04-23 Thread cricket
On Apr 23, 4:56 am, shardul mohite.shar...@gmail.com wrote:
 Hi all,

     Want to chack weather is it ok to make the changes to
 app_controller in cake folder. Does it affect in case of upgrade , is
 it consider as a good practice or bad? Is there any other alternative
 to this?

Copy the file to your app folder. The same goes for app_model.php and
app_helper.php (if desired).

Note that they should be in app/ not controllers, models, etc.

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: ajax+jquery with cake

2010-04-23 Thread cricket
On Apr 23, 2:00 am, MANOJ DHAMAL manoj.dham...@gmail.com wrote:
 I m new with cake. i m usung jquery and ajax both with cake . when i
 include prototype.js in project then jquery not works . Any solution
 for that.

Don't use prototype?

OK, see here:

http://docs.jquery.com/Using_jQuery_with_Other_Libraries

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: jquery tooltip

2010-04-23 Thread cricket
On Apr 23, 2:09 am, priya dhakane priya.dhak...@gmail.com wrote:
 i want to display dynamic content in tooltip taken from database how
 to access database field details for each image.and how to display
 tooltip using jquery.

You might need to provide more information. What does the database
table look like? If you're fetching data for several images to display
already, did you fetch the other data (the data you want to show in
the tooltip)?

This really seems more like a jQuery question than specific to
CakePHP. Are you already using a specific tooltip plugin? There a
several, I think.

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: cake/VERSION.txt

2010-04-23 Thread cricket
On Apr 23, 8:41 am, Leonel Quinteros leonel.quinte...@gmail.com
wrote:
 Hey guys, in the 1.2.7 release, the file cake/VERSION.txt still says
 1.2.6.

This seems to happen often. One would think it would be automated.
Anyway, I have no idea if it's important.

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


ajax+jquery with cake

2010-04-23 Thread MANOJ DHAMAL
Hi All,
I ma first time working on project in cakephp . I m using ajax and jquery
both in project. When i include prototype.js for ajax it affects to jquery,
jquery not works . Any solution for this?

Thanks.

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: ajax+jquery with cake

2010-04-23 Thread Annamalai
give jQuery.noConflict();   in jquey file and then try
it will works

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: Where to draw the line?

2010-04-23 Thread Ed Propsner
@AD7six

If the page was truly static then no, I suppose there would be no need to
write an entire page with Cake, what would be the point?

The use of all Cake tags was entirely experimental (curiosity) and I find
nothing at all wrong with echo 'tag';  echo '/tag';
 I don't really consider that leaving or jumping out of PHP ... your
example however I would consider as such (which by the way makes me cringe
to even look at):

div id=?php echo ($something)?$something:''; ? class=?php echo
empty($anotherBlankAttribute)?'':'moist'; ? etc.

I've had my more than lazy moments in the past but to me that is just way
too messy. Who would want to try and manage and entire site full of that? It
makes my head hurt just thinking about it. To me it looks someone threw a
bunch of code into a box, shook it up, and presto ... LOL, I'll have to coin
that one shake and bake  8-)

I will say that by using all cake tags on the page resulted in much more
uniform and fluid code which brings to the table it's own set of benefits.
Having said that it didn't have to be all cake either .. straight HTML, XML,
Js ... all would have worked out just as well so long as it don't end up
looking like shake and bake. 8-)

- Ed

On Fri, Apr 23, 2010 at 5:46 AM, AD7six andydawso...@gmail.com wrote:



 On Apr 23, 10:24 am, Sam Sherlock sam.sherl...@gmail.com wrote:
  @Ed

 Would you write your static pages - with cake? from your description -
 you would (?).

 For contrast/discussion this is the style I write (or more accurately
 bake):
 http://github.com/AD7six/time/blob/master/views/updates/multi_edit.ctp

 I can't stand this style:
 ...
 div id=?php echo ($something)?$something:''; ? class=?php echo
 empty($anotherBlankAttribute)?'':'moist'; ? etc.
 But even that has a (limited) use if it's clear to do so and the html
 structure doesn't change. e.g.
 http://github.com/AD7six/time/blob/master/views/layouts/default.ctp

 it's also appropriate to do:

 ?php if (test): ?
  div
  pSomething vaguely static
  ... etc.
 ?php else: ?
  div
  pSomething not appropriate to build with php logic
  ... etc.
 ?php endif: ?

 There's nothing wrong IMO putting echo 'tag'; ... echo '/tag';
 inside your php code block if the sole reason to 'leave' is to
 generate the tag and return/continue php logic.

 In conclusion - You find a happy medium, and change your mind whenever
 you find your choice was wrong for the direction your coding is
 going ;).

 Hth,

 AD

 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: Where to draw the line?

2010-04-23 Thread Jamie
You should also consider who else will be looking at your view files.
I'm guessing that advocates of the HTML helper-only approach don't
need to hand their view files to other people who will be writing/
changing/styling the HTML. At my company, I do the bulk of the PHP
work, write basic HTML views (in static HTML), and then hand the view
files over to the designers so that they can style them for individual
websites. They're not CakePHP experts or even PHP experts, so giving
them a page full of PHP and saying trust me, that's HTML wouldn't go
over very well. If only one person will ever be maintaining the code
and you're sure that one person knows all about the HTML helper, then
sure.  But otherwise, if a few different hands (and not all of them
PHP-expert hands) will be playing with the HTML, I think writing it
'manually' is the better approach.

And maybe it's just because I learned HTML before PHP, but AD7six's
example looks very counter-intuitive to me. I like seeing HTML as
HTML, I find it hard to visualize a page when all the tags are
generated by helper functions. Being able to see the tags with proper
indentation helps me visualize the structure of the page, hunt down
and layout bugs, etc.

- Jamie

On Apr 23, 6:24 am, Ed Propsner crotchf...@gmail.com wrote:
 @AD7six

 If the page was truly static then no, I suppose there would be no need to
 write an entire page with Cake, what would be the point?

 The use of all Cake tags was entirely experimental (curiosity) and I find
 nothing at all wrong with echo 'tag';  echo '/tag';
  I don't really consider that leaving or jumping out of PHP ... your
 example however I would consider as such (which by the way makes me cringe
 to even look at):

 div id=?php echo ($something)?$something:''; ? class=?php echo
 empty($anotherBlankAttribute)?'':'moist'; ? etc.

 I've had my more than lazy moments in the past but to me that is just way
 too messy. Who would want to try and manage and entire site full of that? It
 makes my head hurt just thinking about it. To me it looks someone threw a
 bunch of code into a box, shook it up, and presto ... LOL, I'll have to coin
 that one shake and bake  8-)

 I will say that by using all cake tags on the page resulted in much more
 uniform and fluid code which brings to the table it's own set of benefits.
 Having said that it didn't have to be all cake either .. straight HTML, XML,
 Js ... all would have worked out just as well so long as it don't end up
 looking like shake and bake. 8-)

 - Ed





 On Fri, Apr 23, 2010 at 5:46 AM, AD7six andydawso...@gmail.com wrote:

  On Apr 23, 10:24 am, Sam Sherlock sam.sherl...@gmail.com wrote:
   @Ed

  Would you write your static pages - with cake? from your description -
  you would (?).

  For contrast/discussion this is the style I write (or more accurately
  bake):
 http://github.com/AD7six/time/blob/master/views/updates/multi_edit.ctp

  I can't stand this style:
  ...
  div id=?php echo ($something)?$something:''; ? class=?php echo
  empty($anotherBlankAttribute)?'':'moist'; ? etc.
  But even that has a (limited) use if it's clear to do so and the html
  structure doesn't change. e.g.
 http://github.com/AD7six/time/blob/master/views/layouts/default.ctp

  it's also appropriate to do:

  ?php if (test): ?
   div
   pSomething vaguely static
   ... etc.
  ?php else: ?
   div
   pSomething not appropriate to build with php logic
   ... etc.
  ?php endif: ?

  There's nothing wrong IMO putting echo 'tag'; ... echo '/tag';
  inside your php code block if the sole reason to 'leave' is to
  generate the tag and return/continue php logic.

  In conclusion - You find a happy medium, and change your mind whenever
  you find your choice was wrong for the direction your coding is
  going ;).

  Hth,

  AD

  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.c 
  omFor more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

 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 

Re: How to add a view with no controller and no model?

2010-04-23 Thread piousbox
Yeah, you don't have to write SQL as you can use the regular $this-
Model-findAll() methods. Reference: 
http://book.cakephp.org/view/73/Retrieving-Your-Data
But, I found for myself that writing sql syntax is sometimes easier.
Now, it looks like you want to have models. You need the views too,
and you definitely need a controller. So, your question is really how
to do it, not how to avoid using controllers and models, as far as I
understand. If you post here all the relevant code to output the
reports, we'll help you fix the errors and whatnot.

There is a ton of information in the book (http://book.cakephp.org/)
that can help you out. Basically you need to create models for your
database, request information from the models and pass it to the view
(or to a helper function, which John Andersen calls element), and
then print that data. It's pretty easy. Start writing it and ask
specific questions here.

-Victor



On Apr 22, 7:08 am, mivogt-LU c...@mivogt.net wrote:
 To generate somer report data I want to execute a short sql command to
 collect some data and hand it over as array to the html-table helper
 to be displayed.

 sql code is
 SELECT
 BP.AnreiseDatum, BP.AbreiseDatum, BS.name, LS.Zimmernummer,
 concat(CS.name,': ',CS.Firma,': ', CS.Vorname,', ', CS.Nachname)
 FROM `booking_positions` as BP, `bookings` as BS , lodgings as LS,
 customers as CS
 WHERE bs.id = bp.`booking_id` AND `lodging_id`=LS.id  AND
 `customer_id`=CS.id

 is there a better way to solve this using the find()?

 How do I need to do the views manually (as the bake shell will not be
 of use as far as I understood...)

 Thanks in advance

 Michael

 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


Rendering text from a controller action?

2010-04-23 Thread Thomas Allen
In a given action, how can I manually render text? I'm thinking of an
analog to render :text in Rails.

Thomas

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: $html-css() is giving the wrong path

2010-04-23 Thread piousbox
From http://book.cakephp.org/view/206/Inserting-Well-Formatted-elements
This: ?php echo $html-css('forms'); ?
Gives you this: link rel=stylesheet type=text/css href=/css/
forms.css /
The file is here: /app/webroot/css/forms.css where /app/ is /nh/ in
your case.

You can try messing with defined constants in /nh/webroot/index.php
and figure out where your webroot actually is. Or, you can post more
information here: the exact PHP line you use to include that CSS file,
the line from the source file that has the link / element, and the
directory tree of your /nh/ and /nh/webroot/

cheers,
-Victor

On Apr 22, 1:23 am, Psyber Netik psyber.ne...@gmail.com wrote:
 You guys probably answered a ton of these already... but, I just can't
 find the post...

 As the subject says... The path that is being given is wrong. Would I
 have to edit the helper?

 The path that is being used is /nh/css/cake.generic.css it should
 actually be /nh/webroot/css/cake.generic.css right? In the nh
 directory I don't have a css folder. nh is the name of the app. In
 my apache webroot I have the following:

 bitslip:/srv/www/htdocs # ls -l
 total 8
 drwxrwxr-x  5 root root 4096 2010-04-14 22:10 cakephp
 -rw-r--r--  1 root root    0 2010-04-21 18:27 index.php
 drwxr-xr-x 12 root root 4096 2010-04-21 20:02 nh

 In the nh folder I used the `cake bake` command which generated all
 the files I needed.

 Please help this noob!!!

 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


Re: Where to draw the line?

2010-04-23 Thread Ed Propsner
I'll admit that with a layout defined almost solely by divs and using the
html helper
the lack of indents had me a tiny bit lost in the code but it didn't take
long to get used to.

There obviously is no right or wrong answer ... it all comes down to
personal preference,
however as in your case if I was handing my code over to someone else for
further
completion/manipulation I would do things much differently.

- Ed

On Fri, Apr 23, 2010 at 10:35 AM, Jamie jamie@gmail.com wrote:

 You should also consider who else will be looking at your view files.
 I'm guessing that advocates of the HTML helper-only approach don't
 need to hand their view files to other people who will be writing/
 changing/styling the HTML. At my company, I do the bulk of the PHP
 work, write basic HTML views (in static HTML), and then hand the view
 files over to the designers so that they can style them for individual
 websites. They're not CakePHP experts or even PHP experts, so giving
 them a page full of PHP and saying trust me, that's HTML wouldn't go
 over very well. If only one person will ever be maintaining the code
 and you're sure that one person knows all about the HTML helper, then
 sure.  But otherwise, if a few different hands (and not all of them
 PHP-expert hands) will be playing with the HTML, I think writing it
 'manually' is the better approach.

 And maybe it's just because I learned HTML before PHP, but AD7six's
 example looks very counter-intuitive to me. I like seeing HTML as
 HTML, I find it hard to visualize a page when all the tags are
 generated by helper functions. Being able to see the tags with proper
 indentation helps me visualize the structure of the page, hunt down
 and layout bugs, etc.

 - Jamie

 On Apr 23, 6:24 am, Ed Propsner crotchf...@gmail.com wrote:
  @AD7six
 
  If the page was truly static then no, I suppose there would be no need to
  write an entire page with Cake, what would be the point?
 
  The use of all Cake tags was entirely experimental (curiosity) and I find
  nothing at all wrong with echo 'tag';  echo '/tag';
   I don't really consider that leaving or jumping out of PHP ... your
  example however I would consider as such (which by the way makes me
 cringe
  to even look at):
 
  div id=?php echo ($something)?$something:''; ? class=?php echo
  empty($anotherBlankAttribute)?'':'moist'; ? etc.
 
  I've had my more than lazy moments in the past but to me that is just way
  too messy. Who would want to try and manage and entire site full of that?
 It
  makes my head hurt just thinking about it. To me it looks someone threw a
  bunch of code into a box, shook it up, and presto ... LOL, I'll have to
 coin
  that one shake and bake  8-)
 
  I will say that by using all cake tags on the page resulted in much more
  uniform and fluid code which brings to the table it's own set of
 benefits.
  Having said that it didn't have to be all cake either .. straight HTML,
 XML,
  Js ... all would have worked out just as well so long as it don't end up
  looking like shake and bake. 8-)
 
  - Ed
 
 
 
 
 
  On Fri, Apr 23, 2010 at 5:46 AM, AD7six andydawso...@gmail.com wrote:
 
   On Apr 23, 10:24 am, Sam Sherlock sam.sherl...@gmail.com wrote:
@Ed
 
   Would you write your static pages - with cake? from your description -
   you would (?).
 
   For contrast/discussion this is the style I write (or more accurately
   bake):
  http://github.com/AD7six/time/blob/master/views/updates/multi_edit.ctp
 
   I can't stand this style:
   ...
   div id=?php echo ($something)?$something:''; ? class=?php echo
   empty($anotherBlankAttribute)?'':'moist'; ? etc.
   But even that has a (limited) use if it's clear to do so and the html
   structure doesn't change. e.g.
  http://github.com/AD7six/time/blob/master/views/layouts/default.ctp
 
   it's also appropriate to do:
 
   ?php if (test): ?
div
pSomething vaguely static
... etc.
   ?php else: ?
div
pSomething not appropriate to build with php logic
... etc.
   ?php endif: ?
 
   There's nothing wrong IMO putting echo 'tag'; ... echo '/tag';
   inside your php code block if the sole reason to 'leave' is to
   generate the tag and return/continue php logic.
 
   In conclusion - You find a happy medium, and change your mind whenever
   you find your choice was wrong for the direction your coding is
   going ;).
 
   Hth,
 
   AD
 
   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.com
 cake-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 sitehttp://cakeqs.organd help 

Re: WorldPay component

2010-04-23 Thread piousbox
If you googled it and didn't find it, perhaps it's not there. The good
news is that you can write the component/helper yourself. CakePHP
rests on top of PHP, that means anything you can do in PHP is doable
in cakePHP. So, what you need to do is either to include the WorldPay
into your application using require_once() or include_once() or
something like that, or as an alternative, you can write your own
component/helper that wraps around WorldPay, and then include that
component/helper.

-Victor

On Apr 22, 7:25 am, Alex Bovey a...@bovey.co.uk wrote:
 Hi all,

 Does anyone know of a WorldPay component available for CakePHP?  All
 I've really found is bakepay which doesn't seem to be complete:

 http://cakeforge.org/projects/bakepay/

 Thanks all,

 Alex

 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


Re: XML

2010-04-23 Thread Jeremy Burns
Third time of pinging - no-one fancy a crack at this please?

Jeremy Burns
jeremybu...@me.com
On 23 Apr 2010, at 05:52, Jeremy Burns wrote:

 Any takers please? Do I need to add an option to my createElement statement? 
 What am I doing wrong?
 
 Jeremy Burns
 jeremybu...@me.com
 
 
 On 22 Apr 2010, at 15:21, Jeremy Burns wrote:
 
 I am trying to produce an XML file ($results is an array of data):
 
 code
  App::import('Xml');
 
  $xml = new Xml();
 
  $xml-createElement('records', null, array(), 'namespace');
  $xml-addNamespace('namespace', 'http://www.namespace.com');
  $record = $xml-createElement('record', null, array('Id' = 1));
 
  foreach($results as $result):
  $row = $xml-createElement('record', null, array('value' =
 $result['value'], 'name' = $result['name']));
  endforeach;
 
  echo $xml;
 /code
 
 The output is almost right, except each new node or element is always
 appended to the previous node, so I have way too many nests. I have
 tried setParent and append, but those commands are ignored.
 
 Here's the output as it stands:
 
 namespace:records xmlns:namespace=http://www.namespace.com;
  record id=1
  record value=0 name=Some value
  record value=1 name=Some other value
  record value=0 name=Yet another value
  etc...
 
 You might notice that the record nodes are not being closed off. I
 have tried all sorts of things to get this working, but to no avail.
 
 Here's what I'm looking for:
 
 namespace:records xmlns:namespace=http://www.namespace.com;
  record id=1
  record value=0 name=Some value /
  record value=1 name=Some other value /
  record value=0 name=Yet another value /
  etc...
  /record
 /namespace:records
 
 In addition, how do I get the headers set (?xml version=1.0
 encoding=UTF-8?)?
 
 Can anyone help please? This is driving me nuts.
 
 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

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: $html-css() is giving the wrong path

2010-04-23 Thread Ed Propsner
I really don't know if it would make a difference but I use [code]
$html-css(array('forms')); [/code]
Then again I'm using more than one style sheet.

- Ed

On Fri, Apr 23, 2010 at 10:54 AM, piousbox pious...@gmail.com wrote:

 From http://book.cakephp.org/view/206/Inserting-Well-Formatted-elements
 This: ?php echo $html-css('forms'); ?
 Gives you this: link rel=stylesheet type=text/css href=/css/
 forms.css /
 The file is here: /app/webroot/css/forms.css where /app/ is /nh/ in
 your case.

 You can try messing with defined constants in /nh/webroot/index.php
 and figure out where your webroot actually is. Or, you can post more
 information here: the exact PHP line you use to include that CSS file,
 the line from the source file that has the link / element, and the
 directory tree of your /nh/ and /nh/webroot/

 cheers,
 -Victor

 On Apr 22, 1:23 am, Psyber Netik psyber.ne...@gmail.com wrote:
  You guys probably answered a ton of these already... but, I just can't
  find the post...
 
  As the subject says... The path that is being given is wrong. Would I
  have to edit the helper?
 
  The path that is being used is /nh/css/cake.generic.css it should
  actually be /nh/webroot/css/cake.generic.css right? In the nh
  directory I don't have a css folder. nh is the name of the app. In
  my apache webroot I have the following:
 
  bitslip:/srv/www/htdocs # ls -l
  total 8
  drwxrwxr-x  5 root root 4096 2010-04-14 22:10 cakephp
  -rw-r--r--  1 root root0 2010-04-21 18:27 index.php
  drwxr-xr-x 12 root root 4096 2010-04-21 20:02 nh
 
  In the nh folder I used the `cake bake` command which generated all
  the files I needed.
 
  Please help this noob!!!
 
  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 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.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


Making DB connection on-demand

2010-04-23 Thread thisk
Hi!

I have a CakePHP application that serves a website and serves as a
datasource for an AJAX application.

Due to the large amount of ajax requests, I had a lot of database
connections so I decided to cache everything using memcache.

This all works fine, but now I have database connections that execute
only one query: SET NAMES utf8. I guess because cake - by default -
connects to the database even though in the case of the ajax requests
I don't even use the DB.

Is there a way to tell Cake not to try to connect to the database by
default (but only when I use the ajax call)?

Regards,
thisk

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: ACL and Auth -- Who's logged in and what group are they in?

2010-04-23 Thread paws_galuten
Great, that helps a lot. I still don't understand why when I do cake
acl view aco I get just group.id etc and in most examples online
people get more detailed info. Should I be using an alias instead of a
group model? What's the difference?

Basically, I just want to have 3 types of users and depending upon the
type, there should be different things happening on a specific page.
It's fine to limit the actions using ACL but more importantly (for the
user interface) is to have links to the actions only appear when a
user from the correct group is logged in.

I'm sure a million people have asked this so thanks for your patience
and please direct me to any older posts that may have answered this. I
just don't know what to search for!

Thanks,
Jason

On Apr 23, 3:58 am, cricket zijn.digi...@gmail.com wrote:
 On Apr 22, 7:02 pm, paws_galuten jason.galu...@gmail.com wrote:





  It is very difficult to understand, but I'm finally getting ACL and
  Auth working in my app. I have a User model and a Group model (pretty
  much copied from the Cookbook). I have figured out a few things but
  there are still things that are not clear. Here's what I know:

  In order to allow public access to a specific action I can use 
  $this-Auth-allowedActions = array('actionName'); in the beforeFilter.

  Then, if I want specific permissions I can set those with an entry in
  the aros_acos table which references the aco and aro tables by id.
  That works great if I'm just restricting and granting access to entire
  actions. But what if I want to check who's logged in and do things a
  little differently (display different links, etc.) depending upon what
  group they belong to?

  Here's where I get a bit confused. First of all, if I do the shell
  command cake acl view aro I get this:

    [1]Group.1

      [4]User.1

      [5]User.2

    [2]Group.2

    [3]Group.3

  So, I'm not seeing the names of the groups or the names of the users
  and it's hard to figure out what's what.
  When I do this in the view:

  ? debug($session-read('Auth')); ?

  I get this:

  Array
  (
      [User] = Array
          (
              [id] = 1
              [username] = jason
              [group_id] = 1
          )

  )

  I don't get any group info... How is this supposed to work?

 Auth holds onto just the User data. But you can store some other info
 in the session upon login. See this recent thread:

 http://groups.google.com/group/cake-php/browse_thread/thread/9bb8720f...

 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


Re: XML

2010-04-23 Thread Nabil Alsharif
Instead of calling $xml-createElement try doing
$node = $xml-createNode(...);
$xml-append($node);
inside of your for loop.

On Thu, 2010-04-22 at 07:21 -0700, Jeremy Burns wrote:
 I am trying to produce an XML file ($results is an array of data):
 
 code
   App::import('Xml');
 
   $xml = new Xml();
 
   $xml-createElement('records', null, array(), 'namespace');
   $xml-addNamespace('namespace', 'http://www.namespace.com');
   $record = $xml-createElement('record', null, array('Id' = 1));
 
   foreach($results as $result):
   $row = $xml-createElement('record', null, array('value' =
 $result['value'], 'name' = $result['name']));
   endforeach;
 
   echo $xml;
 /code
 
 The output is almost right, except each new node or element is always
 appended to the previous node, so I have way too many nests. I have
 tried setParent and append, but those commands are ignored.
 
 Here's the output as it stands:
 
 namespace:records xmlns:namespace=http://www.namespace.com;
   record id=1
   record value=0 name=Some value
   record value=1 name=Some other value
   record value=0 name=Yet another value
   etc...
 
 You might notice that the record nodes are not being closed off. I
 have tried all sorts of things to get this working, but to no avail.
 
 Here's what I'm looking for:
 
 namespace:records xmlns:namespace=http://www.namespace.com;
   record id=1
   record value=0 name=Some value /
   record value=1 name=Some other value /
   record value=0 name=Yet another value /
   etc...
   /record
 /namespace:records
 
 In addition, how do I get the headers set (?xml version=1.0
 encoding=UTF-8?)?
 
 Can anyone help please? This is driving me nuts.
 
 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


User creation issue.

2010-04-23 Thread mau
Hi everybody!

 I'm trying to build a user control panel for administrators, to add
users, modify, give permissions, etc.

 My problem is that when I try to save a new user to the user tables,
it seems that cake is login the new user.

 Is there any way to avoid that cakePHP, when I save a new user to the
users table, not login the new user?

 Thanks in advance

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


Auto-datetime fields (created_at and updated_at) and $scaffold

2010-04-23 Thread Thomas Allen
In the scaffold create and edit views, I am presented with datetime
inputs for both Created at and Updated at. Is this an indication
that I have done something wrong? I thought that the values for these
fields were handled internally.

Here is the bare-bones table:

create table templates (
  id int(11) unsigned not null auto_increment,
  created_at datetime not null,
  updated_at datetime not null,

  name varchar(255) not null,

  primary key (id)
);

Here is the model:

class Template extends AppModel {
  var $name = 'Template';
  var $displayField = 'name';
  var $validate = array(
'id' = array(
  'blank' = array(
'rule' = array('blank'),
'on' = 'create'
  )
),

'name' = array(
  'notempty' = array(
'rule' = array('notempty')
  )
)
  );
}

And finally, the controller:

class TemplatesController extends AppController {
  var $name = 'Templates';
  var $scaffold;
}


Thomas

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


Tree structure: Invalid SQL generated for self-joining table

2010-04-23 Thread Thomas Allen
Hello,

I have some data that must be stored in a tree structure. Here is the
SQL used to create that data's table:

drop table if exists fields;
create table fields (
  id int(11) unsigned not null auto_increment,
  created_at datetime not null,
  updated_at datetime not null,

  template_id int(11) unsigned not null,
  field_id int(11) unsigned,
  type varchar(255) not null,
  name varchar(255) not null,
  label varchar(255) not null,
  required tinyint(1) default 0,
  weight tinyint(1) default 0,

  primary key (id)
);

I baked a model and a scaffold controller for this data using `cake
bake` but the SQL generated from this model is faulty. Specifically,
the following is invalid as the same name Field is aliased twice:

SELECT COUNT(*) AS `count` FROM `fields` AS `Field` LEFT JOIN
`templates` AS `Template` ON (`Field`.`template_id` = `Template`.`id`)
LEFT JOIN `fields` AS `Field` ON (`Field`.`field_id` = `Field`.`id`)
WHERE 1 = 1;

Here are the model relationships that are generating this SQL:

?php
class Field extends AppModel {
  var $name = 'Field';
  var $displayField = 'name';

  // Validations omitted

  var $belongsTo = array(
'Template' = array(
  'className' = 'Template',
  'foreignKey' = 'template_id',
  'conditions' = '',
  'fields' = '',
  'order' = ''
),
'Field' = array(
  'className' = 'Field',
  'foreignKey' = 'field_id',
  'conditions' = '',
  'fields' = '',
  'order' = ''
)
  );

  var $hasMany = array(
'Field' = array(
  'className' = 'Field',
  'foreignKey' = 'field_id',
  'dependent' = false,
  'conditions' = '',
  'fields' = '',
  'order' = '',
  'limit' = '',
  'offset' = '',
  'exclusive' = '',
  'finderQuery' = '',
  'counterQuery' = ''
)
  );

}

Does anyone know what I can do so that there is no duplicate alias on
the self-join?

Thanks,
Thomas

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: doing complex sql using query or find? outpit with tablecell()?

2010-04-23 Thread mivogt-LU
Hello Paul,

yes THIS REALLY HELPS.
Now I start to _understand_ how to use the find() like I used to do
sql :) thanks a lot.

To comment your suggestion about habtm on meals:
Each request means a customer will arrive having ordered a firstMeal
on arrivalDay meal1
Each request means a customer will leave having ordered a lastMeal on
leavingDay meal2
Each request means a customer will stay having ordered a KindofMeal
during he stays meal0
with meal means breakfast, full  board or half board, ...

so I did
(*crippled code!!*)
class Request extends AppModel {
var $hasOne = array('Booking' = array(
var $belongsTo = array( 'Customer' 'Meal0' 'Meal1' 'Meal2'
'Occasion' (
var $hasAndBelongsToMany = array( 'Material' 'Room'

instead of a habtm

... thanks for suggesting a better way to do, but no scale need this
for :)

btw: just discoverd a great tool on cake: visualize to draw diagram of
databse-model works fantastic!
http://bakery.cakephp.org/articles/view/visualize-schema-task
http://www.assembla.com/code/mi/subversion/nodes/branches/base/vendors/shells/visualize.php
http://pastebin.com/f78f99e58
http://www.graphviz.org/About.php

Thanks and HTH ^|^

Michael
On 23 Apr., 09:08, WebbedIT p...@webbedit.co.uk wrote:
 My main tip: Stop trying to force your own model names and fieldnames
 and use cakes conventions, makes life a whole lot easier!

 Why are you joining Meal/meals when you're not pulling any fields from
 it, or have you missed out some fields?

 If you were conforming to Cake's conventions you would run the
 following (I have included an echo debug at the bottom so you can see
 the way the data array is structured which tells you how to access the
 data in your view.):

 $this-data = $this-BookingPosition-find('all', array(
   'fields' = array(
     'DISTINCT BookingPosition.anreise_datum',
     'BookingPosition.abreise_datum',
     'Request.name',
     'Request.anzahl_erwachsene',
     'Request.anzahl_jugendliche',
     'Request.anzahl_kinder',
     'Request.meal_0_id', // for scalability I would replace these with
 a hasMany association
     'Request.meal_1_id', // for scalability I would replace these with
 a hasMany association
     'Request.meal_2_id', // for scalability I would replace these with
 a hasMany association
     'Booking.name',
     'Lodging.zimmernummer',
     'CONCAT (CS.name, ': ', CS.Firma, ': ', CS.Vorname, ', ',
 CS.Nachname) AS kunde'
   ),
   'order' = array('BookingPosition.anreise_datum')
 ));
 echo debug($this-data);

 HTH

 Paul

 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


Re: doing complex sql using query or find? outpit with tablecell()?

2010-04-23 Thread mivogt-LU


On 23 Apr., 09:08, WebbedIT p...@webbedit.co.uk wrote:
 My main tip: Stop trying to force your own model names and fieldnames
 and use cakes conventions, makes life a whole lot easier!

 Why are you joining Meal/meals when you're not pulling any fields from
 it, or have you missed out some fields?


Oh I _would like_ to show up the a field out of the meals model.
Just did not know how to get e golden bridge from request.meal0_id
towards refering meal[id][name]

If you might help me again with this it would be a great step forward
to me, as then I can do most I think of by doing sql till now.

tnx, cu

Michael

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: Auto-datetime fields (created_at and updated_at) and $scaffold

2010-04-23 Thread euromark
they are
if you call them created and modified

see the cookbook for details


On 23 Apr., 22:09, Thomas Allen thomasmal...@gmail.com wrote:
 In the scaffold create and edit views, I am presented with datetime
 inputs for both Created at and Updated at. Is this an indication
 that I have done something wrong? I thought that the values for these
 fields were handled internally.

 Here is the bare-bones table:

 create table templates (
   id int(11) unsigned not null auto_increment,
   created_at datetime not null,
   updated_at datetime not null,

   name varchar(255) not null,

   primary key (id)
 );

 Here is the model:

 class Template extends AppModel {
   var $name = 'Template';
   var $displayField = 'name';
   var $validate = array(
     'id' = array(
       'blank' = array(
         'rule' = array('blank'),
         'on' = 'create'
       )
     ),

     'name' = array(
       'notempty' = array(
         'rule' = array('notempty')
       )
     )
   );

 }

 And finally, the controller:

 class TemplatesController extends AppController {
   var $name = 'Templates';
   var $scaffold;

 }

 Thomas

 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


Serialize Form

2010-04-23 Thread Hugues
Hi,

I have a login form and want serialize login and password data before
sending it with ajax call. Is exist a tool or function or a way with
mootools ?

I don't want use https, and when I check the http request (httpfox), I
see my password in clear text on querystring.

help me to secure that hole of security.

Thanks.

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: doing complex sql using query or find? outpit with tablecell()?

2010-04-23 Thread mivogt-LU
hmpf I am sorry I need more help...
I did false-back (mean I did my wrong naming in again as I use it
current, will have to clean up all later...)

it crashes if I try to run the find()
Warning (512): SQL Error: 1054: Unknown column
'BookingPosition.AnreiseDatum' in 'field list'
I am shure field-name is correct, had a lookup on phpmyadmin
I added a recursive=2 without changing any.

Perhaps I need to add I am not using any report model as there is no
db-table reports as I get data from different tables.
I added a  var $uses =
array('Request','Booking','Customer','BookingPosition','Meal'); to
head of controller.
Also without effect.

$this-
loadModel('Request','Booking','Customer','BookingPosition','Meal');
 $this-data = $this-Request-find('all', array(
 'recursive' =  2,
  'fields' = array(
'DISTINCT BookingPosition.AnreiseDatum',
'BookingPosition.AbreiseDatum',
'Request.name',
'Request.AnzahlErwachsene',
'Request.AnzahlJugendliche',
'Request.AnzahlKinder',
'Request.meal0_id',
'Request.meal1_id',
'Request.meal2_id',
'Meal.name',
'Booking.name',
'Lodging.zimmernummer',
'CONCAT (CS.name, CS.Firma, CS.Vorname, CS.Nachname) AS
kunde'
  ),
  'order' = array('Bookingposition.anreise_datum')
));


---
How, step-by-step, do I need to go on to do different reports?
My idea is as far like this:
- create a reports_controller (how to tell wich models to be available
for find()?)
- add my own functions like report_arrivals() report_leaveres(),
report_mealstocook
- add one view per function to show the result of the functions

but

I am not sure about
how and where to set wich part of code to get and display the data.
thinking mvc the model would supply it.
But as I use many models I think I ll have to collect the data in my
controllers functions
and pass it somehow to the views to be shown (would like to use html-
tablecells to do so)

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: doing complex sql using query or find? outpit with tablecell()?

2010-04-23 Thread mivogt-LU
damn :(
the find() crashes telling unnown fields

Warning (512): SQL Error: 1054: Unknown column
'BookingPosition.AnreiseDatum' in 'field list' [CORE\cake\libs\model
\datasources\dbo_source.php, line 615]

Any idea?

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


Sometimes ACL is just too much

2010-04-23 Thread paws_galuten
I wrestled with ACL for a while, and finally decided that might be too
much for what I'm doing. I only really need a few types of users and
in that case it is simple enough just to have a field in the users
table that specifies the type (or is a foreign key to the groups
table, for example).

This way, I can just use $this-Auth-user() to find out what type of
user is logged in, and then have different things happen in the view.

Here's a question... Now that I've simplified things and am not using
ACL, I still need to restrict access to the special actions. Do I need
to manually check the user in each action and redirect if they are not
supposed to acces it?

It seems like there are two things. 1, changing the view and making
certain actions visible to special user types, and 2, actually
restricting other users form those actions in case they manually type
them into the url.

I'm just trying to do the simplest thing while sticking with cake
conventions.
Thanks for your thoughts,
Jason

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: Sometimes ACL is just too much

2010-04-23 Thread jacmoe
I am using the AuthSome component (Auth alternative) from Debuggable,
together with this:
http://josediazgonzalez.com/2010/01/11/you-want-access-well-you-no-can-has-cakephp-access-component/

Works a treat. :)

On Apr 24, 12:31 am, paws_galuten jason.galu...@gmail.com wrote:
 I wrestled with ACL for a while, and finally decided that might be too
 much for what I'm doing. I only really need a few types of users and
 in that case it is simple enough just to have a field in the users
 table that specifies the type (or is a foreign key to the groups
 table, for example).

 This way, I can just use $this-Auth-user() to find out what type of
 user is logged in, and then have different things happen in the view.

 Here's a question... Now that I've simplified things and am not using
 ACL, I still need to restrict access to the special actions. Do I need
 to manually check the user in each action and redirect if they are not
 supposed to acces it?

 It seems like there are two things. 1, changing the view and making
 certain actions visible to special user types, and 2, actually
 restricting other users form those actions in case they manually type
 them into the url.

 I'm just trying to do the simplest thing while sticking with cake
 conventions.
 Thanks for your thoughts,
 Jason

 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


Re: Where to draw the line?

2010-04-23 Thread jacmoe
That option exist because that's what you'd use in a Helper, not in
the view (ctp) files.
It's a lot clearer and faster to just write div isn't it?
Use $this-Html-div() in your helper, instead of echo 'div' (which
is horrible) IMO. :)
Each to his own, I guess, but I prefer to write static layout in HTML.

On Apr 23, 7:09 am, Jeremy Burns jeremybu...@me.com wrote:
 It begs the question why does the $this-Html-div() option exist? if it is 
 such a bad idea? And $this-Html-para(), and $this-Html-tag() and most of 
 the rest of the Html helper.

 I have taken the decision to standardise on using it throughout. I write each 
 page within ?php ? tags and don't flip out to html unless I really have to 
 (and that is very rare). It makes my development path quicker, makes cleaner 
 code and it just works. I haven't seen any noticeable performance hit on my 
 pages, especially when they are cached correctly.

 Jeremy Burns
 jeremybu...@me.com

 On 23 Apr 2010, at 01:22, Ed Propsner wrote:





  There was never any doubt that I would ultimately take a hit somewhere ... 
  how much of one was really the question. I agree that in a sense you are 
  adding an extra step but that's not entirely accurate either. I would think 
  to avoid that extra step the page would need to be straight html and 
  that's it. Your first php tag adds the extra step regardless of what the 
  output is. So now I would think that it would hold true for the flip side 
  of the coin as well ... think of it as saving an extra step. If you know 
  part of the page is going to have to be processed through the server anyhow 
  why not just start with PHP and stick with it throughout the page instead 
  of jumping back and forth from PHP to HTML?

  Yes, I totally agree that straight PHP requires a bit more overhead but I'm 
  still on the fence as far as efficiency goes.

  - Ed

  On Thu, Apr 22, 2010 at 8:02 PM, Jamie jamie@gmail.com wrote:
  I agree with Miles that you should just use static HTML wherever
  possible. It's just plain faster. If you use PHP to generate your
  HTML, then you're adding an extra step to the process: instead of just
  serving up plain HTML, the PHP parser needs to read the code,
  interpret it, figure out what to do with it, and then output the
  results. Not terribly efficient, especially if all you want is
  div.

  Like you just said, your file size nearly tripled. You can generate an
  entire website with CakePHP's helpers, sure, but you'll sure take a
  hit in the efficiency department.

  - Jamie

  On Apr 22, 4:01 pm, Ed Propsner crotchf...@gmail.com wrote:
   Yep, the entire page is full of 'em ... 8-). I was just goofing around 
   with
   it ... I wanted to see if the page could really be coded in nothing but 
   cake
   tags. In the end it turned out to be quite the project to code the entire
   layout that way (the file size nearly tripled). Why is it that you would
   suggest using all static divs? I'm contemplating putting it back the way
   that it was but I'm really not seeing the difference at this point.

   On Thu, Apr 22, 2010 at 2:05 PM, Miles J mileswjohn...@gmail.com wrote:
Wait, so your saying you used the HTMLHelper div() method to build
everything? Should just stick with static divs.

On Apr 22, 2:34 am, Sam Sherlock sam.sherl...@gmail.com wrote:
 I think its a question of clarity and ease to create maintain views

 - S

 On 22 April 2010 09:47, Ed Propsner crotchf...@gmail.com wrote:

  I'm with ya' on  consistency and jumping in and out of php. The
document
  seems to have a better flow and feel to it now that's it more 
  uniform.
If
  anything else it was good practice for someone new to Cake :)

  - Ed

  On Thu, Apr 22, 2010 at 4:35 AM, Jeremy Burns jeremybu...@me.com
wrote:

  I have asked myself this question too and posed a similar point (is
using
  Cake tags ultimately slower than straightforward html? to which the
answer
  was 'probably, yes'). However, I have adopted the Cake tag route
throughout
  because (i) it provide consistency, (ii) it means I am not jumping 
  in
and
  out of PHP and (iii) it just feels 'safer' - pass in the right 
  options
and
  out pops the right html. I guess it's a matter of choice?

  Jeremy Burns
  jeremybu...@me.com jeremybu...@mac.com

  On 22 Apr 2010, at 09:31, Ed Propsner wrote:

  Out of curiosity and perhaps a little boredom I re-scripted my
default.ctp
  to completely follow Cake conventions.
  From the doctype to the closing html tag there is not a single
  conventional html tag on the page.
  95% of my layout is structured with divs in lieu of tables so 
  there is
  quite a bit on the page as far as tags go.

  My question is this ... how much is too much? With the increase in
file
  size the pages will ultimately render slower,
  or is this of little 

RE: Serialize Form

2010-04-23 Thread Alan Asher
Mootools and many other javascript frameworks have a function called
serialize which packages up a form for transport.  And the very nature of
https is designed exactly for the reason you described.  There really aren't
any work arounds for encryption that are secure since https has a 3rd party
to share keys between your client and your server.  If you encrypt your
message at the client and send it straight to the server, then if someone
were to intercept your packages, it can be easily decrypted since they have
access to the keys.

Why can't you use https? Perhaps you can use an alternative authentication
like google auth or google accounts, I can't remember.

Alan

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Hugues
Sent: Friday, April 23, 2010 9:39 AM
To: CakePHP
Cc: yves.regis.gauth...@gmail.com
Subject: Serialize Form

Hi,

I have a login form and want serialize login and password data before
sending it with ajax call. Is exist a tool or function or a way with
mootools ?

I don't want use https, and when I check the http request (httpfox), I
see my password in clear text on querystring.

help me to secure that hole of security.

Thanks.

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


Re: ACL and Auth -- Who's logged in and what group are they in?

2010-04-23 Thread cricket
On Apr 23, 11:52 am, paws_galuten jason.galu...@gmail.com wrote:
 Great, that helps a lot. I still don't understand why when I do cake
 acl view aco I get just group.id etc and in most examples online
 people get more detailed info. Should I be using an alias instead of a
 group model? What's the difference?

Sorry, I don't know what the issue could be.

 Basically, I just want to have 3 types of users and depending upon the
 type, there should be different things happening on a specific page.
 It's fine to limit the actions using ACL but more importantly (for the
 user interface) is to have links to the actions only appear when a
 user from the correct group is logged in.

You could ditch ACL altogether and just store the Group name in the
session. Then, check that wherever you would have checked with ACL.

 I'm sure a million people have asked this so thanks for your patience
 and please direct me to any older posts that may have answered this. I
 just don't know what to search for!

I remember trying to sort out ACL awhile back and becoming completely
confused by what I was reading online. There seem to be many
permutations and what I was trying to do didn't seem to be implemented
by anyone else (record-level access). I got it to work but have no
idea if it's correct. It works, anyway.

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: Tree structure: Invalid SQL generated for self-joining table

2010-04-23 Thread cricket
On Apr 23, 4:25 pm, Thomas Allen thomasmal...@gmail.com wrote:
 Hello,

 I have some data that must be stored in a tree structure. Here is the
 SQL used to create that data's table:

 drop table if exists fields;
 create table fields (
   id int(11) unsigned not null auto_increment,
   created_at datetime not null,
   updated_at datetime not null,

   template_id int(11) unsigned not null,
   field_id int(11) unsigned,
   type varchar(255) not null,
   name varchar(255) not null,
   label varchar(255) not null,
   required tinyint(1) default 0,
   weight tinyint(1) default 0,

   primary key (id)
 );

 I baked a model and a scaffold controller for this data using `cake
 bake` but the SQL generated from this model is faulty. Specifically,
 the following is invalid as the same name Field is aliased twice:

 SELECT COUNT(*) AS `count` FROM `fields` AS `Field` LEFT JOIN
 `templates` AS `Template` ON (`Field`.`template_id` = `Template`.`id`)
 LEFT JOIN `fields` AS `Field` ON (`Field`.`field_id` = `Field`.`id`)
 WHERE 1 = 1;

 Here are the model relationships that are generating this SQL:

 ?php
 class Field extends AppModel {
   var $name = 'Field';
   var $displayField = 'name';

   // Validations omitted

   var $belongsTo = array(
     'Template' = array(
       'className' = 'Template',
       'foreignKey' = 'template_id',
       'conditions' = '',
       'fields' = '',
       'order' = ''
     ),
     'Field' = array(
       'className' = 'Field',
       'foreignKey' = 'field_id',
       'conditions' = '',
       'fields' = '',
       'order' = ''
     )
   );

   var $hasMany = array(
     'Field' = array(
       'className' = 'Field',
       'foreignKey' = 'field_id',
       'dependent' = false,
       'conditions' = '',
       'fields' = '',
       'order' = '',
       'limit' = '',
       'offset' = '',
       'exclusive' = '',
       'finderQuery' = '',
       'counterQuery' = ''
     )
   );

 }

 Does anyone know what I can do so that there is no duplicate alias on
 the self-join?

The array key is the alias, so you can name it whatever. That's why
the className key is there. It took me a while to figure that one out.
I always thought it was redundant.

 var $hasMany = array(
   'ChildField' = array(
 'className' = 'Field',
 ...
);

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: Rendering text from a controller action?

2010-04-23 Thread cricket
On Apr 23, 10:50 am, Thomas Allen thomasmal...@gmail.com wrote:
 In a given action, how can I manually render text? I'm thinking of an
 analog to render :text in Rails.

In what sense? Do you mean that you want to output plaintext headers
also? Or, just toss some text back to the browser?

controller:
$this-layout = 'text';
$this-set('the_text', 'foo');

your_text_action.ctp:
echo $the_text;

layouts/text.ctp:
echo $content_for_layout;

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: User creation issue.

2010-04-23 Thread cricket
On Apr 23, 3:47 pm, mau mauro.torr...@gmail.com wrote:
 Hi everybody!

  I'm trying to build a user control panel for administrators, to add
 users, modify, give permissions, etc.

  My problem is that when I try to save a new user to the user tables,
 it seems that cake is login the new user.

  Is there any way to avoid that cakePHP, when I save a new user to the
 users table, not login the new user?

What do you mean by, login the new user? Your administrator becomes
the new user?

How are you saving this data?

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: User creation issue.

2010-04-23 Thread Alan Asher
Ya.. totally, let's see some code.  It sounds like you're using some out of
the box code and never took out $this-Auth-login($this-data);  



-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of cricket
Sent: Friday, April 23, 2010 6:16 PM
To: CakePHP
Subject: Re: User creation issue.

On Apr 23, 3:47 pm, mau mauro.torr...@gmail.com wrote:
 Hi everybody!

  I'm trying to build a user control panel for administrators, to add
 users, modify, give permissions, etc.

  My problem is that when I try to save a new user to the user tables,
 it seems that cake is login the new user.

  Is there any way to avoid that cakePHP, when I save a new user to the
 users table, not login the new user?

What do you mean by, login the new user? Your administrator becomes
the new user?

How are you saving this data?

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


Houston!

2010-04-23 Thread mmamedov
I lived in Chicago. It is a very nice city. IF you are to do it in
summer - Chicago is the way to go [other than summer, it is very cold
there]. However, if you are planning to have it in a different season
I'd say - Houston. Not only because I live here now, but because the
weather is nice and warm here all year long, well except summers.. but
I voted for Chicago in summer anyways :p

PS: I'd looove to attend a CakePHP event, and share/learn more about
it.

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: Sometimes ACL is just too much

2010-04-23 Thread mmamedov
I am using ACL on a huge project. It does really help. I have all kind
of users and access types - access based on user groups, based on
actions, based on the company they belong to (user rights are defined
on the company user belongs to - user can only manage certain records
in the DB per Controller).

In your situation I guess you are trying to enable certain actions for
certain users. This is how I'd do it with Auth:
SomeController extends AppController {

function beforeFilter(){
   parent::beforeFilter(); //if you have defined beforeFilter in
AppController
   $this-Auth-allow('logout','login');
}
}

If you are planning enabling certain actions of ALL controllers, then
add this to your AppController's beforeFilter():
   $this-Auth-allow('logout','login','whateveraction'); //all of
these actions are enabled for all controllers


Hope this helps.



On Apr 23, 5:31 pm, paws_galuten jason.galu...@gmail.com wrote:
 I wrestled with ACL for a while, and finally decided that might be too
 much for what I'm doing. I only really need a few types of users and
 in that case it is simple enough just to have a field in the users
 table that specifies the type (or is a foreign key to the groups
 table, for example).

 This way, I can just use $this-Auth-user() to find out what type of
 user is logged in, and then have different things happen in the view.

 Here's a question... Now that I've simplified things and am not using
 ACL, I still need to restrict access to the special actions. Do I need
 to manually check the user in each action and redirect if they are not
 supposed to acces it?

 It seems like there are two things. 1, changing the view and making
 certain actions visible to special user types, and 2, actually
 restricting other users form those actions in case they manually type
 them into the url.

 I'm just trying to do the simplest thing while sticking with cake
 conventions.
 Thanks for your thoughts,
 Jason

 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


Re: making changed to app_controller in cake folder

2010-04-23 Thread mmamedov
Sometimes you just have to do it. I am using it and don't see any
problem. Of course, be aware you put there really necessary stuff,
something that is necessary to be executed by all Controllers.
Alternative way is to put custom functions into bootstrap.php, it is
later being included with every class.. but these are two different
things. Inside AppController you can have code (load components,
unload, etc..) that is to going to be executed prior to Controller's
initialization methods. It is very handy, especially if you don't want
to make endless copy-pastes in your controllers.


On Apr 23, 3:56 am, shardul mohite.shar...@gmail.com wrote:
 Hi all,

     Want to chack weather is it ok to make the changes to
 app_controller in cake folder. Does it affect in case of upgrade , is
 it consider as a good practice or bad? Is there any other alternative
 to this?

 shardul

 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


Using Non-Inline Css in Element

2010-04-23 Thread Ch3ck3r
Hi folks,

I am new to cakePHP and after two days reading I got quite far with my
current application.
Nevertheless I am stuck now.

I created an Element called 'viewer.ctp' in the elements directory.
This Element is used by my layout 'page.ctp' by using this command:

?php echo $this-element('viewer'); ?

This Element is properly shown in the layout but i have a problem with
adding CSS Non-Inline.
Inside of the viewer.ctp i got the following line

?php $html-css('viewer', null, null, false); ?

which should add the viewer.css file to my $scripts_for_layout which
is located at the top of my layout file.

But, regardless how hard I try, the css link [..] gets printed at
its own location instead of at $scripts_for_layout which remains
empty.

Would be please if anyone could help
Best regards Ch3ck3r

(CakePHP 1.2.7)

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 $session-read('Auth.Model.field') a secure?

2010-04-23 Thread andrewperk
Hello,

I have a users table with a role field. When a user logs in the cAuth
component stores that users info inside of:

$session-read('Auth.User.role')

Then inside of my view I can do something like this:

?php if ($session-read('Auth.User.role') == 'administrator'): ?
pYou are an administrator/p
?php endif; ?

I'm wondering if this kind of access control is safe or is there a way
a user could

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 $session-read('Auth.Model.field') a secure?

2010-04-23 Thread andrewperk
(I somehow hit tab+enter and submitted my post before I was finished,
I'm sorry for the double post).

Hello,

I have a users table with a role field. When a user logs in the Auth
component stores that users info inside of:

$session-read('Auth.User.role')

Then inside of my view I can do something like this:

?php if ($session-read('Auth.User.role') == 'administrator'): ?
 Give access to something only an admin should have, like an edit
button or something
?php endif; ?

I'm wondering if this kind of access control is safe or is there a way
a user could mess with this and set their session equal to
administrator? My sessions are stored in the database.

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: facebook connect issue

2010-04-23 Thread nurvzy
I think you may be talking about my plugin:
http://www.webtechnick.com/wtn/blogs/view/229/CakePHP_Facebook_Plugin_Auth_Facebook_and_more

I saw your comment regarding this issue, and am not sure how to
advise.  Unfortunately it works as advertised on my demo app
http://facebook.webtechnick.com as well as on my production site.
The login function takes in a onlogin option which can be any
function.  By default its (window.location.reload()) which is what was
suggested in the Facebook docs.

Is this a symptom in all browsers you've tested on your site or just a
single browser?   You may find better help in the actual Facebook
development forums.

http://forum.developers.facebook.com/

A few google searches has suggested to try different onlogin options
within your fbxml login tag.

I hope that helps, or at least guides you in the right direction,
Nick

On Apr 23, 3:03 am, devilinc nirmal9...@gmail.com wrote:
 i integrated a facebook connect(from google search) with my cakephp
 site(which i am developing from scratch)...
 my issue in detail
 once the facebook connect is clicked a pop-up window opens...i login
 with my facebook credentialsi get logged into my website, i.e.
 correct login after authentication occurs but in the pop-up window
 onlyi am expecting the child window to close and my parent window
 to show my website after login... is it something to do with facebook
 application settings or changes to the plugin code?

 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


jquery and cakephp

2010-04-23 Thread priya dhakane
hello,
i am new in cakephp. I want tooltip on image. but my css file not get
apply so no tooltip image get display but only text. plz suggest me
solution for that.

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: $html-css() is giving the wrong path

2010-04-23 Thread Psyber Netik
Wouldn't messing with the defined constants in /nh/webroot/index.php
only adjust it for that page? It looks like theres a lot of scaffolded
includes; in which one of them doesn't have the right path or
variable. I don't which line is bad because I don't know which file is
calling or creating the path.

Here's my directory tree:

bitslip:/srv/www/htdocs/nh # find . -type
d
.
./
controllers
./controllers/
components
./
tmp
./tmp/
sessions
./tmp/
logs
./tmp/
tests
./tmp/
cache
./tmp/cache/
persistent
./tmp/cache/
models
./tmp/cache/
views
./
models
./models/
behaviors
./models/
datasources
./
webroot
./webroot/
js
./webroot/
img
./webroot/
css
./
plugins
./
views
./views/
errors
./views/
layouts
./views/layouts/js
./views/layouts/email
./views/layouts/email/html
./views/layouts/email/text
./views/layouts/rss
./views/layouts/xml
./views/pages
./views/helpers
./views/elements
./views/elements/email
./views/elements/email/html
./views/elements/email/text
./views/scaffolds
./locale
./locale/eng
./locale/eng/LC_MESSAGES
./tests
./tests/groups
./tests/fixtures
./tests/cases
./tests/cases/controllers
./tests/cases/models
./tests/cases/helpers
./tests/cases/components
./tests/cases/behaviors
./config
./config/sql
./vendors
./vendors/shells
./vendors/shells/templates
./vendors/shells/tasks


On Apr 23, 4:54 am, piousbox pious...@gmail.com wrote:
 Fromhttp://book.cakephp.org/view/206/Inserting-Well-Formatted-elements
 This: ?php echo $html-css('forms'); ?
 Gives you this: link rel=stylesheet type=text/css href=/css/
 forms.css /
 The file is here: /app/webroot/css/forms.css where /app/ is /nh/ in
 your case.

 You can try messing with defined constants in /nh/webroot/index.php
 and figure out where your webroot actually is. Or, you can post more
 information here: the exact PHP line you use to include that CSS file,
 the line from the source file that has the link / element, and the
 directory tree of your /nh/ and /nh/webroot/

 cheers,
 -Victor

 On Apr 22, 1:23 am, Psyber Netik psyber.ne...@gmail.com wrote:



  You guys probably answered a ton of these already... but, I just can't
  find the post...

  As the subject says... The path that is being given is wrong. Would I
  have to edit the helper?

  The path that is being used is /nh/css/cake.generic.css it should
  actually be /nh/webroot/css/cake.generic.css right? In the nh
  directory I don't have a css folder. nh is the name of the app. In
  my apache webroot I have the following:

  bitslip:/srv/www/htdocs # ls -l
  total 8
  drwxrwxr-x  5 root root 4096 2010-04-14 22:10 cakephp
  -rw-r--r--  1 root root    0 2010-04-21 18:27 index.php
  drwxr-xr-x 12 root root 4096 2010-04-21 20:02 nh

  In the nh folder I used the `cake bake` command which generated all
  the files I needed.

  Please help this noob!!!

  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.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php?hl=en

 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