simple cms w/ auth :: username password only to admin console page

2009-03-27 Thread programguru


Hello,

I've been hacking at this for several days, and have modified and toyed with 
about 7 different tutorials with Auth, only to find none of them provide the 
actual answer I am looking for - or maybe I don't know what the correct answer 
is.

Anyhow.

All I have been trying to do is create:

1) A view that is user/pass protected which allows control of content for the 
site. I was able to get several login systems working with Auth, but not able 
to edit any content because the permissions are outside of the login scope or 
something of that nature.

I am certainly missing a link somewhere in all of this.

2) All controllers should be accessible from this view so the content can be 
modified.

I cannot figure out how (although I have done this a million times with 
straight php/mysql) how to make this work with CakePHP.

The problem I keep running into is the /users dir only allows access to that 
dir, but I cannot create a sub directory in there for example called: CMS, 
because then the controller classes cannot be accessed by the default core.

Anyhow, Id be glad to hear any insight in how to get a stupid simple CMS page 
setup with access to all of the sites editable content.

I don't need anyone to explain how to build a db, a controller, a model, or 
Bake... That's not what I am asking.

Just a bit lost and need some direction.

Thanks.
-- 
View this message in context: 
http://n2.nabble.com/simple-cms-w--auth-%3A%3A-username---password-only-to-admin-console-page-tp2542722p2542722.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: What's the usage of app\views\layouts\js?

2009-03-27 Thread Dr. Loboto

For the same purpose as xml, rss, email and etc.

When you want to output pure JavaScript (to be executed, for example),
you should use $this-RequestHandler-renderAs($this, 'js') in
controller. It will set appropriate content-type header and layout/
view subfolder. So Cake will look for layout for such request not in
views/layouts but in views/layouts/js. Same for views, instead of
views/controller target folder will be views/controller/js

On Mar 26, 8:35 pm, joshua josh...@gmail.com wrote:
 Did anybody know the useage of this folder?

 --
 Thanks
 Joshua
--~--~-~--~~~---~--~~
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 and Forum software

2009-03-27 Thread jbgillet

Sup all,

Basically, I would like a forum in my cake web-app. I would like users
to be able to log in as per a normal cake app (not necessarily using
cakes Auth) and then be able to go to the forum section, or do other
things that you need to be logged in to do (i.e buy stuff).

Has anyone successfully integrated phpBB with the cake Auth ?
Is there even any point in doing this ?? I only have a very small user
base (about 15 users) at the moment, so i could pretty easily move
them over the use the phpBB auth, and then try to hack the phpBB so
that i can login from my homepage, and am not automatically taken
straight to the forum.

There has to be a simpler solution. I cannot find any forum software
written for cake (am i blind? i searched the bakery and cakeForge),
but this would be the ideal solution.

Or do you think I'm better off writing a forum from scratch ??

Ideas, concerns and queries welcome.

Cheers,
John.


--~--~-~--~~~---~--~~
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 and Paginate urls

2009-03-27 Thread jmcca...@gmail.com

Hi all,

I am trying to get CakePHP Paginator helper to output links as such:

http://someurl/page/1

At the moment it outputs links like the following:

http://someurl/posts/index/page:1

I have figured out how to change the controller and remove the action
from the url. Unfortunately, I have yet to be able to figure out how
to get CakePHP to output just the page number and not 'page:1'.

Any help is greatly appreciated!

--~--~-~--~~~---~--~~
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: SQL query did not get executed for subsequent calls to requestAction

2009-03-27 Thread zonium

OK, yes it's cache. I used Modell::query() in myAction() and that was
the cause of the problem. Here is the warning I finally found in
Cookbook:

query() does not honour $Model-cachequeries as its functionality is
inherently disjoint from that of the calling model. To avoid caching
calls to query, supply a second argument of false, ie: query($query,
$cachequeries = false)

So the problem was not with requestAction().



On Mar 26, 5:24 pm, brian bally.z...@gmail.com wrote:
 cache, maybe?

 You're right, though: it's very likely that you'd be better off doing
 $this-Model1-Model2-myAction()

 On Thu, Mar 26, 2009 at 3:31 PM, zonium zon...@gmail.com wrote:

  I call requestAction('another_controller/myAction') at different
  places from a controller. What myAction() does is run a SQL query to
  get some data from DB.
  I notice that the SQL query in myAction() gets executed only the first
  time the requestAction('another_controller/myAction') is called. For
  any subsequent calls, the SQL query does not get executed, and same
  query result from the first call to requestAction() is returned.

  Why is that?

  (I know that myAction()'d better be placed in model. However I am
  trying to find out why the problem happened to requestAction as I
  described.)

  Thanks for any insight.
--~--~-~--~~~---~--~~
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 for groups

2009-03-27 Thread djiize

For nested groups, you should read this post:
http://edwardawebb.com/programming/php-programming/cakephp/nested-trees-cakephp

In ACL, I (personnaly) think it's a good idea to have a ROOT group,
even if you don't use it now, maybe later ;)

If you don't want one, a NULL value should suffice.

On 27 mar, 05:16, brian bally.z...@gmail.com wrote:
 I need to have nested groups, so the table has a parent_id column.
 But, should top-level groups have a NULL parent_id? Or would there
 have to be a ROOT group, so to speak? I'm having a real hard time
 sorting all this out.
--~--~-~--~~~---~--~~
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: Creating Post Views (Blog tutorial)

2009-03-27 Thread albe


@ programguru:

this is my posts_controller.php file, located in app/controllers


?php
class PostsController extends AppController {

var $name = 'Posts';
function index() {
$this-set('posts', $this-Post-find('all'));
}

}
?


@ Marcelo Andrade:

Yes, my httpd.conf file of Apache is set with AllowOverride All for the
Directory Directory C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs that is the location of my cakeblog directory.
No, I can't see the home page of Cake with message in colours and I DON'T
have a cakeblog/webroot folder (I only have .htaccess in cakeblog folder and
in cakeblog/app)

@ Brian:

I get the same error if I point on http://localhost/cakeblog/posts/.
-- 
View this message in context: 
http://www.nabble.com/Creating-Post-Views-%28Blog-tutorial%29-tp22727150p22738726.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: controller not being detected when view index file is in sub dir of /views

2009-03-27 Thread Dr. Loboto

You don't understand views, controllers and restrictions.

 My /users dir requires login authentication, and that is working OK. But I 
 assume any sub directory within the /users dir will also be protected, and 
 maybe this is where the problem is arising?

The root of your mistake - protected is NOT users dir but ACTIONS of
Users controller you choose to restrict for non-users. If you want to
restrict unauthorized access to some ACTION of some CONTROLLER your
should protect it by Auth. You have nothing to do with views and any
directories here, it is pure controller task.

So just move your products views to normal place (views/products) and
add Auth component to controller Products with appropriate allow/deny
calls in beforeFilter. That's all.

And more:

 why my view/sub1/sub2/filename.ctp cannot access the controller which is in 
 my /controllers dir?

By default view/sub1/sub2/filename.ctp will be rendered on request
to controller's Sub1 action filename with request type sub2. For
example, request http://localhost/products/latest.rss will render
views/products/rss/latest.ctp



On Mar 27, 8:39 am, programguru ja...@w3developing.com wrote:
 Authentication is for controller, not for view.

 Dr Lobo...

 I would like to agree with you, but logically authentication (username and 
 password) would be required on a view.

 I think we are using two different definitions of Authentication.

 I was only referring to a login screen presented for my admin console.

 But I would agree the any Authentication methods would be in the controller.

 --
 View this message in 
 context:http://n2.nabble.com/controller-not-being-detected-when-view-index-fi...
 Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
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: Why is it so hard to find answers on cakephp trouble?

2009-03-27 Thread AD7six



On Mar 27, 5:26 am, programguru ja...@w3developing.com wrote:
 From a marketing standpoint, CakePHP does express itself as easy and maybe 
 this is a bit misleading to the average computer or new programmer who wants 
 to start out with Cake.

 I must say the concept is enlightening, but maybe their tagline should be:

 Easy  Rapid for the extremely seasoned and experienced OOP php programmer! 
 ; )

I think /that/ is entirely misleading.

Unless by extremely seasoned and experienced OOP php you mean:
* Knows whether their question (or the error message they are looking
at) is related to php or cake
* Can read error messages
* Is CanUseASearchForm certified™

AD

--~--~-~--~~~---~--~~
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: Why is it so hard to find answers on cakephp trouble?

2009-03-27 Thread AD7six



On Mar 26, 9:07 pm, Chris M cmcclel...@yahoo.com.au wrote:
 Good luck Russ 

 I've tried the IRC channel a few times, and IMHO you get treated 10x worse 
 than you do here.  I agree, ask the wrong questions (ie newbie stuff) here 
 and you get ignored.  Attempt the same thing on IRC and you will be ridiculed.

That should never be the case. I'm curious what you asked, feel free
to use http://irc.cakephp.org/search/cakephp/putyournickhere to get a
direct link to your question.

 The assumption must be changed from you should know how to do that to oh, 
 you're a newbie, what can I help you learn today ?.  I know not everyone can 
 do  this, but the IRC is a terrible example of grumpy old men who don't want 
 to help anyone, just natter between themselves.

As with most support channels chatter pops up when it's quiet, and is
actively discouraged when it's not.

It is hard for many to say oh, you're a newbie, what can I help you
learn today ? when for e.g. any of the following are true:
* The question was asked by someone else in the channel after the user
joined
* The question is frequently asked, and if googled points to the
answer
* The answer is in the book/api directly (the book and api both have
an underused search)
* The question is fundamental PHP
* The question is not related to anything cakey

Also, some in the channel (probably most notably me) have a teach-to-
learn attitude, which for the vampy types is taken as obstructive
since it's not the answer served on a silver platter.

We (and I mean everyone) should try our best to maintain a friendly,
focussed and professional atmosphere in the irc channel and on the
group; That doesn't mean bending over backwards to help solve parse
errors and read users their error messages though.

AD
-- One of the grumpy
--~--~-~--~~~---~--~~
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: Auth Deny doesn't work with CamelCased action name!

2009-03-27 Thread AD7six



On Mar 27, 3:37 am, JamesF usaexportexpe...@gmail.com wrote:
 thanks that post is basically confirming my issue!

your action names should not be camel cased, it's a ~best practice to
use lower case urls and by consequence that means: controller actions
are under_scored.

AD
--~--~-~--~~~---~--~~
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: incorrect action attribute when creating a form

2009-03-27 Thread dr. Hannibal Lecter

Url is missing:

?php echo $form-create('User', array('url' = array('action' =
'login')));?

On Mar 25, 9:52 pm, jonas jonas.subscripti...@gmail.com wrote:
 When I create a form there goes something wrong when the action
 attribute of the form element is created.

 View code:

     ?php echo $form-create('User', array('action' = 'login'));?
         ?php echo $form-input('username');?
         ?php echo $form-input('password');?
         ?php echo $form-submit('Login');?
     ?php echo $form-end(); ?

 Outputs:

 form id=UserLoginForm method=post action=/~jonas/cake-template/
 index.php/users/users/login ...

 Clearly this should have been action=/~jonas/cake-template/index.php/
 users/login !

 Why is this happenings ?
--~--~-~--~~~---~--~~
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: Heads up to a few using requestAction in 1.2.2

2009-03-27 Thread AD7six



On Mar 26, 3:41 pm, Martin Westin martin.westin...@gmail.com wrote:
 Yes I use it a lot... only for a limited purpose but throughout the
 application.

 I actually have two reasons for using it :)

 Reason 1: Yoy are close. Not email but similar componets none the
 less. I have my two components for sending mobile messages (sms and
 mms). The application does in some plugins scheduled newsletters. It
 can also be messages send by some system event (recieving a message
 for example can send an automatic reply)

Sounds like you've got a component where you should probably have a
datasource for the gateway and a Message model (or, some other M based
stuff).

I have an email model (which internally - either sets up a controller
and the email component and renders the view to get the content, or
calls requestAction with appropriate params), and payment model (same,
for the HTTPSocket content) for the same sort of reasoning.

 Reason 2: plugins. Everything in my app is plugins except a core doing
 common stuff. I use the PluginnameController in each to handle system
 integration. I could have chosen to load up a Pluginname model instead
 but since I very often need to be at the controller level (because of
 reason 1) there was little point.

I have a similar problem at the back of my mind, which I planned to
solve by using a plugin component as the plugin entry point/interface,
and therefore you'd just (either dynamically or otherwise) include the
plugin's component in your controller to make use of it.

 I don't use plugins at all as standalone mini applications unrelated
 to the rest of the application
 I use them much like normal desktop applications do. The core is
 independent of the plugins but each plugin relies heavily on the core
 for a lot of things.

It'd be neat to hear a little more about your current core
architecture, since I have the need to do something (probably)
similar.


 I would love to figure out some other good way to deal with plugin-
 interaction... so far requestAction is it.

anyway, controller actions are supposed to be under_scored and that's
the 'fix' for your auth woes imo (or simply if (!empty($this-params
['requested'])) { $this-Auth-allow('*'); }

AD
--~--~-~--~~~---~--~~
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: Filtering by HABTM model count

2009-03-27 Thread grigri

When you use the `bindModel` call, use a different alias.

Example:

$this-bindModel(array('hasOne'=array(
'AlbumsImageBacon'=array(
  'className' = 'AlbumsImage'
),
'ImageBacon'=array(
 'className'='Image',
 'foreignKey'=false,
 'type'='INNER',
 'conditions'=array(
 'ImageBacon.status = 0',
 'ImageBacon.id = 
AlbumsImageBacon.image_id')
 )
)
));

hth
grigri

On Mar 27, 12:31 am, volve bclay...@gmail.com wrote:
 My problem: Show the user 4 Albums where each Album has = 1 Images.

 I started this project in CakePHP 1.1 and realized quickly I couldn't
 create an elegant solution, so I've recently upgraded to 1.2.2 and am
 trying again.

 My code below works correctly and returns a wonderful array with all
 the pieces of data I need. The really odd thing is that after Cake has
 sent the first query, joining all the necessary tables, it then goes
 back to query the Image model 4 times, each time failing because it
 attempts to use the non-joined AlbumsImage HABTM association in the
 where clause.

 Here's the error and offending SQL:

 Warning (512): SQL Error: 1054: Unknown column 'AlbumsImage.image_id'
 in 'where clause' [CORE/cake/libs/model/datasources/dbo_source.php,
 line 525]

 SELECT   `image`.`id`,`image`.`title`,`image`.`host`,`image`.`path`
 FROM     `images` AS `image`
 WHERE    `image`.`status` = 0
          AND `image`.`id` = `albumsimage`.`image_id`
 ORDER BY `image`.`created` ASC

 I don't know why this query is even being issued, but as I say it's
 all the more odd because the main query (below) returns successfully.

 SELECT
 `album`.`id`,`album`.`user_id`,`album`.`title`,USER.id,USER.username,`user`.`id`
 FROM     `albums` AS `album`
          LEFT JOIN `users` AS `user`
            ON (`album`.`user_id` = `user`.`id`)
          LEFT JOIN `albums_images` AS `albumsimage`
            ON (`albumsimage`.`album_id` = `album`.`id`)
          INNER JOIN `images` AS `image`
            ON (`image`.`status` = 0
                AND `image`.`id` = `albumsimage`.`image_id`)
 WHERE    `album`.`status` = 0
 GROUP BY `album`.`id`,`album`.`title`
 HAVING   Count(* ) = 1
 ORDER BY `album`.`created` DESC,`image`.`created` ASC
 LIMIT    4

 Here is the method of the Album model I use to query Albums where
 Image count = 1:

   function gimme($num=6) {
     $contain = array(
       'AlbumsImage',
       'Image'=array('ImageSize',
                      'fields'=array
 ('Image.id','Image.title','Image.host','Image.path'),
                      'order' = 'Image.created ASC'
                      ),
       'User'=array('fields'='User.id,User.username'));

     $this-resetAssociations(); // just in case

     $this-bindModel(array('hasOne'=array('AlbumsImage',
                                            'Image'=array(
                                                  'className'='Image',
                                                  'foreignKey'=false,
                                                  'type'='INNER',
                                                  'conditions'=array(
                                                      'Image.status =
 0',
                                                      'Image.id =
 AlbumsImage.image_id')
                                                  )
                                            )
                            ));

     $albums = $this-find('all', array('contain' = $contain,
                                     'conditions' = array
 ('Album.status'='0'),
                                         'fields' = array
 ('Album.id','Album.user_id','Album.title'),
                                          'order' = 'Album.created
 DESC',
                                          'limit' = $num,
                                          'group' = array
 ('Album.id','Album.title HAVING COUNT(*) = 1'))); // we only want
 Albums with 1 or more images
     return $albums;
   }

 I've been trying to figure this out all day so would /really/
 appreciate any insights into this weird SQL error.

 Thanks everyone!
 -volve
--~--~-~--~~~---~--~~
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: Creating Post Views (Blog tutorial)

2009-03-27 Thread albe

I found the webroot folder and it contains .htaccess.

On Mar 27, 10:59 am, albe radia...@libero.it wrote:
 @ programguru:

 this is my posts_controller.php file, located in app/controllers

 ?php
 class PostsController extends AppController {

         var $name = 'Posts';
         function index() {
                 $this-set('posts', $this-Post-find('all'));
         }

 }

 ?

 @ Marcelo Andrade:

 Yes, my httpd.conf file of Apache is set with AllowOverride All for the
 Directory Directory C:/Program Files/Apache Software
 Foundation/Apache2.2/htdocs that is the location of my cakeblog directory.
 No, I can't see the home page of Cake with message in colours and I DON'T
 have a cakeblog/webroot folder (I only have .htaccess in cakeblog folder and
 in cakeblog/app)

 @ Brian:

 I get the same error if I point onhttp://localhost/cakeblog/posts/.
 --
 View this message in 
 context:http://www.nabble.com/Creating-Post-Views-%28Blog-tutorial%29-tp22727...
 Sent from the CakePHP mailing list archive at Nabble.com.

--~--~-~--~~~---~--~~
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: Update Select

2009-03-27 Thread Dave Maharaj :: WidePixels.com

OK Thanks. I was just wondering if I could break my USERS skills up into
sections to edit in pieces rather than in 1 big form but I guess it will not
work then.

Thanks 

-Original Message-
From: mscdex [mailto:msc...@gmail.com] 
Sent: March-27-09 2:40 AM
To: CakePHP
Subject: Re: Update Select


On Mar 26, 9:40 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 Is this how it is supposed to update?

I would say yes. By de-selecting skill 13, you're disassociating the user
with that skill, so that association is deleted (or rather not re-
inserted).

If you're wondering why the ids changed, that's because Cake actually
deletes the existing row first, then inserts a new row containing the new
information instead of performing an actual SQL update command on the
existing row.


--~--~-~--~~~---~--~~
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: Using MySql DB instead of PO files

2009-03-27 Thread Mark (Germany)

i once had this idea as well
but it is - as a fact - way slower than the po way

AND i came up with this idea:
language backend with editing/adding multiple languages to their
corresponding __('textPlaceholder')
and exporting it to the .po file after i am finished altering them
this way it is very flexible, additional infos can be attached to the
lang strings and you dont lose much speed
this works only for __() of course

for Database Content to be translated you could use the translate
behaviour

yours,
mark


On 26 Mrz., 16:15, Sourabh sourabhmkulka...@gmail.com wrote:
 Hi

 I am developing a multilingual site with cakePHP.
 I need to use database instead of PO files to store language strings
 as a requirement.
 What can be the best way to do it ?
 Can I override __() function if yes ,then how ?

 Thanks in advance !

 Sourabh
--~--~-~--~~~---~--~~
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: Using MySql DB instead of PO files

2009-03-27 Thread Richard
I have a basic table that allows me to have data-driven translations. As
Mark mentioned, it's much slower to use the database, so I have a shell
script to generate the .po files which is invoked when the table is updated.


On Thu, Mar 26, 2009 at 3:15 PM, Sourabh sourabhmkulka...@gmail.com wrote:


 Hi

 I am developing a multilingual site with cakePHP.
 I need to use database instead of PO files to store language strings
 as a requirement.
 What can be the best way to do it ?
 Can I override __() function if yes ,then how ?

 Thanks in advance !

 Sourabh


 


--~--~-~--~~~---~--~~
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: Creating Post Views (Blog tutorial)

2009-03-27 Thread albe

I found the error! Andrade you were right...
I had AllowOverride All but I forgot to delete the # from the line:

LoadModule rewrite_module modules/mod_rewrite.so

Thank you everybody anyway ;)
--~--~-~--~~~---~--~~
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: Why is it so hard to find answers on cakephp trouble?

2009-03-27 Thread Affinity

Reply to Ad7six (sorry topic has moved on but wanted to answer)
regarding support forums

What forums?

I have also posted on http://www.cakephpforum.net/. I couldnt find any
others apart from this Nabble/Google Group.

When you say forum what do you mean? Google groups allows users to
pick and choose how they see/recieve info/participate - and it's
primarily a mailing list (with typically awesome search for those oft-
asked questions). 

Well firstly this site Google Groups and Nabble LOOK pretty awful and
dont have much functionality. There's no highlighting of code, text,
quotes, etc. i.e. BB code. Search is really basic. If anyone is
familiar with online forums that use software like phpBB3, vBulletin
etc. then thats what I mean by forum. A proper discussion forum. Using
this group/nabble for community support, development, discussion etc.
is pretty bad. So http://www.cakephpforum.net/ has the right forum
system (invision power board). Forums are low cost (phpbb3 is free)
and easy to setup, so you would have thought CakePHP would have a
proper one rather than direct people to Google Groups. But as stated I
posted on http://www.cakephpforum.net/.

So I think a proper official forum system should be introduced to
improve the support experience, or more people move to 
http://www.cakephpforum.net/
to make it worthwhile. I couldnt find any other ones. Although we dont
want loads!
--~--~-~--~~~---~--~~
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: Why is it so hard to find answers on cakephp trouble?

2009-03-27 Thread rgreenphotodesign

I haven't be discouraged from using the groups to learn :)

Actually having a question NOT answered can sometimes be the best,
because I have to dig a little more to find the solutions. Hopefully I
become more knowledgeable along the way.

I agree with those who speak to the way the question was asked. I'm
sure I'm guilty of not including the right detail or asking the
correct question. There have certainly been times when I think I know
what the problem is and hit the google groups search engine with the
exact WRONG search terms (as was the case with my last question). I
got a better understanding of my issue, refined my search and found a
few posts in regards to what I was looking for. I've seen some other
folks do this, but if I do find information to answer my own question,
I try to reply to my post with that info. Hope that's OK. I'm still
learning etiquette on these groups.

I'm not trying to ruffle any feathers, but do want to become a more
active member of the community. I know the only way to get respect is
to earn it, so I'll do my best to earn that respect.

For those that want to know
I've been involved with web development on every level in the
corporate world  (develop, qa, change management) for 10 years.
Recently became a 'corporate world drop out' to pursue a business in
freelance (web design and photography). Mostly developed applications
for phone centers and account processing reps.

Happy baking and hope I didn't offend anyone :)
Russ



On Mar 27, 4:40 am, AD7six andydawso...@gmail.com wrote:
 On Mar 26, 9:07 pm, Chris M cmcclel...@yahoo.com.au wrote:

  Good luck Russ 

  I've tried the IRC channel a few times, and IMHO you get treated 10x worse 
  than you do here.  I agree, ask the wrong questions (ie newbie stuff) here 
  and you get ignored.  Attempt the same thing on IRC and you will be 
  ridiculed.

 That should never be the case. I'm curious what you asked, feel free
 to usehttp://irc.cakephp.org/search/cakephp/putyournickhereto get a
 direct link to your question.

  The assumption must be changed from you should know how to do that to 
  oh, you're a newbie, what can I help you learn today ?.  I know not 
  everyone can do  this, but the IRC is a terrible example of grumpy old men 
  who don't want to help anyone, just natter between themselves.

 As with most support channels chatter pops up when it's quiet, and is
 actively discouraged when it's not.

 It is hard for many to say oh, you're a newbie, what can I help you
 learn today ? when for e.g. any of the following are true:
 * The question was asked by someone else in the channel after the user
 joined
 * The question is frequently asked, and if googled points to the
 answer
 * The answer is in the book/api directly (the book and api both have
 an underused search)
 * The question is fundamental PHP
 * The question is not related to anything cakey

 Also, some in the channel (probably most notably me) have a teach-to-
 learn attitude, which for the vampy types is taken as obstructive
 since it's not the answer served on a silver platter.

 We (and I mean everyone) should try our best to maintain a friendly,
 focussed and professional atmosphere in the irc channel and on the
 group; That doesn't mean bending over backwards to help solve parse
 errors and read users their error messages though.

 AD
 -- One of the grumpy
--~--~-~--~~~---~--~~
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 gone after redirect

2009-03-27 Thread rgreenphotodesign

For public viewed sites, I would tend to not use AJAX with a main
navigation system. For an admin site, go for it.

I don't use AJAX as site level navigation because of what it does (or
does not) do with the browser back button. People still reply on that
button as a main navigation tool and when you use AJAX that back
button isn't correct and they ended somewhere unexpected. JMHO.

Russ



On Mar 26, 9:52 am, Stu greenmushroo...@gmail.com wrote:
 This was my first attempt with Ajax, and I think I took it for
 granted.  $html-link would work fine, it's just that for security
 measures, using Ajax-link would of saved me a bunch of coding.
 Anyways, I'm gonna limit my Ajax to pagination only, and get some work
 done.

 Thx anyways man, I appreciate the help.
--~--~-~--~~~---~--~~
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 gone after redirect

2009-03-27 Thread rgreenphotodesign

And when you are using AJAX...Firebug in Firefox browser will be your
best friend!

On Mar 26, 9:52 am, Stu greenmushroo...@gmail.com wrote:
 This was my first attempt with Ajax, and I think I took it for
 granted.  $html-link would work fine, it's just that for security
 measures, using Ajax-link would of saved me a bunch of coding.
 Anyways, I'm gonna limit my Ajax to pagination only, and get some work
 done.

 Thx anyways man, I appreciate the help.
--~--~-~--~~~---~--~~
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: Why is it so hard to find answers on cakephp trouble?

2009-03-27 Thread Dardo Sordi Bogado

Andy,

 AD
 -- One of the grumpy

Sorry but that is totally untrue, you are one of the most friendly
users in this group ;)

Regards,
- Dardo.

--~--~-~--~~~---~--~~
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: Why is it so hard to find answers on cakephp trouble?

2009-03-27 Thread Sam Sherlock
Affinity when you say right forum I disagree.  Google Groups to which I am
signed up some direct to my gmail account- this centralises amass of
information for me - I agree nabble is rather awkward to view - google
groups (browsing archives not in gmail) is not bad at all perhaps this is
just taste.  A great benefit of google groups is that its passive
involvement the cakephpforum.net requires (more) involved management.

Further gmail has filters - so I can set emails from certain list members to
be starred foreinstance Ad7Six and others - with gmail notifier I can see
emails as the arrive (I am growing to dislike the traditional format of
forum - with features offer within gmail)

For code highlighting posters can use pastbin - so I don't consider this a
problem

I can't see what can be achieved with the forums you talk of that can not be
done with ggroups and since a great deal of information has been amassed
here it seems extremely worth while retaining this.   I have recently been
getting in to twitter and have found that to very useful ina novel way (much
cake information coming to me)

For me I felt that the cakephpforum (it now seems more active perhaps
numbers of those who wish another style of forum has grown) when I was last
there look inactive compared to this group - so I felt that would learn much
more watching messages here  checking bakery. now with the that I am
following @***cakephp http://twitter.com/cakephp* on twitter information

happy baking to all

- S



2009/3/27 Affinity goo...@affinitywebsolutions.co.uk


 Reply to Ad7six (sorry topic has moved on but wanted to answer)
 regarding support forums

 What forums?

 I have also posted on http://www.cakephpforum.net/. I couldnt find any
 others apart from this Nabble/Google Group.

 When you say forum what do you mean? Google groups allows users to
 pick and choose how they see/recieve info/participate - and it's
 primarily a mailing list (with typically awesome search for those oft-
 asked questions). 

 Well firstly this site Google Groups and Nabble LOOK pretty awful and
 dont have much functionality. There's no highlighting of code, text,
 quotes, etc. i.e. BB code. Search is really basic. If anyone is
 familiar with online forums that use software like phpBB3, vBulletin
 etc. then thats what I mean by forum. A proper discussion forum. Using
 this group/nabble for community support, development, discussion etc.
 is pretty bad. So http://www.cakephpforum.net/ has the right forum
 system (invision power board). Forums are low cost (phpbb3 is free)
 and easy to setup, so you would have thought CakePHP would have a
 proper one rather than direct people to Google Groups. But as stated I
 posted on http://www.cakephpforum.net/.

 So I think a proper official forum system should be introduced to
 improve the support experience, or more people move to
 http://www.cakephpforum.net/
 to make it worthwhile. I couldnt find any other ones. Although we dont
 want loads!
 


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



Building a nearly 100% AJAX app - questions

2009-03-27 Thread logout

Hi, Bakers!

I've been digging in CakePHP over a month (I am new to PHP, SQL, CSS,
JavaScript, AXAJ, and almost whatever Web related programming You may
think of). In case you wander, I've been programming controllers in
pure C (some of you may heared of this ancient language).

So I had to read tons of electronic paper (oh, my poor eyes, and what
was that word 'pillow' standing for?)

But so far, so good. I had a lot of troubles (maybe I'll document them
some day) with making this AJAX thing to work properly and to find
ways to make my app look like and behave as a desktop one.

So I have one BIG question: should I stick with the Prototype library,
or should I invest some more time in mastering the jQuery and use it
instead? Prototype does the job for now, but I hear that jQuery is
simpler and more convenient to use. I must decide quickly, because the
clock is ticking and I have an application to build. The Ajax Helper
is helpful, but I guess not enough, according to some people.

Also, I want to ask if there is a better way to tickle the fields of
a form (i.e. to modify their content/value and properties after an
ajax request) than to return javascript by the view (which script is
thrown away after its evaluation/execution). I still use the MVC
paradigm for the job, but I need to set values and properties
dynamicly in the form, preserving the form's actual view and data
(with the ability to use the embeded validation mechanism, provided by
the model) until final submition.
What I mean is populating a combo with options based on the choice
made in another combo, enableing other fields when it is time for
them to be used, inserting other items in a list and evaluating some
totals to be put in some input fields automatically. And some choices
made should be validated at submission (like checking for empty
fields, for example). Also I don't want to do extra quering the
database and rendering the form over and over at every change, keeping
track of the work done so far (what's the point in doing ajax requests
then?).

So, as we know, putting logic in the view is a bad thing, but how you
execute dynamic scripts, if they are not in the returned content? And
by dynamac I mean script, that will do it's job after the ajax call
and then vanish into oblivion.

Or am I just too confused with this soup of technologies, trying to
consolidate them in the context of Cake... The next month or so my
life will still suck a lot.

P.S. Why there is a word nearly in the caption? Because only the
login form is not ajaxed, and the logged user/admin is redirected to
the main view. Everything else is happening in that main view.

P.S.S. Sorry for the long post...
--~--~-~--~~~---~--~~
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: Problems with Translate Behaviour in Firefox and Internet Explorer (country code)

2009-03-27 Thread jitka (poLK)

If following code at top of app/config/bootstrap.php doesn't show same
results in both your browsers, it could be some bug in l10n
autodetection - could you check that?

App::import('Core', 'i18n');
$I18n = I18n::getInstance();
$I18n-l10n-get();
die($I18n-l10n-locale);

If it shows same locale all the time, then confirm you are not setting
Configure::write('Config.language', ...) or $this-SomeModel-locale
= ... somewhere in your code, please.
--~--~-~--~~~---~--~~
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: Email attachment through form.

2009-03-27 Thread morc

Im using: mail($to, $subject, $message, $from);
Im not incredibly advanced with php so excuse the fact that the link
you gave me confuses me.
I got the above line working correctly.
However i can't figure out how to attach a file to the email. It will
be a CV. (input type=file name=upload)
I stored that into a variable $file.
But like i said, I can't figure out what to do with it. Can someone
help a bit more?

Thanks in advance
-morc

On Mar 26, 12:58 pm, mscdex msc...@gmail.com wrote:
 On Mar 26, 12:15 pm, morc questionmarc...@msn.com wrote:

  Now I've been able to send the email with all the information without
  a problem. But Ive been googling and can't find a comprehensive
  explanation on how to add an attachment to the e-mail. Can anybody
  hear help me? or point me in the right direction?

 If you're using the EmailComponent, then according to the CakePHP
 manual, there is a class attribute called attachments which is an
 array containing the full or relative paths of file(s) to attach to
 the email 
 mesage:http://book.cakephp.org/view/270/Class-Attributes-and-Variables
--~--~-~--~~~---~--~~
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: Email attachment through form.

2009-03-27 Thread logout

I think you have to do the following:

$this-Email-attachments = array('/path_to_the_file/file.ext'); (this
is a relative path, you can supply a full path)
and then you call the mail function.

If You want to attach more files, just extend the array.

On Mar 27, 5:32 pm, morc questionmarc...@msn.com wrote:
 Im using: mail($to, $subject, $message, $from);
 Im not incredibly advanced with php so excuse the fact that the link
 you gave me confuses me.
 I got the above line working correctly.
 However i can't figure out how to attach a file to the email. It will
 be a CV. (input type=file name=upload)
 I stored that into a variable $file.
 But like i said, I can't figure out what to do with it. Can someone
 help a bit more?

 Thanks in advance
 -morc

 On Mar 26, 12:58 pm, mscdex msc...@gmail.com wrote:



  On Mar 26, 12:15 pm, morc questionmarc...@msn.com wrote:

   Now I've been able to send the email with all the information without
   a problem. But Ive been googling and can't find a comprehensive
   explanation on how to add an attachment to the e-mail. Can anybody
   hear help me? or point me in the right direction?

  If you're using the EmailComponent, then according to the CakePHP
  manual, there is a class attribute called attachments which is an
  array containing the full or relative paths of file(s) to attach to
  the email 
  mesage:http://book.cakephp.org/view/270/Class-Attributes-and-Variables- 
  Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP and Forum software

2009-03-27 Thread brian

Have a look at these:
http://bakery.cakephp.org/articles/view/cakephp-smf
http://blog.4webby.com/posts/view/2/smake_smf_cakephp_integration

I haven't used this, and they're a bit outdated now, but I'd saved the
links for a possible future addition to an app. YMMV.

On Thu, Mar 26, 2009 at 7:23 PM, jbgillet
john.michael.fitzger...@gmail.com wrote:

 Sup all,

 Basically, I would like a forum in my cake web-app. I would like users
 to be able to log in as per a normal cake app (not necessarily using
 cakes Auth) and then be able to go to the forum section, or do other
 things that you need to be logged in to do (i.e buy stuff).

 Has anyone successfully integrated phpBB with the cake Auth ?
 Is there even any point in doing this ?? I only have a very small user
 base (about 15 users) at the moment, so i could pretty easily move
 them over the use the phpBB auth, and then try to hack the phpBB so
 that i can login from my homepage, and am not automatically taken
 straight to the forum.

 There has to be a simpler solution. I cannot find any forum software
 written for cake (am i blind? i searched the bakery and cakeForge),
 but this would be the ideal solution.

 Or do you think I'm better off writing a forum from scratch ??

 Ideas, concerns and queries welcome.

 Cheers,
 John.


 


--~--~-~--~~~---~--~~
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: What's the usage of app\views\layouts\js?

2009-03-27 Thread brian

Could you expand on that a bit? What would you put in the layout,
then? For js specifically, I mean.

On Fri, Mar 27, 2009 at 2:34 AM, Dr. Loboto drlob...@gmail.com wrote:

 For the same purpose as xml, rss, email and etc.

 When you want to output pure JavaScript (to be executed, for example),
 you should use $this-RequestHandler-renderAs($this, 'js') in
 controller. It will set appropriate content-type header and layout/
 view subfolder. So Cake will look for layout for such request not in
 views/layouts but in views/layouts/js. Same for views, instead of
 views/controller target folder will be views/controller/js

 On Mar 26, 8:35 pm, joshua josh...@gmail.com wrote:
 Did anybody know the useage of this folder?

 --
 Thanks
 Joshua
 


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

2009-03-27 Thread brian

Thanks for the link but it doesn't explain what I'm looking for, which
is the DB table schema. I'm familiar with MPTT (and have used it
before) but Cake's parent_id has me confused.

But I thought to look at db_acl.sql, which shows parent_id DEFAULT
NULL so I'll go with that.

On Fri, Mar 27, 2009 at 5:27 AM, djiize seb.jou...@free.fr wrote:

 For nested groups, you should read this post:
 http://edwardawebb.com/programming/php-programming/cakephp/nested-trees-cakephp

 In ACL, I (personnaly) think it's a good idea to have a ROOT group,
 even if you don't use it now, maybe later ;)

 If you don't want one, a NULL value should suffice.

 On 27 mar, 05:16, brian bally.z...@gmail.com wrote:
 I need to have nested groups, so the table has a parent_id column.
 But, should top-level groups have a NULL parent_id? Or would there
 have to be a ROOT group, so to speak? I'm having a real hard time
 sorting all this out.
 


--~--~-~--~~~---~--~~
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: controller not being detected when view index file is in sub dir of /views

2009-03-27 Thread programguru


OK thank you for the clarification.

You still did not understand me on the view containing a username and password 
field. My only point was there is in fact fields in a log in form, and in order 
to log in, a form is required, and the view is for that but not the action.
-- 
View this message in context: 
http://n2.nabble.com/controller-not-being-detected-when-view-index-file-is-in-sub-dir-of--views-tp2536859p2545439.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: incorrect action attribute when creating a form

2009-03-27 Thread brian

Since when is a that necessary? Is this something specific for vhost
setups like /~username/some_dir/...?

On Fri, Mar 27, 2009 at 6:14 AM, dr. Hannibal Lecter
lecter...@gmail.com wrote:

 Url is missing:

 ?php echo $form-create('User', array('url' = array('action' =
 'login')));?

 On Mar 25, 9:52 pm, jonas jonas.subscripti...@gmail.com wrote:
 When I create a form there goes something wrong when the action
 attribute of the form element is created.

 View code:

     ?php echo $form-create('User', array('action' = 'login'));?
         ?php echo $form-input('username');?
         ?php echo $form-input('password');?
         ?php echo $form-submit('Login');?
     ?php echo $form-end(); ?

 Outputs:

 form id=UserLoginForm method=post action=/~jonas/cake-template/
 index.php/users/users/login ...

 Clearly this should have been action=/~jonas/cake-template/index.php/
 users/login !

 Why is this happenings ?
 


--~--~-~--~~~---~--~~
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: Email attachment through form.

2009-03-27 Thread brian

You're using the standard PHP mail function. You should consider the
Cake EmailComponent, instead. Have a look here:

http://bakery.cakephp.org/articles/view/brief-overview-of-the-new-emailcomponent
http://dsi.vozibrale.com/articles/view/using-emailcomponent-in-cakephp-1-2
and, of course ...
http://book.cakephp.org/view/176/email

On Fri, Mar 27, 2009 at 11:32 AM, morc questionmarc...@msn.com wrote:

 Im using: mail($to, $subject, $message, $from);
 Im not incredibly advanced with php so excuse the fact that the link
 you gave me confuses me.
 I got the above line working correctly.
 However i can't figure out how to attach a file to the email. It will
 be a CV. (input type=file name=upload)
 I stored that into a variable $file.
 But like i said, I can't figure out what to do with it. Can someone
 help a bit more?

 Thanks in advance
 -morc

 On Mar 26, 12:58 pm, mscdex msc...@gmail.com wrote:
 On Mar 26, 12:15 pm, morc questionmarc...@msn.com wrote:

  Now I've been able to send the email with all the information without
  a problem. But Ive been googling and can't find a comprehensive
  explanation on how to add an attachment to the e-mail. Can anybody
  hear help me? or point me in the right direction?

 If you're using the EmailComponent, then according to the CakePHP
 manual, there is a class attribute called attachments which is an
 array containing the full or relative paths of file(s) to attach to
 the email 
 mesage:http://book.cakephp.org/view/270/Class-Attributes-and-Variables
 


--~--~-~--~~~---~--~~
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: What's the usage of app\views\layouts\js?

2009-03-27 Thread Brendon Kozlowski

For my own personal uses, I've kept my js layout empty.  If you wanted
a specific variable set in all of your JS though, you could set it in
the layout file quite easily.

On Mar 27, 12:56 pm, brian bally.z...@gmail.com wrote:
 Could you expand on that a bit? What would you put in the layout,
 then? For js specifically, I mean.



 On Fri, Mar 27, 2009 at 2:34 AM, Dr. Loboto drlob...@gmail.com wrote:

  For the same purpose as xml, rss, email and etc.

  When you want to output pure JavaScript (to be executed, for example),
  you should use $this-RequestHandler-renderAs($this, 'js') in
  controller. It will set appropriate content-type header and layout/
  view subfolder. So Cake will look for layout for such request not in
  views/layouts but in views/layouts/js. Same for views, instead of
  views/controller target folder will be views/controller/js

  On Mar 26, 8:35 pm, joshua josh...@gmail.com wrote:
  Did anybody know the useage of this folder?

  --
  Thanks
  Joshua- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Heads up to a few using requestAction in 1.2.2

2009-03-27 Thread Martin Westin

 Sounds like you've got a component where you should probably have a
 datasource for the gateway and a Message model (or, some other M based
 stuff).

Possibly, I have sometimes wondered why the EmailComponent was a
component and not something else. Any time you have a feature that
does not render to the browser you end up in a bit of a design
dilemma. I took the hint from Email and stuck my stuff into a
component even though I economized on the design (no capturing any
MMS View or anything like that)


 anyway, controller actions are supposed to be under_scored and that's
 the 'fix' for your auth woes imo (or simply if (!empty($this-params
 ['requested'])) { $this-Auth-allow('*'); }

The thing was that this is what did not work after I updated. Allowing
would not work when the action was requested even though I allowed
everything. That is why I renamed the actions... which I should have
done from the start.


 I have a similar problem at the back of my mind, which I planned to
 solve by using a plugin component as the plugin entry point/interface,
 and therefore you'd just (either dynamically or otherwise) include the
 plugin's component in your controller to make use of it.

 It'd be neat to hear a little more about your current core
 architecture, since I have the need to do something (probably)
 similar.

Without being too lengthy (another day maybe).

The core does authentication, user management, global settings and
configurations.
The core holds models for the above things and also common
functionality like sms, mms messages, search-filters, phone-number log
and similar often used model stuff.
The core keeps all plugins in a Model that is HABTM to the User model
so that apart from normal permission levels each plugin can be made
available to a user (or not). Also each plugin can be set as
installed or not since not all out clients should have all plugins
but pulling the same source to each vhost simplifies updates a lot
(and I can install a new feature for a client in a second).

Every plugin can, for example, save their own smses in the core model.
I use a field called belongsTo in a few of these models so that it
is possible to list only items belonging to that plugin. The
Newsletters plugin would have a model setup like NewsletterMessage-
hasOne-Sms and hasMany-NewsletterRecipients-belongsTo-
Phonenumber  and so on. (belongsTo is used because any number of
models can be linked to the same number and should globally respect if
that number is blocked for example)

When a message arrives to the Gateway it gets parsed and stored. The
appropriate plugin is notified and given the id of the new message and
can react to it as is sees fit. The same goes for cron tasks which
notifies each plugin to update (= do whatever it needs to do on a
regular basis). Since the plugin decides what to do I feel more
comfortable using the controller level than keeping such decision
making in a model.

I did start out doing these things in models but often found tasks and
situations that asked for or required components , rendering, or
other non-model stuff. Each plugin would require a Pluginname model
who's purpose would solely be to decide which other Model(s) to wake
up. I might try it again but it is not at the top of my (long) todo
list. :)

What aspects of the core architecture were you interested in? Feel
free to ask for more if you are interested. Id be happy to answer and
detail any part of it you find interesting.


/Martin


On Mar 27, 11:56 am, AD7six andydawso...@gmail.com wrote:
 On Mar 26, 3:41 pm, Martin Westin martin.westin...@gmail.com wrote:

  Yes I use it a lot... only for a limited purpose but throughout the
  application.

  I actually have two reasons for using it :)

  Reason 1: Yoy are close. Not email but similar componets none the
  less. I have my two components for sending mobile messages (sms and
  mms). The application does in some plugins scheduled newsletters. It
  can also be messages send by some system event (recieving a message
  for example can send an automatic reply)

 Sounds like you've got a component where you should probably have a
 datasource for the gateway and a Message model (or, some other M based
 stuff).

 I have an email model (which internally - either sets up a controller
 and the email component and renders the view to get the content, or
 calls requestAction with appropriate params), and payment model (same,
 for the HTTPSocket content) for the same sort of reasoning.

  Reason 2: plugins. Everything in my app is plugins except a core doing
  common stuff. I use the PluginnameController in each to handle system
  integration. I could have chosen to load up a Pluginname model instead
  but since I very often need to be at the controller level (because of
  reason 1) there was little point.

 I have a similar problem at the back of my mind, which I planned to
 solve by using a plugin component as the plugin entry point/interface,
 and therefore you'd just (either 

Help! How to order by created desc with findAllByName( ) method

2009-03-27 Thread cpeele


Hey guys,

I am trying to just get a list of Products ordered by created desc but
I can't seem to get it.

Products have a name field so I am using findAllByName($name). I
have tried various things but can't seem to get it.

Any help would be greatly appreciated. Thanks!

function view($name)
{
$projects = $this-Project-findAllByName($name);
$this-set('projects', $projects);
$this-set('projectName', $name);
}
-
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help! How to order by created desc with findAllByName( ) method

2009-03-27 Thread mscdex

On Mar 27, 4:00 pm, cpeele chris.peel...@gmail.com wrote:
 Hey guys,

 I am trying to just get a list of Products ordered by created desc but
 I can't seem to get it.

 Products have a name field so I am using findAllByName($name). I
 have tried various things but can't seem to get it.

The findAllBy function by itself does not permit any ordering. You may
have to use a normal find statement like: $this-Project-find('all',
array('conditions' = array('Project.name' = $name), 'order' =
'Project.created DESC'));
--~--~-~--~~~---~--~~
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: action parameters lost after data validation

2009-03-27 Thread JamesF

i am having the same problem with validation making me lose my action
parameters.

still trying to figure out best way to pass back action parameter
after failed validation.

On Mar 18, 12:08 pm, koala kid alexhob...@gmail.com wrote:
 Thanks for your reply.

 Myvalidationhas become a little more complicated since yesterday as
 I am trying to validate 1 field but that field belongs to related
 model. In that case where should I perform thevalidationand how
 would I pass the ID back most effectively.

 On Mar 17, 8:50 pm, brian bally.z...@gmail.com wrote:

  On Tue, Mar 17, 2009 at 4:12 PM,koalakidalexhob...@gmail.com wrote:

   Hi,

   I am fairly new to cake and I'm making some fixes for a client on a
   CMS tool someone developed for them using cake. I am trying to add a
   customvalidationrule on one of the forms but if it fails the ID
   parameter in the URL is beinglostand the edit fails to update.

   Do I have to explicitly pass the ID back along?

  I doubt thatvalidationhas anything directly to do with it. I'm
  guessing youraction/method has an $id as a parameter and the form
 actiondoes not include it. If you're using $form-create() can you
  post that? Also the method itself. It's possible that it's being set
  the first time around but, whenvalidationfails and the form is
  re-displayed, the ID var isn't set again.
--~--~-~--~~~---~--~~
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: CakePHP and Forum software

2009-03-27 Thread Miles J

Forums are extremely easy to make, its only the following tables:

forums, forum categories, threads and posts

I mean, CakePHP already has security and auth and everything else.
--~--~-~--~~~---~--~~
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: CakePHP and Paginate urls

2009-03-27 Thread Miles J

You cant remove page 1, its part of the pagination system. Paginator
uses named params, I would highly suggest not changing it. Might as
well build your own paging system then.
--~--~-~--~~~---~--~~
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: Auth Deny doesn't work with CamelCased action name!

2009-03-27 Thread JamesF

thanks again!

On Mar 27, 6:44 am, AD7six andydawso...@gmail.com wrote:
 On Mar 27, 3:37 am, JamesF usaexportexpe...@gmail.com wrote:

  thanks that post is basically confirming my issue!

 your action names should not be camel cased, it's a ~best practice to
 use lower case urls and by consequence that means: controller actions
 are under_scored.

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



Titles for drop-down lists

2009-03-27 Thread dubiousandrew

I have a first_name field and a last_name filed in my user table.
When a form has a 'select a user' from a drop down list the list is
populated with user ids.  I want to show first_name + last_name
instead of user_ids.  Is there a way to do this without creating
another field in my user table called 'name'?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: incorrect action attribute when creating a form

2009-03-27 Thread JamesF

?php echo $form-create('User',array('action'='login'));?
?php echo $form-input('username');?
?php echo $form-input('password',array('type'='password'));?
?php echo $form-end('Login');?

thats my login form works just fine!

On Mar 25, 4:52 pm, jonas jonas.subscripti...@gmail.com wrote:
 When I create a form there goes something wrong when the action
 attribute of the form element is created.

 View code:

     ?php echo $form-create('User', array('action' = 'login'));?
         ?php echo $form-input('username');?
         ?php echo $form-input('password');?
         ?php echo $form-submit('Login');?
     ?php echo $form-end(); ?

 Outputs:

 form id=UserLoginForm method=post action=/~jonas/cake-template/
 index.php/users/users/login ...

 Clearly this should have been action=/~jonas/cake-template/index.php/
 users/login !

 Why is this happenings ?
--~--~-~--~~~---~--~~
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: Titles for drop-down lists

2009-03-27 Thread JamesF

---
in your controller: (i'll assume users_controller.php)
---

function user_list()  //whatever function you are using

{
$conditions = 'ORDER BY User.first_name 
ASC'; //order our list to
make sure its alphabetical by first name
$this-set('users', 
$this-User-find('all', array ('conditions'=
$conditions )));//send the list of users to the view as $users
}



this should pull the list of names if your models are set up properly

-
in your view:
-
?
//app/views/users/user_list.ctp

echo $form-create('Users', array('type' = 'post', 'action' =
'userwhateveraction'));  // use formhelper to create the form called
Users going to whatever action you choose
?

?php  // create select box label and div wrapper
?

div class=selectbox
 label for=UserUserNameUser Name/label
select name=data[User][user_name] id=users-box

?php  //build selects

//foreach goes through array $users you set in controller

foreach ($users as $user):

//option value defaults to associated user id

echo 'option value='. $user['User']['id'] . '' . 
$user['User']
['first_name'] . ' ' . $user['User']['last_name'] .'/option';
endforeach;

?

/select
/div

?php
echo $form-end('Submit'); // close the form
?

hope this helps!
in this example make sure your table is called 'users' (including
whatever option prefix you may have set up in core cfg) and your
primary key is 'id'. first name is 'first_name' and last name is
'last_name'.


On Mar 27, 5:37 pm, dubiousandrew dubiousand...@gmail.com wrote:
 I have a first_name field and a last_name filed in my user table.
 When a form has a 'select a user' from a drop down list the list is
 populated with user ids.  I want to show first_name + last_name
 instead of user_ids.  Is there a way to do this without creating
 another field in my user table called 'name'?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Testing Association Models

2009-03-27 Thread Daniel, Dao Quang Minh

Hi,

How can I write unit test for association models in CakePHP ? So far ,
I have been searching around but havent found anything :( Can you
please point me to the right direction ?

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



Call a function right before execute any other function

2009-03-27 Thread Jason

Hi all,

I'm writing a facebook app, using flash  PHP. I need to verify that
the flash is called inside facebook, therefore I need to call a
function verify() in PHP which do something to verify that the request
is legit. I don't want to use

if ($this-verify()) {
//do stuff
}

for every single version. I believe I need to change something in the
core of CakePHP but don't know where to begin. Anyone who familiar
with the core could help me?

Thanks,
Jason

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



Count related results

2009-03-27 Thread Maldras

I'm trying to get a List of posts and the number of related comments.
Using find('count') for each post is unelegant and adds unnecessary
overhead, and I don't want to add a new field to the database to use
counterCache.
Is there any way to solve this with cakePHP under these conditions?
Using sql it would be just a join with a group by... I'm new to
all these ORM problems (and solutions).
Thank you.

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



Call a function right before execute any other function

2009-03-27 Thread Jason

Hi all,

I want to call a check function before the bootstrapping starts. I
believe I need to change in the core of cakePHP, but don't know where
to begin. Anyone who familiar with the core could help me?

Thanks,
Jason

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



Sessions disappearing -- load balancing problem?

2009-03-27 Thread Aimee

Hi,

I've written an application that collects users' answers to questions
using sessions.  It works fine most of the time, but one of our users
is having problems with sessions.  The sessions seems to be set
correctly in the controller, but once the next form is submitted, the
sessions from before don't seem to exist anymore.  It has been
suggested that this might be caused by saving sessions based on IP,
since we're using a load balancer.  I'm not much of a server person,
so I'm much in the know about the effects of load balancing on my
code.  Any thoughts or suggestions on why this might be happening or
how to fix it?

Thanks!

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



Simple Auth Login System (Code Included) -- Need Tips

2009-03-27 Thread programguru


This is my first Auth system, and I've been running into some trouble and was 
hoping for some advice or answers to the a resolution of my problems.

I've been piecing this together from random ideas and tutorials I have found 
online.

First off, I am not trying to build a complicatedly secure system, and this 
login function i have going is working.

But what I cannot resolve is:

1) How do I redirect the users to my views/cms/index once the user has logged 
in? In my index controller function I tried:
$this-Auth-loginRedirect = array('controller' = 'users', 'action' = 'cms'); 
- but this did absolutely nothing.

2) Further, login.ctp (see below)  I tried to display my logout button like so:
?php if(isset($Auth)) {echo 
$html-link('Logout',array('controller'='users','action'='logout')); } ? - 
and this did not work either?

I removed all of the non-working code from my below code. But you can see 
what I've got going.

I would appreciate any comments, advice, or corrections here cause I just can't 
get this to come together the way I need it to.

##
users_controller.php
##

?php
class UsersController extends AppController {
var $name = 'Users';
 
function login() {
}

function logout() {
$this-redirect($this-Auth-logout());
$this-Session-destroy('user');
$this-redirect('login'); 
}
}
?

##
user.php - model
##

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

##
login.ctp - view
##

?php
if  ($session-check('Message.auth')) $session-flash('auth');
echo $form-create('User', array('action' = 'login'));
echo $form-input('username');
echo $form-input('password');
echo $form-end('Login');
}
?
-- 
View this message in context: 
http://n2.nabble.com/Simple-Auth-Login-System-%28Code-Included%29Need-Tips-tp2547075p2547075.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: Simple Auth Login System (Code Included) -- Need Tips

2009-03-27 Thread programguru


Forgot to mention:

1) My database and table are created and working OK with my script.

-- 
View this message in context: 
http://n2.nabble.com/Simple-Auth-Login-System-%28Code-Included%29Need-Tips-tp2547075p2547080.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: Simple Auth Login System (Code Included) -- Need Tips

2009-03-27 Thread programguru


#
app_controller.php 
#
class AppController extends Controller {

var $helpers = array('Html','Form','Javascript');
var $components = array('Auth');

}

-- 
View this message in context: 
http://n2.nabble.com/Simple-Auth-Login-System-%28Code-Included%29Need-Tips-tp2547075p2547094.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: Simple Auth Login System (Code Included) -- Need Tips

2009-03-27 Thread programguru


To further add, how would my directory structure need to be in order to most 
efficiently create this system?

For example, in my views/CMS/index.ctp view, I will have links titled:

Manage States
Manage Cities
Manage Towns

I will need to be able to click on any of those links, and access a direct list 
for CRUD(ing) of the one selected.

Will each of the above need to be created as such?

views/state/index.ctp
views/city/index.ctp
views/town/index.ctp

I have already been through many tutorials, but nothing as advanced as what I 
am attempting now, so I just want to make sure I am going about this sensibly 
and per the correct MVC pattern.

Is what I am writing logical and making sense or am I way off here?













-- 
View this message in context: 
http://n2.nabble.com/Simple-Auth-Login-System-%28Code-Included%29Need-Tips-tp2547075p2547128.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: Simple Auth Login System (Code Included) -- Need Tips

2009-03-27 Thread programguru


I should also add, when I log in, I am redirected to my home page. And this is 
obviously not correct.
-- 
View this message in context: 
http://n2.nabble.com/Simple-Auth-Login-System-%28Code-Included%29Need-Tips-tp2547075p2547136.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Get all USER info

2009-03-27 Thread Dave Maharaj :: WidePixels.com
I know this is a noobie question. I cant remember how to display all the
user info in the array. I see the Auth array but I want to see all the
messages / posts / questions that the user has entered in the site.
 
Can someone please help me.I tried debug but that did nothing...I just cant
remember how to do it.
 
Thanks
 
Dave 

--~--~-~--~~~---~--~~
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: Get all USER info (code)

2009-03-27 Thread Dave Maharaj :: WidePixels.com
Sorry forgot the code:
 
Now the slug is in the USERS table not the PROFILES... I had the slug in the
PROFILES table first and I had it working the way I wanted but moved it to
USERS table and now its not working.
 
This is in the profiles_controller 
 
var $uses = array('Profile', 'User');
 
function update_languages($slug = null)
{
if ($this-RequestHandler-isAjax()) {
$this-set('language', $this-User-findBySlug($slug));
if (!empty($this-data)) {
if ($this-Profile-save($this-data)) {
$this-view_profiles($slug);
}
}
$languages = $this-Profile-Language-find('list',
array('fields' = 'name', 'order' = 'name ASC'));
$this-set(compact('languages'));
}
if (empty($this-data)) {
$this-data = $this-User-findBySlug($slug);
}
}

  _  

From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] 
Sent: March-27-09 9:15 PM
To: cake-php@googlegroups.com
Subject: Get all USER info


I know this is a noobie question. I cant remember how to display all the
user info in the array. I see the Auth array but I want to see all the
messages / posts / questions that the user has entered in the site.
 
Can someone please help me.I tried debug but that did nothing...I just cant
remember how to do it.
 
Thanks
 
Dave 




--~--~-~--~~~---~--~~
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: Count related results

2009-03-27 Thread mscdex

On Mar 27, 5:12 pm, Maldras miguel.he...@gmail.com wrote:
 I'm trying to get a List of posts and the number of related comments.
 Using find('count') for each post is unelegant and adds unnecessary
 overhead, and I don't want to add a new field to the database to use
 counterCache.
 Is there any way to solve this with cakePHP under these conditions?
 Using sql it would be just a join with a group by... I'm new to
 all these ORM problems (and solutions).
 Thank you.

There may be a way to generalize the code below, but I haven't had the
time to do that though. However, I think this code should get what you
want (adjust Post.* to fit your Post field needs), provided you have
the Containable behavior set up for the model(s) involved:

$results = $this-Post-find('all', array('fields' = array('Post.*'),
'contain' = array('Comment' = array('fields' = array('COUNT
(Comment.id) AS NumComments'))), 'group' = 'Post.id'));
$count = count($results);
for ($i = 0; $i  $count; $i++) {
if (!empty($results[$i]['Comment']))
$results[$i]['Post']['NumComments'] = $results[$i]['Comment'][0]
['Comment'][0]['NumComments'];
else
$results[$i]['Post']['NumComments'] = 0;
unset($results[$i]['Comment']);
}

I tried this code out locally and it works for the situation you
described.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Best Practise: Protecting against unallowed save()

2009-03-27 Thread Aurelius

I'm working about 2 month with Cake, but its my first bigger app.
I want to write my own security function which would check before each
save() if the save model is associated to the logged in user, what
would be the best way to do that?

My Ideas till now:
a beforeSave() function in Appmodel:
  + DRY
  + relative secure
  - if I use more than one save() its inefficient (I have up till 8 on
one page)
  - I don't have a clue how I can check newly created ones with no id

a beforeSave(9 in each Modell:
 - even more crappy than above

a validation-function in the controller
 - not DRY
 - more code
 + could work with allready readed data

I believe that there must be more peaple out there with the same
problem, are there any finished solutions?

Any Ideas or thoughts are welcome!

thx
Aurelius
--~--~-~--~~~---~--~~
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: URL-mapping

2009-03-27 Thread Jeroen van Ingen

I tried but I can't get it to work
I added the following lines to the httpd.conf file:
RewriteEngine On
RewriteRule ^/site2(.*) /site1$1
This works fine, but doesn't solve my problem. It still generates
links like http://localhost/site1 instead of links like http://localhost/site2

If I add the following lines to httpd.conf the server will not start
RewriteEngine On
RewriteBase /site2
RewriteRule ^/site2(.*) /site1$1

If I add the following line to .htaccess, it even won't work:
RewriteBase /site1

What am I doing wrong?

On 27 mrt, 03:50, Dr. Loboto drlob...@gmail.com wrote:
 You should add RewriteBase /site2 directive into your
 webroot .htaccess for site2.

 On Mar 26, 11:18 pm, Jeroen neob...@gmail.com wrote:

  My Windows-PC has one http-dir called C:/xampp/htdocs/site1 and I
  configured Apache to map site2 to the same location (C:/xampp/htdocs/
  site1).
  At the moment I configured apache as follows:
  AliasMatch ^/site2(.*) C:/xampp/htdocs/site$1

  When I go tohttp://localhost/site2/controller/action Apache maps
  it to site1 and the URL in the browser the URL is 
  stillhttp://localhost/site2/controller/action. So far, so good.
  The problem is on every page the links generated are as 
  follows:http://localhost/site1/controller/action and I want links 
  likehttp://localhost/site2/controller/action.

  Is it possible to let Apache generate 
  linkshttp://localhost/site2/controller/action
  on every page? If so, how?
  If Apache can't generate links 
  likehttp://localhost/site2/controller/action,
  how can I let Cake generate links 
  likehttp://localhost/site2/controller/action
  when I'm 'incoming' from site2 instead of site1?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Array Help

2009-03-27 Thread Dave

I am trying to update a Profile by using a slug that was created and
saved in the User table. What I need to do is get the Profile.id using
the $slug that is in User.slug

In the controller:

This is in the profiles_controller

var $uses = array('Profile', 'User');

function update_languages($slug = null)
{
if ($this-RequestHandler-isAjax()) {
$this-set('language', $this-User-findBySlug($slug));
if (!empty($this-data)) {
if ($this-Profile-save($this-data)) {
$this-view_profiles($slug);
}
}
$languages = $this-Profile-Language-find('list', array
('fields' = 'name', 'order' = 'name ASC'));
$this-set(compact('languages'));
}
if (empty($this-data)) {
$this-data = $this-User-findBySlug($slug);
}
}


I managed to get the info from the array:

Array
(
[User] = Array
(
[id] = 3
[group_id] = 3
[username] = dave
[password] =
[email] =
[slug] = davetest
[confirmed] = 1
[confirm_code] = 49cc5013-0380-4086-bd30-448c4adcd75b
[created] = 2009-03-26 22:03:31
[modified] = 2009-03-26 22:03:31
)

[Group] = Array
(
[id] = 3
[name] =
[created] = 2009-03-26 22:02:30
[modified] = 2009-03-26 22:02:30
)


[Profile] = Array
(
[id] = 1
[user_id] = 3
[rank_id] =
[searchable] = 0
[firstname] = dave
[lastname] = test
)

)


--~--~-~--~~~---~--~~
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: Building a nearly 100% AJAX app - questions

2009-03-27 Thread mark_story

You're in for a long uphill battle :)  Ajax can get tricky and messy
very quickly as you've found out, and you have to deal with cross
browser issues.  So its not an easy fight by any means.  Both jQuery
and Prototype are good libraries and they offer much of the same
features. Its really a matter of personal choice and what tool you
think is going to work best for you.  The ajax helper is only intended
as way to sprinkle some javascript into your application.  Attempting
to build a large Javascript application with only the helper would be
foolish. If you are feeling lost and without structure, perhaps find
some more dynamic sites and pick apart their source.  Or look into
client side MVC implementations like Jamal or JsMVC.  There are also
extensive ui toolkits for dojo, YUI, and ExtJS which can help a lot as
well.

-Mark

On Mar 27, 11:04 am, logout stefano...@gmail.com wrote:
 Hi, Bakers!

 I've been digging in CakePHP over a month (I am new to PHP, SQL, CSS,
 JavaScript, AXAJ, and almost whatever Web related programming You may
 think of). In case you wander, I've been programming controllers in
 pure C (some of you may heared of this ancient language).

 So I had to read tons of electronic paper (oh, my poor eyes, and what
 was that word 'pillow' standing for?)

 But so far, so good. I had a lot of troubles (maybe I'll document them
 some day) with making this AJAX thing to work properly and to find
 ways to make my app look like and behave as a desktop one.

 So I have one BIG question: should I stick with the Prototype library,
 or should I invest some more time in mastering the jQuery and use it
 instead? Prototype does the job for now, but I hear that jQuery is
 simpler and more convenient to use. I must decide quickly, because the
 clock is ticking and I have an application to build. The Ajax Helper
 is helpful, but I guess not enough, according to some people.

 Also, I want to ask if there is a better way to tickle the fields of
 a form (i.e. to modify their content/value and properties after an
 ajax request) than to return javascript by the view (which script is
 thrown away after its evaluation/execution). I still use the MVC
 paradigm for the job, but I need to set values and properties
 dynamicly in the form, preserving the form's actual view and data
 (with the ability to use the embeded validation mechanism, provided by
 the model) until final submition.
 What I mean is populating a combo with options based on the choice
 made in another combo, enableing other fields when it is time for
 them to be used, inserting other items in a list and evaluating some
 totals to be put in some input fields automatically. And some choices
 made should be validated at submission (like checking for empty
 fields, for example). Also I don't want to do extra quering the
 database and rendering the form over and over at every change, keeping
 track of the work done so far (what's the point in doing ajax requests
 then?).

 So, as we know, putting logic in the view is a bad thing, but how you
 execute dynamic scripts, if they are not in the returned content? And
 by dynamac I mean script, that will do it's job after the ajax call
 and then vanish into oblivion.

 Or am I just too confused with this soup of technologies, trying to
 consolidate them in the context of Cake... The next month or so my
 life will still suck a lot.

 P.S. Why there is a word nearly in the caption? Because only the
 login form is not ajaxed, and the logged user/admin is redirected to
 the main view. Everything else is happening in that main view.

 P.S.S. Sorry for the long post...
--~--~-~--~~~---~--~~
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: Login Security

2009-03-27 Thread mark_story

Another thing you can do is only allow each user to maintain one
session.  Keep a record of the session hash key in the database and
compare on each request.  If a user logs in from a different machine
they will get a new session hash and invalidate the old session hash.
This gets around the lockout situtations you could run into.

-Mark

On Mar 26, 2:00 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 Just a general question.

 Can I restrict a user to only allow the user to be logged in from one
 location...sounds stupid but some people share acct info with friends /
 family so this would restrict a user from logging in only once.

 So for example on login update a field in the user table LOGGEDIN to 1 and
 on logout set it to 0. So if Jeff shares his acct info with his wife and
 Jeff logs in then his wife tries to log in (it checks LOGGEDIN if set to 1
 someone is already logged in on that acct) she cant because Jeff is already
 logged in.

 Or does cake take care of this? If so are both allowed to login in at the
 same time? Does 1 get the boot?

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



Auth Unexpected Behavior

2009-03-27 Thread rartavia

Hello there, I'm having kind of a hard time setting up Auth Component,
i'm getting really weird behavior. After configuring my Auth  Acl..

I know its a large post, but PLEASE HELP!!
I'm initializing with this code:

function initDB() {

$aro = new Aro();
$aros = array(
0 = array('model' = 'Group', 'foreign_key' = 1),
1 = array('model' = 'Group', 'foreign_key' = 2),
2 = array('model' = 'Group', 'foreign_key' = 3),
3 = array('parent_id' = 1, 'model' = 'User', 
'foreign_key' =
1),
4 = array('parent_id' = 2, 'model' = 'User', 
'foreign_key' =
2),
5 = array('parent_id' = 3, 'model' = 'User', 
'foreign_key' = 3)
); // users  groups mysql tables all ready have 3 records each

foreach($aros as $data)
{
$aro-create();
$aro-save($data);
}

// Reads Configure::listObjects('controller') and create an aco 
node
// for each Controller with aco root Controllers/
$this-buildAcl();

$group = $this-User-Group;

// Allow admins to everything
$group-id = 1;
$this-Acl-allow($group, 'Controllers');

// Deny all to none admins
$group-id = 2;
$this-Acl-deny($group, 'Controllers');
$group-id = 3;
$this-Acl-deny($group, 'Controllers');

}

In my AppController

var $components = array('Auth', 'Acl', 'RequestHandler', 'P28n');
var $helpers = array('html', 'javascript', 'form');

function beforeFilter() {
//Configure AuthComponent
$this-Auth-allowedActions = array('display', 'index',
'view');

$this-Auth-authorize = 'actions';
$this-Auth-loginAction = array('controller' = 'users',
'action' = 'login');
$this-Auth-logoutRedirect = array('controller' = 'users',
'action' = 'login');

$this-Auth-actionPath = 'Controllers/';

}

It all started because I'm using swfupload and it worked quite all
right without Auth. After auth once I logged in, got to my view, and
when trying to upload (ajaxly through /uploaded_imgs/upload) i gotten
for response the login page telling me there's no authorization for
that request and I discovered that even after login, Auth-user() was
null in that ajax call. If I called /uploaded_imgs/upload directly
from through the address bar Auth-user() was present. However trying
another ajax call, not with swfupload, the auth-user was also
present.

Then i went futher to see what the heak was happening, take a look at
this stuff...

// this is not allowed without login in with or without the commented
lines
// note function has single word name
function publishment(){
$this-layout = denouncements_publish;
//$data = $this-requestAction('/damages/all');
//$this-set('damages', $data);
}

// this is not allowed without login in with or without the commented
lines
// note function has single word name
function pub(){
$this-layout = denouncements_publish;
//$data = $this-requestAction('/damages/all');
//$this-set('damages', $data);
}

// this is allowed without login with those lines commented, how
ever
// when those lines are executed aint allowed. Note 2 words function
name
function publishmentTest(){
$this-layout = denouncements_publish;
//$data = $this-requestAction('/damages/all');
//$this-set('damages', $data);
}

// this is not allowed without login in
// note function has single word name
function jsonfields(){
$this-layout = null;
$this-set('json', 
json_encode($this-Denouncement-query(DESCRIBE
denouncements, true)));
}

// this is not allowed with or without login in
// note function has multiple words name
function fieldNamesJson(){
$this-layout = null;
$this-set('json', 
json_encode($this-Denouncement-query(DESCRIBE
denouncements, true)));
}

So, getting to the point, how do I get Auth working correctly,
authorizing only the allowed actions declared in appController and
denying the rest to unidentified users. And also, why might uploading
(swfupload) the ajax call to /uploaded_imgs/upload is restricted while
addressbar called works correctly. Why is Auth letting unidentified
calls to some non allowed actions and whats the deal with functions
names that affects Auth for allowing or not a request? any ideas?

I'll really really appreciate any help
thanks a lot
regards
--~--~-~--~~~---~--~~
You received this