Re: cPanel shared hosting

2009-08-11 Thread brian

That seems like a good way to do it. I'm a big fan of being able to
easily switch between versions.

I'll package it up like that and see if I can make it work.

On Mon, Aug 10, 2009 at 9:50 PM, JamesFusaexportexpe...@gmail.com wrote:

 my cpanel setup is as follows

 /home/jamesf/

 is my cpanel accounts directory on the server

 /home/jamesf/public_html
 is where apache serves the webroot stuff

 i set my cakephp lib stuff into a dir above public_html

 /home/jamesf/usr/cakedev/cakeversion/cake/

 and my app stuff in a seperate folder for my different versions

 /home/jamesf/usr/myapp/versionx123/

 that way when i pop in a new version i just create a new directory.

 all the webroot stuff img/css/js is in public_html root with the
 default htaccess that ships with cake.

 you have to edit index.php in /public_html/ and point it to those
 absolute paths you are using.

 i personally wouldn't keep my /app and /cake folders in the /
 public_html directory as a matter of security.

 On Aug 10, 7:31 pm, thatsgreat2345 thatsgreat2...@gmail.com wrote:
 I usually have the app still inside the cakephp directory, and then
 depending if I have multiple apps on the host depends if I put webroot
 in subfolders, or just in public_html. Then just have to modify the
 index.php in the webroot to direct it to the location of cakephp for
 the root, and then the name of the app folder. Then all you have to
 worry about is mod_rewrite and you are good to go.
 /public_html
 ../webroot stuff here
 /cakephp
 ../app

 On Aug 10, 3:44 pm, Alexandru Ciobanu ics.cake...@gmail.com wrote:

  On 8/10/2009 6:03 AM, brian wrote:

   To complicate things, I need to access this other site through an IP,
   not a domain. If anyone has done this, could you please post some
   hints?

  Hi Brian,

  I've deployed several cake apps on cPanel shared hosting. Nothing to be
  customized, just drop the entire application in public_html or www ( in
  most cases a symlink to public_html).

  Resulting tree:

  $ ls public_html/
  app/
  cake/
  .htaccess
  index.php
 


--~--~-~--~~~---~--~~
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: cPanel shared hosting

2009-08-11 Thread brian

That seems like a good method for this instance, where there isn't
(likely) to be a bunch of other Cake apps floating around. So, no need
to make the libs shareable.

On Mon, Aug 10, 2009 at 7:31 PM, thatsgreat2345thatsgreat2...@gmail.com wrote:

 I usually have the app still inside the cakephp directory, and then
 depending if I have multiple apps on the host depends if I put webroot
 in subfolders, or just in public_html. Then just have to modify the
 index.php in the webroot to direct it to the location of cakephp for
 the root, and then the name of the app folder. Then all you have to
 worry about is mod_rewrite and you are good to go.
 /public_html
 ../webroot stuff here
 /cakephp
 ../app

 On Aug 10, 3:44 pm, Alexandru Ciobanu ics.cake...@gmail.com wrote:
 On 8/10/2009 6:03 AM, brian wrote:

  To complicate things, I need to access this other site through an IP,
  not a domain. If anyone has done this, could you please post some
  hints?

 Hi Brian,

 I've deployed several cake apps on cPanel shared hosting. Nothing to be
 customized, just drop the entire application in public_html or www ( in
 most cases a symlink to public_html).

 Resulting tree:

 $ ls public_html/
 app/
 cake/
 .htaccess
 index.php
 


--~--~-~--~~~---~--~~
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 some page .../id disappeared ?

2009-08-11 Thread brian

@James

I thought at first that looked like a real pain but verbose array
linking (finding, routing, containing, etc.) is definitely the way to
go, I agree. It's often self-documenting, for one thing. And it goes
to the heart of what Cake is, I think. Big kudos to the devs for
pulling this together so coherently.

On Mon, Aug 10, 2009 at 9:53 PM, JamesFusaexportexpe...@gmail.com wrote:

 @euromark

 your code is certainly more to the point, but i can't break the habit
 of verbosely linking all my actions.

 On Aug 8, 9:53 pm, euromark (munich) dereurom...@googlemail.com
 wrote:
 as i said, i would go with JUST url=/.$this-params['url]['url']
 in this case there is no need to use action or the manually built
 url like james suggested

 be aware of the / in front of it though (otherwise the url is not
 built correctly)

 On 9 Aug., 02:06, JamesF usaexportexpe...@gmail.com wrote:

  make sure you $form-create is submitting to the id as a parameter as
  well

  echo $form-create('FormName', array('url'=array
  ('controller'='myController', 'action'='myAction', $id,
  'admin'=true)));

  On Aug 7, 7:13 pm, leafchild leafchild.b...@gmail.com wrote:

   URL some page  .../id disappeared ?

   I have site there are different form pages to organize products.

   Some form page such as admin_edit page - URL:  ... admin/product/edit/
   1
   After I submit URL still same either there is an error or not.

   However, some form page lose id from URL after submit,
   and showing index error.

   for example, URL: ...admin/category/customer/edit/1 - ...admin/
   category/customer/edit
   ==
   if (!empty($this-data)) {
      // empty}

   ==
   I deleted all the code inside of if statement for taking care of
   submitting data.
   The one keep same URL doesn't show error but other does.

   Not sure difference between these two has.
   I don't know why? Does anyone know what's the issue?
 


--~--~-~--~~~---~--~~
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: Array help

2009-08-11 Thread Martin Westin


If looping the results start becoming too slow for you, you can force
Cake to do a join which will make the whole result disappear if the
Post is empty.

Nate wrote about it and inspired me to build my own variation.
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find

My take on it was to make the syntax as close to Containable as I
could. I pasted some code into the bin for anyone who wants a peek.
Feel free to make use of it... if it works for you. I have only tested
it in a very limited way and do not use it that much.
http://bin.cakephp.org/view/992365224





On Aug 11, 5:44 am, joshua josh...@gmail.com wrote:
 I think you can define a model level filter, it will help you to solve this
 problem thoroughly. Just an idea of mine. Maybe you can put the filter
 engine in AppModel.[Client]  {Filter engine}  [Server]
 [Client] --- {Filter engine}  [Server]

 For a temporary solution, I think the loop is enough:
 Assume the return result something like this:

 [0] = Array
        (
            [Bookmark] = Array
                (
                    [id] = 38b7276f708
                    [user_id] = 4a5d569f-b9e8-416d-b34c-11cf4adcd75b
                    [post_id] = 11e7ee
                    [created] = 2009-08-09 21:59:01
                )

            [Post] = Array
                (
                    [title] = Test Title
                    [rank] = 2
                    [created] =
                    [description] = Test dscription
                    [id] = 52louj

                )

        )
 [1] = Array
        (
            [Bookmark] = Array
                (
                    [id] = 38b7276f708
                    [user_id] = 4a5d569f-b9e8-416d-b34c-11cf4adcd75b
                    [post_id] = 11e7ee
                    [created] = 2009-08-09 21:59:01
                )

            [Post] = Array
                (
                    [title] =
                    [rank] =
                    [created] =
                    [description] =
                    [id] =

                )

        )

 [CODE]
 foreach ($bookmarks as $key = $value) {
      if (empty($value['Post']['id'])) {
       unset($bookmarks[$key]['Post']);
      }}

 [/CODE]
 On Tue, Aug 11, 2009 at 11:19 AM, Dave Maharaj :: WidePixels.com 





 d...@widepixels.com wrote:
   The thing is the Post info is there in the database

  Scenario:
  The Post article has access level of 1
  User that has an access level of 1 can see the Post and bookmark it. No
  problem

  Later the owner of the Post changes the access level to 3the user with
  level 1 access can no loger see that Post because his access level is too
  low, but his Bookmark for that Post still exists. But because the contain
  will pull all bookmarks that belongto the user andgetthe Posts where $access
  = 'Post.access' that info is no longer goingto get pulled, thats why it
  appears blank.

  So I need to completely remove that bookmark from the array.

  Trying something like:

  foreach ($bookmark as $key = $value) {
       if (empty($value)) {
        unset($q[$key]);

  but cant get it to work...still messing around with it

   --
  *From:* joshua [mailto:josh...@gmail.com]
  *Sent:* August-11-09 12:41 AM
  *To:* cake-php@googlegroups.com
  *Subject:* Re: Array help

  1. Use a callback function afterFind to loop the return array, remove the
  empty item. 2. How about give a condition when model-find.
  [CODE]
  'conditions' = array((*not* = array ( Post.id = *null* )), //array
  of conditions
  [/CODE]
  On Tue, Aug 11, 2009 at 10:25 AM, Dave Maharaj :: WidePixels.com 
  d...@widepixels.com wrote:

  I have a contain query which produces these results.

  Basically the user bookmarked a page when they had access. The Owner of
  the
  post has changed the level of who can view the Post so in this case this
  user no longer can view the post hence the missing post data. It was not
  grabbed because the conditions of the Post did not match the users access
  level.

  But the bookmark still exists. Now in the query it pulls all bookmarks for
  the user and the post related to the bookmark. How can I remove [1] from
  the
  array all together or all from the array if [Post] has no data? I can not
  delete the bookmark when Posts change the access level because they may
  change it back to a lower setting and allow those who did have it
  bookmarked
  to once again have access. I just need to remove the array entry(s) where
  the  Post array is empty.

  [0] = Array
         (
             [Bookmark] = Array
                 (
                     [id] = 38b7276f708
                     [user_id] = 4a5d569f-b9e8-416d-b34c-11cf4adcd75b
                     [post_id] = 11e7ee
                     [created] = 2009-08-09 21:59:01
                 )

             [Post] = Array
                 (
                     [title] = Test Title
                     [rank] = 2
                     

Re: Storing arrays in the database (one field many values)

2009-08-11 Thread Rawna

Do I need to set foreign keys (author_id, book_id) to the tables
(books, authors)? How do I make my views have multiple selection
fields and how do I store them (because they're in an array)?

On Aug 7, 10:15 am, Robert P shiftyrobs...@gmail.com wrote:
 Well, if Books can have more than one Author in your system then it's:
     Authors hasAndBelongsToMany Books
     Books hasAndBelongsToMany Authors

 But if each book can only have one Author then it would be:
     Authors hasMany Books
     Book belongsTo Author

 with the foreign keys set up as required.

 Please read the Cookbook 
 -http://book.cakephp.org/view/78/Associations-Linking-Models-Together

 On Aug 7, 8:29 am,Rawnaasumaw...@gmail.com wrote:

  On Aug 7, 2:48 am, Vijay Kumbhar k.vidn...@gmail.com wrote:

   Better way please create new table that will take the book_id  the
   auther_id so that you can associate the models.

  What Model relationship should I do to create that? Could you please
  give an example?


--~--~-~--~~~---~--~~
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: Assigning, accessing and comparing viewVars in a controller...

2009-08-11 Thread brian

On Mon, Aug 10, 2009 at 1:24 PM, gestejim.ho...@gmail.com wrote:

 Brian,

 Many thanks.  I got over a bit of a hump on this on Friday with your
 help.  I do of course have another n00b follow up question :)

 I am using the authake plug-in for group-based authorization (this
 nice plug-in has been taken over by Marco Sbragi and is on CakeForge:
 http://cakeforge.org/projects/authake2/

 I has a number of functions such as getLogin() and isPermitted() that
 seem to work in views.  For example, I can user getLogin() to display
 user ID on the menu page with

   echo $authak3-getLogin()

 However, if I try to access the same function in my
 menus_controller.php with:

  $testuser = $authak3-getLogin();

 I then get a completely empty page/view.

 I am trying to determine if there is some sort of a general rule about
 scope of functions between controller and view that makes the whole
 thing bomb if I reference it from controller.

 One thing I am guessing is relevant is that Authake is referenced in
 the app_controller.php in a BeforeFilter() like so:

        $this-Authake-beforeFilter($this);

That's because the View knows about $authak3, the Helper, but
AppController has a handle on AuthakeComponent. I've never used the
plugin but I had a look at it just now. You can access the same data
in your controllers with $this-Authake-getLogin(), etc. Have a look
through controllers/components/authake.php for the other stuff that it
exposes. Compare that to plugins/views/helpers/authak3.php

 and all links/controllers are checked against Authake right from the
 start.  The trick is that I want to check all possible menu links for
 access right *before* I add the link to viewVars-Menu for the view to
 render.  I could access this authake3-isPermitted($menulink) in the
 view, but then I would wind up adding a pretty fair amount of logic
 like menu table queries to the view.  I'm trying to make as much of
 that work in the controller as I can.

It looks like you can get that from the component with
$this-Authake-isAllowed(...).

 So any, broad clue about this appreciated. My question was starting to
 get somewhat Authake-specific, but I think I am probably missing
 something very general, very basic.

Some of it's basic--keeping components and helpers straight (and I
still get mixed up)--but having a concrete plugin (mini-app) as an
example is actually pretty helpful. And the Authake-specific stuff is
actually pretty important. I recently created a similar app using ACL,
where the menu changes drastically between groups. Make sure to look
into view caching so your controller can skip a lot of querying. You
can name each view for the group_id, for instance. This makes it easy
to delete when something Group-specific changes.

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



wrapper function not working!

2009-08-11 Thread armen

This is the link to the webpage that im working on...
http://warplayart.com/bleed_till_death/UserLoging/users
and this is the link that you register a user...
http://warplayart.com/bleed_till_death/UserLoging/users/register

But the form on the register page, calles add in for it's action
variable, even though im calling the register function from the url.
So i ended up using a wrapper like this which doesn't work.

What am i doing wrong?

+ when i was just using the add (http://warplayart.com/
bleed_till_death/UserLoging/users/add) and placed the code inside the
add function it worked fine.

-
function add()  {
$this-register($this-data);
  }

function register($data = null) {

  if (!empty($data)){

$data['User']['password'] = md5($data['User']['password']);
$this-User-create();

  if ($this-User-save($data)) {
   $this-Session-setFlash(__('User 
successfully registered',
true));
 $this-Session-write('User', $data);
 $this-redirect('index');
 exit();
  }
  else {
   $this-Session-setFlash(__('The Post could 
not be saved.
Please, try again.', true));
  }
  }
  }



Thanks in advance.

--~--~-~--~~~---~--~~
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: possible to do validation in not current model? where should I put validation??

2009-08-11 Thread leafchild

Thanks brian, now I can put my validation code at model.



On Aug 7, 6:26 pm, brian bally.z...@gmail.com wrote:
 I'm not sure that I understand your question. But you can call the
 model's function directly from the controller.



 On Fri, Aug 7, 2009 at 4:42 PM,leafchildleafchild.b...@gmail.com wrote:

  Thanks, brian. but can I associate with my validation macadamized
  function?

  so if set validation in Size model:

  =
  ...
                 'size_name' = array(
                         'namechk'=array(
                                 'rule'=array('namechk'),
                                 'message'= 'Please enter different name.'
                         )
  ...

  ...
         function namechk($size_name){
              /* want to check if size_name exist with same category_id
  here
                 If there is same size_name but different category id
  then it's ok */

         }
  =

  Thanks,
  leaf child

  On Aug 4, 5:15 am, brian bally.z...@gmail.com wrote:
  Create some method in the Size model and pass the category_id to it:

  if ($this-Product-Size-yourMethod($category_id))

  On Mon, Aug 3, 2009 at 3:45 PM,leafchildleafchild.b...@gmail.com wrote:

   thanks brian.

   Is possible to pass specific value to validation at model(Size model
   in this case)

   I want to create custom validation but I need to pass value to do it.
   (in this case, category_id)

   thanks,
  leafchild

   On Aug 2, 8:49 am, brian bally.z...@gmail.com wrote:
   Try this:

   $this-Product-Size-set($this-data);

   if ($this-Product-Size-validates())
   {
       ...

   On Fri, Jul 31, 2009 at 3:12 PM,leafchildleafchild.b...@gmail.com 
   wrote:

For example

There are 3 tables categories, products and sizes, and I'm
working on product page (product.php, products_controller.php,
product.ctp).

The database looks like this.
sizes:
---
|        id           |
---
| category_id   |
| size_name    |
--

products:
---
|        id            |
---
| sku                |
| category_id     |
| product_name |
| size_id           |


categories:
---
|        id                |
---
| category_name   |
---

Product page can add/edit product:
Before I save new product the page also can  add new size.

I can verify a product data such as sku value from the model but I
want to also make sure,
user can add new size name if it's not exist in the system(not exist
in size table).

I want to put validation code in model.

Should I put validation code in size.php or product.php

Also if I want validate this then I have to pass category also.
(same size name can be exist if it has different category id)
How can I pass specific value to model so I can set vilification in
mode and not controller?

Or in this case I should just put code in controller?

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



Re: Log Errors when debug = 0?

2009-08-11 Thread bram

I do know it's possible to write all cake debugging and error info to
the log file. But I don't know how to enable it without a small
modification in the cake source code. I've asked a similar question a
couple of days ago, but no replies

http://groups.google.com/group/cake-php/msg/05dfde6ad7ebfed2?hl=en

Bram

On Aug 10, 11:22 pm, David sirdavid...@gmail.com wrote:
 I would like to silently write errors to error.log when in production
 mode. It would be useful to catch anything going wrong that I hadn't
 previously noticed.
--~--~-~--~~~---~--~~
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 Errors

2009-08-11 Thread Saliem

I am not quite sure what you are missing but you might want to double
check a couple of things including:

the name of your aliquot model file,
the validate variable in your aliquot model file and
try using the validationErrors method available for each of the models
created and returning any errors as json

please see :

http://book.cakephp.org/view/410/Validating-Data-from-the-Controller


On Aug 10, 3:42 pm, Tony Thomas truet...@gmail.com wrote:
 This is something that's so simple, I'm embarrassed to ask. But after
 a few dozen Google searches, I'm going to swallow my pride and post my
 question here.

 I have a simple ajax function in my controller and I want it to return
 an error is the request is not successful. For example:

 function ajax_update_box($boxId, $aliquotIds){
         if ($this-RequestHandler-isAjax()) { // if the request is AJAX
                 if($aliquots = $this-Aliquot-validateMove($aliquotIds, 
 $boxId))
 { // make sure a slot is open in the box
                         foreach($aliquots as $aliquot_id = $position ) { // 
 validateMove
 returns an array
                                 if 
 ($this-Aliquot-save($this-data['Aliquot'] =! true)) {
                                         Configure::write('debug', 0);
                                         $this-autoRender = false;
                                         exit('There was an error and some of 
 the aliquots were not
 moved.');
                                 }
                         }

                         echo $this-unstored();

                 } else { // this is where I want it to return an error.
                         Configure::write('debug', 0);
                         $this-autoRender = false;
                         exit('The move did not work. Check to see if the box 
 is full.');

                 }
                 Configure::write('debug', 0);
                         $this-autoRender = false;
                         exit(0);
         }

 }

 If the request doesn't pass validation in my model, I want to display
 an error message, but I can't seem to get that to work. Everything is
 treated as success. What am I missing?
--~--~-~--~~~---~--~~
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: Uploading file issue - worning mkdir()

2009-08-11 Thread leafchild

The uploaded img directory permission is set to 777 and just in case I
even changed webroot permission to 777
but I'm still seeing  same warning message. Where else I need to
check?

Also how can I stop update with entire file data to database?

after trying to upload file debug show:
==
[id] =1
[uploadfile] = Array
   (
   [name] = IMG_0801.JPG
   [type] = image/jpeg
   [tmp_name] = /tmp/phpbo9DjW
   [error] = 0
   [size] = 404887
   )
[desc] =
...
===

uploadfile field needs only file name but looking at sql trying to
update
filed with file array information.






On Aug 7, 6:24 pm, brian bally.z...@gmail.com wrote:
 Check the permissions for the directory. The webserver has to have
 write access to the dir.



 On Fri, Aug 7, 2009 at 4:02 PM,leafchildleafchild.b...@gmail.com wrote:

  I'm trying to make this plugin(http://www.milesj.me/resources/script/
  uploader-plugin) works.

  However, after I install I'm getting an error - Warning (2): mkdir()
  [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line
  466]
  Actually I tried another behavior to upload file and got same error.
  Do  I need to do some kind of server setting? I'm using MT(dv)

  Also after submit to upload file I'm getting an SQL error because data
  need to be one but it try to update entire file data:

  ==
  [id] =1
  [uploadfile] = Array
                (
                    [name] = IMG_0801.JPG
                    [type] = image/jpeg
                    [tmp_name] = /tmp/phpbo9DjW
                    [error] = 0
                    [size] = 404887
                )
  [desc] =
  ...
  ===
  uplodefile 's data is not array just [NAME] of file.

  How can I stop doing it? I can't use $this-Landing-save($this-
 data) if I have file uploading?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Default values in select lists

2009-08-11 Thread jburns

How can I add a blank value (something like Please select a value)
to the top of a select list when using $this-Xxxx-Yyyy-find
('list'); instead of defaulting to the first value in the list?
--~--~-~--~~~---~--~~
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: Default values in select lists

2009-08-11 Thread arif hossen
You can use below code cakephp format.

?php

echo $html-input('listname',array('options'=$mylist,'Selected'='Please
select a value));



?


On 8/11/09, jburns jeremybu...@me.com wrote:


 How can I add a blank value (something like Please select a value)
 to the top of a select list when using $this-Xxxx-Yyyy-find
 ('list'); instead of defaulting to the first value in the list?
 



-- 


Regards,
Mohammad Arif Hossen
Web Developer
United Group International(UGIBD)
www.ugibd.net
Mobile no:  +88 01714355911
Mobile no:  +88 01922110308

--~--~-~--~~~---~--~~
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: MISSING TABLE

2009-08-11 Thread Walther

Firstly, the $name must be == to the name of the Model. $name is used
to compatibility in php4

Secondly, The WorksCollections controller is looking for the
WorksCollection model. Cakephp only singularises the last word in a
multi word name. So you should rename your WorkCollection model to
WorksCollection.

Thirdly, your table name has the prefix cc_ so your are going to need
to set that either in the database configuration (if shared by all
your tables), or in the model (See api.cakephp.org)

On Aug 9, 11:01 pm, JuanWalker juanwal...@gmail.com wrote:
 Hi Guys, I've this problem. I've a table called cc_works_collections
 that I've created on mysql db.

 These are the controller and the model of this table (Using scaffold)

 class WorksCollectionsController extends AppController {

         var $name = 'WorksCollections';
         var $scaffold;

 }

 class WorkCollection extends AppModel{

         var $name =CcWorkCollection;
         var $belongsTo =MdlAssignament;
         var $hasOne = MdlAssignamentSubmission;

 }

 When I try to test my scaffold it ask for works_collections table but
 I've specified that my table has been named cc_works_collections as
 you see on model source.

 This error is appearing :

 Missing Database Table

 Error: Database table works_collections for model WorksCollection was
 not found.

 I've deleted cache from model and nothing changes, what's going on?
 Please help me!! Many 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
-~--~~~~--~~--~--~---



Re: How can I leave entered value even there is an errro and couldn't complete

2009-08-11 Thread leafchild

Yes, I use $form-input()

I found an issue because I was SQL again for the specific data before
going back to the page to show user an errors.
(I had an code like this that's why I couldn't keep the entered value
when there is an error.
===
function admin_edit(id = null){
if (!empty($this-data)) {
...
 $this-data = $this-Customer-read(null, $id);
}
if (empty($this-data)) {
...
  $this-data = $this-Customer-read(null, $id);
 }

}
===
I took out the line $this-data = $this-Customer-read(null, $id);
in  if (!empty($this-data)) statement now I can keep the entered
value when there is an error.
However, now I have an other issue.

In this admin/customers/edit page, I need to set $this-Customer-
recursive = 6; to get all kind of information relates to Customer
from other table.
Either coming back with an error or success updating information(I
want to page to back to edit page not index page after save),
I get Undefined index error everywhere in this page because after
coming back to page, $this-data has only the information model show
relationship(I think,,, I have 4 has one relationship in this model
(Customer) and only those information is available from $this-data
after submit)

How can I get $this-data has recursive = 6 data to avoid getting
undefined index error?


thanks,
leafchild






On Aug 7, 6:22 pm, brian bally.z...@gmail.com wrote:
 Are you using FormHelper to create your form elements? If you do, for example:

 echo $form-input('Post')

 ... the helper will add the value of the element based upon $this-data.

 If you are using the helper, maybe you should post your controller and
 view code.



 On Fri, Aug 7, 2009 at 6:56 PM,leafchildleafchild.b...@gmail.com wrote:

  I have a page with form.

  If user entered name, address,,,and ,all kinds of information and
  submit but there is mistakes such as not entered email
  properly and came back to form page with error message. How can I keep
  the entered value user entered properly.

  Currently in my form page, if user has an error, all the entered value
  are gone and user has to entered everything.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



I18n table How to use ?

2009-08-11 Thread DatacenterHellas

Hello all ! :)

I'm creating an application and I like to make it multilanguage.

The question is how ? ? ?

I already have make the internationalization of the menus, I can
change languages to my interface but the question is how can I
translate my articles by using the I18n table ? ? ?

Kind regards
Merianos Nikso
--~--~-~--~~~---~--~~
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: lazy loading?

2009-08-11 Thread evilbloodydemon

take a look to http://github.com/mcurry/lazy_loader/tree/master

On Aug 10, 8:13 pm, Martin Westin martin.westin...@gmail.com wrote:
 Typical me. I never got to my real point.

 I wanted to say that if you are having serious performance problems
 even while containing queries then that is a bit odd. What is the
 difference if you bench an action with the unneeded associations
 commented out completely (which should keep the models from loading at
 all)?
--~--~-~--~~~---~--~~
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: cPanel shared hosting

2009-08-11 Thread Alexandru Ciobanu
On 8/11/2009 9:23 AM, brian wrote:
 That seems like a good method for this instance, where there isn't
 (likely) to be a bunch of other Cake apps floating around. So, no need
 to make the libs shareable.

FYI:
For shared cake libs I use the setup described in the book.
http://book.cakephp.org/view/35/Advanced-Installation
Basically I just edit the |CAKE_CORE_INCLUDE_PATH.
|

--~--~-~--~~~---~--~~
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: I18n table How to use ?

2009-08-11 Thread Marcelo Andrade

On Tue, Aug 11, 2009 at 6:23 AM,
DatacenterHellasmerianosni...@gmail.com wrote:

 Hello all ! :)

 I'm creating an application and I like to make it multilanguage.

 The question is how ? ? ?

 I already have make the internationalization of the menus, I can
 change languages to my interface but the question is how can I
 translate my articles by using the I18n table ? ? ?


Take a look at TranslateBehavior.  If you have any difficulties,
write us again.

http://book.cakephp.org/view/92/Translate

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.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: I18n table How to use ?

2009-08-11 Thread DatacenterHellas

Ok . . .

I already have find the way to use it but . . .

I have another one problem.

How to translate my content ? ? ?

in example :

I set the $this-Post-locale = gre
I save my data $this-Post-create(); $this-Post-save($this-data);

Ok until now but If i like to translate this post now how can I do
it ? ? ?

Normaly I have to change the $this-Post-locale = eng and
then ? ? ? how to continure ? ? ?
--~--~-~--~~~---~--~~
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: Uploading file issue - worning mkdir()

2009-08-11 Thread anurag pal

Hi,

I have the same issue. I found that its using different path for
uploading file.

For stopping details to database just first upload the file and then
insert or update record in database.

If you can provide the source code it would be better to diagnose the
problem.

Regards,
Anurag Pal

On Aug 11, 1:06 pm, leafchild leafchild.b...@gmail.com wrote:
 The uploaded img directory permission is set to 777 and just in case I
 even changed webroot permission to 777
 but I'm still seeing  same warning message. Where else I need to
 check?

 Also how can I stop update with entire file data to database?

 after trying to upload file debug show:
 ==
 [id] =1
 [uploadfile] = Array
                (
                    [name] = IMG_0801.JPG
                    [type] = image/jpeg
                    [tmp_name] = /tmp/phpbo9DjW
                    [error] = 0
                    [size] = 404887
                )
 [desc] =
 ...
 ===

 uploadfile field needs only file name but looking at sql trying to
 update
 filed with file array information.

 On Aug 7, 6:24 pm, brian bally.z...@gmail.com wrote:

  Check the permissions for the directory. The webserver has to have
  write access to the dir.

  On Fri, Aug 7, 2009 at 4:02 PM,leafchildleafchild.b...@gmail.com wrote:

   I'm trying to make this plugin(http://www.milesj.me/resources/script/
   uploader-plugin) works.

   However, after I install I'm getting an error - Warning (2): mkdir()
   [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line
   466]
   Actually I tried another behavior to upload file and got same error.
   Do  I need to do some kind of server setting? I'm using MT(dv)

   Also after submit to upload file I'm getting an SQL error because data
   need to be one but it try to update entire file data:

   ==
   [id] =1
   [uploadfile] = Array
                 (
                     [name] = IMG_0801.JPG
                     [type] = image/jpeg
                     [tmp_name] = /tmp/phpbo9DjW
                     [error] = 0
                     [size] = 404887
                 )
   [desc] =
   ...
   ===
   uplodefile 's data is not array just [NAME] of file.

   How can I stop doing it? I can't use $this-Landing-save($this-
  data) if I have file uploading?

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



Re: How can I leave entered value even there is an errro and couldn't complete

2009-08-11 Thread anurag pal
Hi,

Just set the Id so that it will get the reference on edit page.

Regards,
Anurag Pal

On Tue, Aug 11, 2009 at 2:36 PM, leafchild leafchild.b...@gmail.com wrote:


 Yes, I use $form-input()

 I found an issue because I was SQL again for the specific data before
 going back to the page to show user an errors.
 (I had an code like this that's why I couldn't keep the entered value
 when there is an error.
 ===
 function admin_edit(id = null){
 if (!empty($this-data)) {
...
 $this-data = $this-Customer-read(null, $id);
 }
 if (empty($this-data)) {
 ...
  $this-data = $this-Customer-read(null, $id);
  }

 }
 ===
 I took out the line $this-data = $this-Customer-read(null, $id);
 in  if (!empty($this-data)) statement now I can keep the entered
 value when there is an error.
 However, now I have an other issue.

 In this admin/customers/edit page, I need to set $this-Customer-
 recursive = 6; to get all kind of information relates to Customer
 from other table.
 Either coming back with an error or success updating information(I
 want to page to back to edit page not index page after save),
 I get Undefined index error everywhere in this page because after
 coming back to page, $this-data has only the information model show
 relationship(I think,,, I have 4 has one relationship in this model
 (Customer) and only those information is available from $this-data
 after submit)

 How can I get $this-data has recursive = 6 data to avoid getting
 undefined index error?


 thanks,
 leafchild






 On Aug 7, 6:22 pm, brian bally.z...@gmail.com wrote:
  Are you using FormHelper to create your form elements? If you do, for
 example:
 
  echo $form-input('Post')
 
  ... the helper will add the value of the element based upon $this-data.
 
  If you are using the helper, maybe you should post your controller and
  view code.
 
 
 
  On Fri, Aug 7, 2009 at 6:56 PM,leafchildleafchild.b...@gmail.com
 wrote:
 
   I have a page with form.
 
   If user entered name, address,,,and ,all kinds of information and
   submit but there is mistakes such as not entered email
   properly and came back to form page with error message. How can I keep
   the entered value user entered properly.
 
   Currently in my form page, if user has an error, all the entered value
   are gone and user has to entered everything.
 


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



Re: How can I leave entered value even there is an errro and couldn't complete

2009-08-11 Thread anurag pal

Hi,

For that you have to pass values in input filed so that it will take
it when it come back to page after getting validation errors.

Regards,
Anurag Pal

On Aug 8, 3:56 am, leafchild leafchild.b...@gmail.com wrote:
 I have a page with form.

 If user entered name, address,,,and ,all kinds of information and
 submit but there is mistakes such as not entered email
 properly and came back to form page with error message. How can I keep
 the entered value user entered properly.

 Currently in my form page, if user has an error, all the entered value
 are gone and user has to entered everything.

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



Access non CakePHP session from within CakePHP?

2009-08-11 Thread Fabs

G'day everyone

I'm planning to integrate CakePHP with a legacy CRM site in use. My
problem is with authentication. The legacy CRM stores session data
just in $_SESSION (it doesn't call session_name()). Is there a
straightforward way to access this data from within CakePHP, or should
I somehow hack the CRM to insert data into CakePHP's session system?
(I don't know how to do this)

Any help will be appreciated. Thanks all.

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



Using the form helper to create elements failed in opera

2009-08-11 Thread Robert Moritz

Hi Guys,

i' am using the form helper to create input fields, but they'll not
displayed in opera.
What could be the problem? A local instance of xampp is my webserver.
cakephp 1.2.4.8284 stable

http://img185.imageshack.us/img185/9628/20090811102017.png

Thank you!

Regards,
Robert

--~--~-~--~~~---~--~~
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: wrapper function not working!

2009-08-11 Thread anurag pal

Hi,

I have checked the code its working properly.

Please cross check your method which checking for logged User. It
might be in beforeFilter because its asking for log-in.

Regards,
Anurag Pal

On Aug 11, 12:25 pm, armen oldar...@gmail.com wrote:
 This is the link to the webpage that im working 
 on...http://warplayart.com/bleed_till_death/UserLoging/users
 and this is the link that you register a 
 user...http://warplayart.com/bleed_till_death/UserLoging/users/register

 But the form on the register page, calles add in for it's action
 variable, even though im calling the register function from the url.
 So i ended up using a wrapper like this which doesn't work.

 What am i doing wrong?

 + when i was just using the add (http://warplayart.com/
 bleed_till_death/UserLoging/users/add) and placed the code inside the
 add function it worked fine.

 -
         function add()          {
                                 $this-register($this-data);
           }

         function register($data = null)                 {

                   if (!empty($data))            {

                     $data['User']['password'] = 
 md5($data['User']['password']);
                                 $this-User-create();

                           if ($this-User-save($data)) {
                                    $this-Session-setFlash(__('User 
 successfully registered',
 true));
                                          $this-Session-write('User', $data);
                                          $this-redirect('index');
                                          exit();
                           }
                           else {
                                    $this-Session-setFlash(__('The Post 
 could not be saved.
 Please, try again.', true));
                           }
                   }
           }
 

 Thanks in advance.

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



Access non CakePHP session from within CakePHP

2009-08-11 Thread Fabs

G'day all

I'm integrating CakePHP into a legacy CMS. The CMS stores all of its
session data in the generic php session (it never calls session_name
()). I need to retrieve this session data to prevent requiring users
to log in twice to use the old and the new functions. Is there a way
to do this?

Thanks everyone.

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



Fatal error: Class 'Dispatcher' not found - please help

2009-08-11 Thread RAAJ


i have gotten this messege  how can  solve it ?? please help me...

--~--~-~--~~~---~--~~
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: Array help

2009-08-11 Thread Dave Maharaj :: WidePixels.com
Thanks Joshua,
 
That works just as needed.
 
Dave

  _  

From: joshua [mailto:josh...@gmail.com] 
Sent: August-11-09 1:14 AM
To: cake-php@googlegroups.com
Subject: Re: Array help


I think you can define a model level filter, it will help you to solve this
problem thoroughly. Just an idea of mine. Maybe you can put the filter
engine in AppModel. 
[Client]  {Filter engine}  [Server]
[Client] --- {Filter engine}  [Server]


For a temporary solution, I think the loop is enough:
Assume the return result something like this:

[0] = Array
   (
   [Bookmark] = Array
   (
   [id] = 38b7276f708
   [user_id] = 4a5d569f-b9e8-416d-b34c-11cf4adcd75b
   [post_id] = 11e7ee
   [created] = 2009-08-09 21:59:01
   )

   [Post] = Array
   (
   [title] = Test Title
   [rank] = 2
   [created] =
   [description] = Test dscription
   [id] = 52louj

   )

   )
[1] = Array
   (
   [Bookmark] = Array
   (
   [id] = 38b7276f708
   [user_id] = 4a5d569f-b9e8-416d-b34c-11cf4adcd75b
   [post_id] = 11e7ee
   [created] = 2009-08-09 21:59:01
   )

   [Post] = Array
   (
   [title] =
   [rank] =
   [created] =
   [description] =
   [id] =

   )

   )


[CODE]
foreach ($bookmarks as $key = $value) {
 if (empty($value['Post']['id'])) {
  unset($bookmarks[$key]['Post']);
 }
}
[/CODE]

On Tue, Aug 11, 2009 at 11:19 AM, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:


The thing is the Post info is there in the database
 
Scenario:
The Post article has access level of 1
User that has an access level of 1 can see the Post and bookmark it. No
problem
 
Later the owner of the Post changes the access level to 3the user with
level 1 access can no loger see that Post because his access level is too
low, but his Bookmark for that Post still exists. But because the contain
will pull all bookmarks that belongto the user andgetthe Posts where $access
= 'Post.access' that info is no longer goingto get pulled, thats why it
appears blank.
 
So I need to completely remove that bookmark from the array.
 
Trying something like:
 
foreach ($bookmark as $key = $value) {
 if (empty($value)) {
  unset($q[$key]);
 
but cant get it to work...still messing around with it

  _  

From: joshua [mailto:josh...@gmail.com] 
Sent: August-11-09 12:41 AM
To: cake-php@googlegroups.com
Subject: Re: Array help


1. Use a callback function afterFind to loop the return array, remove the
empty item. 
2. How about give a condition when model-find.
[CODE]
'conditions' = array((not = array ( Post.id = null )), //array of
conditions
[/CODE]

On Tue, Aug 11, 2009 at 10:25 AM, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:



I have a contain query which produces these results.

Basically the user bookmarked a page when they had access. The Owner of the
post has changed the level of who can view the Post so in this case this
user no longer can view the post hence the missing post data. It was not
grabbed because the conditions of the Post did not match the users access
level.

But the bookmark still exists. Now in the query it pulls all bookmarks for
the user and the post related to the bookmark. How can I remove [1] from the
array all together or all from the array if [Post] has no data? I can not
delete the bookmark when Posts change the access level because they may
change it back to a lower setting and allow those who did have it bookmarked
to once again have access. I just need to remove the array entry(s) where
the  Post array is empty.

[0] = Array
   (
   [Bookmark] = Array
   (
   [id] = 38b7276f708
   [user_id] = 4a5d569f-b9e8-416d-b34c-11cf4adcd75b
   [post_id] = 11e7ee
   [created] = 2009-08-09 21:59:01
   )

   [Post] = Array
   (
   [title] = Test Title
   [rank] = 2
   [created] =
   [description] = Test dscription
   [id] = 52louj

   )

   )
[1] = Array
   (
   [Bookmark] = Array
   (
   [id] = 38b7276f708
   [user_id] = 4a5d569f-b9e8-416d-b34c-11cf4adcd75b
   [post_id] = 11e7ee
   [created] = 2009-08-09 21:59:01
   )

   [Post] = Array
   (
   [title] =
   [rank] =
   [created] =
   [description] =
   [id] =

   )

   )

Thanks,

Dave








-- 

Thanks

Re: Using usort in Cake

2009-08-11 Thread DiRN

For future refernce, you would use:

usort($fruits, array($this, 'cmp));
--~--~-~--~~~---~--~~
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: lazy loading?

2009-08-11 Thread euromark (munich)

@demon

that looks promising
i'll check it out, thx


On 11 Aug., 11:38, evilbloodydemon evilbloodyde...@gmail.com wrote:
 take a look tohttp://github.com/mcurry/lazy_loader/tree/master

 On Aug 10, 8:13 pm, Martin Westin martin.westin...@gmail.com wrote:

  Typical me. I never got to my real point.

  I wanted to say that if you are having serious performance problems
  even while containing queries then that is a bit odd. What is the
  difference if you bench an action with the unneeded associations
  commented out completely (which should keep the models from loading at
  all)?
--~--~-~--~~~---~--~~
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 usort in Cake

2009-08-11 Thread DiRN

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



Function Find - problem

2009-08-11 Thread boobalan

i found some difficulties using function find(),
/
SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name` FROM
`books` AS `Book` WHERE `Book`.`title` = 'LIKE 'A%' ORDER BY
`Book`.`title` ASC
//
In this query,  i can't retrieve data because the conditions pasted in
this query is wrong
WHILE using LIKE in a query we can't use '=' symbol so suggest a
solution for this.

Boobalan.M

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



Access Permissions

2009-08-11 Thread Dave Maharaj :: WidePixels.com
I have an Auth Acl setup working fine.
 
I have scope- Users.confirmed to verify they confirmed their email before
they can login in...no problem.
 
Now I have added User.status which is:
 default 0 = pending admin approval
1 = active
2= suspended
 
 
Now I have 3 scenarios to allow access to the site (all based on
User.confirmed = true)
 
So if User.status = 0 they can only access their profile
User.status = 1 they have full access to the site
User.status = 2 they cant do anything
 
What would be the best way set up these additional permission checks after
the user has logged in? 
My ACL is restricting controllers/actions based on group_id.
 
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
-~--~~~~--~~--~--~---



Custom library functions

2009-08-11 Thread alaxos

Hello,

I have tried to figure out what would be the best way to add generic
functions to an app, in order to then be able to use them everywhere
in a Cake application.

I wrote some time ago (nothing to do with cake) classes with methods
that I use to do different things. They are generic classes, that I
use for instance to manipulate strings, or whatever.

I could off course copy/paste them in my components or helper that
need them, but I would prefer to have it written at only one place,
and be able to call it from everywhere.

I could also for instance include the files I need somewhere in the
app (in 'app_controller.php' maybe).

But I'd like to know what would be the best way to do it in order to
respect the Cake guidelines ?

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



Re: Log Errors when debug = 0?

2009-08-11 Thread Rick

Look in the cake/libs/error.php class.  You may be able to override
something there and make log output work.  I don't know where in the
hierarchy of cake you would need to put the override to make it work.
Maybe some expert can contribute here.

Rick



On Aug 11, 3:31 am, bram brammele...@gmail.com wrote:
 I do know it's possible to write all cake debugging and error info to
 the log file. But I don't know how to enable it without a small
 modification in the cake source code. I've asked a similar question a
 couple of days ago, but no replies

 http://groups.google.com/group/cake-php/msg/05dfde6ad7ebfed2?hl=en

 Bram

 On Aug 10, 11:22 pm, David sirdavid...@gmail.com wrote:

  I would like to silently write errors to error.log when in production
  mode. It would be useful to catch anything going wrong that I hadn't
  previously noticed.


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

2009-08-11 Thread LS

Hello, everyone.

I'm into a dead end and I can't seem to get this session and redirect
things right...

I've tested this using cakephp, php and database session methods.

I have two controllers and one action in each one, like this:

?php

class OneController extends AppController {
  function start() {
$this-Session-write('key', 'info');
$this-redirect('/two/bug');
// exit; // -- with or without this, I get the error.
  }
(...)
?

other file
?php

class TwoController extends AppController {
  function bug() {
if ($this-Session-check('info')) {
  // This never happens!
  echo(working);
}
  }
}

?

When I check the database, I see two sessions, one with the info that
was written on the controller one, and another one almost empty
(only timeout and other info).

I've even set the ?php Configure::write('Session.checkAgent',
false); ? on the core.php file, but it still no good.

Can someone enlight me, please?
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
-~--~~~~--~~--~--~---



Re: Sessions and Redirect

2009-08-11 Thread Robert P

In TwoController::bug() your call to SessionComponent seems
nonsensical. Looking at what you are trying to do it should either be

$this-Session-check('key') which should return TRUE since you set
this value in OneController::start(), or

($this-Session-read('key') == 'info') which should also return TRUE
for the above reason

On Aug 11, 10:06 pm, LS lsmo...@gmail.com wrote:
 Hello, everyone.

 I'm into a dead end and I can't seem to get this session and redirect
 things right...

 I've tested this using cakephp, php and database session methods.

 I have two controllers and one action in each one, like this:

 ?php

 class OneController extends AppController {
   function start() {
     $this-Session-write('key', 'info');
     $this-redirect('/two/bug');
     // exit; // -- with or without this, I get the error.
   }
 (...)
 ?

 other file
 ?php

 class TwoController extends AppController {
   function bug() {
     if ($this-Session-check('info')) {
       // This never happens!
       echo(working);
     }
   }

 }

 ?

 When I check the database, I see two sessions, one with the info that
 was written on the controller one, and another one almost empty
 (only timeout and other info).

 I've even set the ?php Configure::write('Session.checkAgent',
 false); ? on the core.php file, but it still no good.

 Can someone enlight me, please?
 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
-~--~~~~--~~--~--~---



Re: Custom library functions

2009-08-11 Thread Robert P

The file /app/config/bootstrap.php is there for this exact reason.

On Aug 11, 8:56 pm, alaxos ala...@gmail.com wrote:
 Hello,

 I have tried to figure out what would be the best way to add generic
 functions to an app, in order to then be able to use them everywhere
 in a Cake application.

 I wrote some time ago (nothing to do with cake) classes with methods
 that I use to do different things. They are generic classes, that I
 use for instance to manipulate strings, or whatever.

 I could off course copy/paste them in my components or helper that
 need them, but I would prefer to have it written at only one place,
 and be able to call it from everywhere.

 I could also for instance include the files I need somewhere in the
 app (in 'app_controller.php' maybe).

 But I'd like to know what would be the best way to do it in order to
 respect the Cake guidelines ?

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



PDF reader in view without new header

2009-08-11 Thread RugerJ

How can you show a pdf file within a view without setting the header
to pdf.

I tried to embed it like this:

EMBED SRC=?php echo $html-url('/app/webroot/files/userfile/'.
$uploads['FileUpload']['subdir'].'/'.$uploads['FileUpload']
['file_name']);?#toolbar=0statusbar=0messages=0navpanes=0
HEIGHT=450 WIDTH=555 NOEMBED Your browser does not support embedded
PDF files. /NOEMBED /EMBED

But that doesn't work because of the routing  says controller not
found.
Is there a way around?

Thnx in advance

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



Multidimensional array as named argument

2009-08-11 Thread Tushar

Is it possible to pass an array through named arguments and have it
accessible via $this-passedArgs?

How would you convert an array as such to a named argument

Array
(
[foo] = foo1
[bar] = Array
(
[0] = bar0
[1] = bar1
)
)

it becomes foo:foo1/bar:Array if passed to Router::url to generate the
url

Is it not possible to have arrays in named arguments? Then how can we
handle multiple values generated by multiple selects or checkboxes?

--~--~-~--~~~---~--~~
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: Custom library functions

2009-08-11 Thread Martin Westin


If you start adding more functions you may want to put them into a
separate file.
The top of my bootstrap.php looks like this:

// This would mess things up royally-- App::import('Vendor',
'basics');
require_once(APP.'vendors'.DS.'basics.php');

I mention it mostly because you have to do a good old require unless
you want Cake's internals all confused. App::import() can't be used
because of Cake's bootstrapping order. Simply put bootstrap.php is
loaded before the App is ready to run. It took me a lot of time and
effort to track down that this was the cause for all sorts of
strangeness.

/Martin


On Aug 11, 4:54 pm, Robert P shiftyrobs...@gmail.com wrote:
 The file /app/config/bootstrap.php is there for this exact reason.

 On Aug 11, 8:56 pm, alaxos ala...@gmail.com wrote:



  Hello,

  I have tried to figure out what would be the best way to add generic
  functions to an app, in order to then be able to use them everywhere
  in a Cake application.

  I wrote some time ago (nothing to do with cake) classes with methods
  that I use to do different things. They are generic classes, that I
  use for instance to manipulate strings, or whatever.

  I could off course copy/paste them in my components or helper that
  need them, but I would prefer to have it written at only one place,
  and be able to call it from everywhere.

  I could also for instance include the files I need somewhere in the
  app (in 'app_controller.php' maybe).

  But I'd like to know what would be the best way to do it in order to
  respect the Cake guidelines ?

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



Re: Function Find - problem

2009-08-11 Thread CobaltShark

It would be helpful if you posted the actual code of your find(), but
it would appear that you are not forming your conditions array
correctly. I haven't had any issues using LIKE, and maybe this link
will help : http://book.cakephp.org/view/74/Complex-Find-Conditions
.Book.title LIKE = A% should give you the results your looking
for.

On Aug 11, 5:40 am, boobalan boobal...@gmail.com wrote:
 i found some difficulties using function find(),
 /
 SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name` FROM
 `books` AS `Book` WHERE `Book`.`title` = 'LIKE 'A%' ORDER BY
 `Book`.`title` ASC
 //
 In this query,  i can't retrieve data because the conditions pasted in
 this query is wrong
 WHILE using LIKE in a query we can't use '=' symbol so suggest a
 solution for this.

 Boobalan.M
--~--~-~--~~~---~--~~
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: Access non CakePHP session from within CakePHP

2009-08-11 Thread CobaltShark

The $_SESSION array should have what your looking for.

On Aug 11, 12:15 am, Fabs lord.f...@gmail.com wrote:
 G'day all

 I'm integrating CakePHP into a legacy CMS. The CMS stores all of its
 session data in the generic php session (it never calls session_name
 ()). I need to retrieve this session data to prevent requiring users
 to log in twice to use the old and the new functions. Is there a way
 to do this?

 Thanks everyone.
--~--~-~--~~~---~--~~
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: PDF reader in view without new header

2009-08-11 Thread Martin Westin

Since you are pointing to a real file that exists and is readable
(right?) your problem is probably not header.

The url method is for controllers and actions. Try using the webroot
method. You supply it with the path you want and it will add the base
url for you.

echo $html-webroot('css/screen.css') //-- /css/screen.css

Under a normal production install that would simply be adding the
initial /.

/Martin


On Aug 11, 4:54 pm, RugerJ hoogervo...@gmail.com wrote:
 How can you show a pdf file within a view without setting the header
 to pdf.

 I tried to embed it like this:

 EMBED SRC=?php echo $html-url('/app/webroot/files/userfile/'.
 $uploads['FileUpload']['subdir'].'/'.$uploads['FileUpload']
 ['file_name']);?#toolbar=0statusbar=0messages=0navpanes=0
 HEIGHT=450 WIDTH=555 NOEMBED Your browser does not support embedded
 PDF files. /NOEMBED /EMBED

 But that doesn't work because of the routing  says controller not
 found.
 Is there a way around?

 Thnx in advance
--~--~-~--~~~---~--~~
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: PDF reader in view without new header

2009-08-11 Thread CobaltShark

Have you tried removing /app/webroot from the $html-url call? Not
sure if that will fix all your issues but that is where I would start.

On Aug 11, 7:54 am, RugerJ hoogervo...@gmail.com wrote:
 How can you show a pdf file within a view without setting the header
 to pdf.

 I tried to embed it like this:

 EMBED SRC=?php echo $html-url('/app/webroot/files/userfile/'.
 $uploads['FileUpload']['subdir'].'/'.$uploads['FileUpload']
 ['file_name']);?#toolbar=0statusbar=0messages=0navpanes=0
 HEIGHT=450 WIDTH=555 NOEMBED Your browser does not support embedded
 PDF files. /NOEMBED /EMBED

 But that doesn't work because of the routing  says controller not
 found.
 Is there a way around?

 Thnx in advance
--~--~-~--~~~---~--~~
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: expired cache files

2009-08-11 Thread zonium


Any insight everyone?
--~--~-~--~~~---~--~~
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: PDF reader in view without new header

2009-08-11 Thread RugerJ

Thnx Martin, that solved the problem ;-)


--~--~-~--~~~---~--~~
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: Hi i am newbie !

2009-08-11 Thread pomares

This tutorial is a good way to start:

http://book.cakephp.org/view/326/The-Cake-Blog-Tutorial

On Aug 11, 9:43 am, sunny asim...@gmail.com wrote:
 Can any body tell me how build new project in cake php!
--~--~-~--~~~---~--~~
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: Hi i am newbie !

2009-08-11 Thread thatsgreat2345

Don't use 1.1, I'd recommend using 1.2 blog tutorial
http://book.cakephp.org/view/219/Blog

On Aug 11, 9:26 am, pomares k...@gordonpomarescentre.com wrote:
 This tutorial is a good way to start:

 http://book.cakephp.org/view/326/The-Cake-Blog-Tutorial

 On Aug 11, 9:43 am, sunny asim...@gmail.com wrote:

  Can any body tell me how build new project in cake php!
--~--~-~--~~~---~--~~
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: Uploading file issue - worning mkdir()

2009-08-11 Thread leafchild book
Hi Anurag,
Thank you for the comment.

Where is your upload file directory?
Is still in webroot?

Thanks,
leafchild


On Tue, Aug 11, 2009 at 1:43 AM, anurag pal mail.anurag@gmail.comwrote:

 Hi,

 I have the same issue. I found that its using different path for
 uploading file.

 For stopping details to database just first upload the file and then
 insert or update record in database.

 If you can provide the source code it would be better to diagnose the
 problem.

 Regards,
 Anurag Pal

 On Aug 11, 1:06 pm, leafchild leafchild.b...@gmail.com wrote:
  The uploaded img directory permission is set to 777 and just in case I
  even changed webroot permission to 777
  but I'm still seeing  same warning message. Where else I need to
  check?
 
  Also how can I stop update with entire file data to database?
 
  after trying to upload file debug show:
  ==
  [id] =1
  [uploadfile] = Array
 (
 [name] = IMG_0801.JPG
 [type] = image/jpeg
 [tmp_name] = /tmp/phpbo9DjW
 [error] = 0
 [size] = 404887
 )
  [desc] =
  ...
  ===
 
  uploadfile field needs only file name but looking at sql trying to
  update
  filed with file array information.
 
  On Aug 7, 6:24 pm, brian bally.z...@gmail.com wrote:
 
   Check the permissions for the directory. The webserver has to have
   write access to the dir.
 
   On Fri, Aug 7, 2009 at 4:02 PM,leafchildleafchild.b...@gmail.com
 wrote:
 
I'm trying to make this plugin(
 http://www.milesj.me/resources/script/
uploader-plugin) works.
 
However, after I install I'm getting an error - Warning (2): mkdir()
[function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line
466]
Actually I tried another behavior to upload file and got same error.
Do  I need to do some kind of server setting? I'm using MT(dv)
 
Also after submit to upload file I'm getting an SQL error because
 data
need to be one but it try to update entire file data:
 
==
[id] =1
[uploadfile] = Array
  (
  [name] = IMG_0801.JPG
  [type] = image/jpeg
  [tmp_name] = /tmp/phpbo9DjW
  [error] = 0
  [size] = 404887
  )
[desc] =
...
===
uplodefile 's data is not array just [NAME] of file.
 
How can I stop doing it? I can't use $this-Landing-save($this-
   data) if I have file uploading?


--~--~-~--~~~---~--~~
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: Validating a HABTM relationship

2009-08-11 Thread mcrawford

Found a solution:

As far as I can tell, the validation methods expect the data all to be
in (for example) $this-data['Question']['FunctionalArea'].

(See line 2196 of model.php, where the only data considered for
validation is in $this-data['Question'].)

But the save method expects all the data to be in $this-data
['FunctionalArea']['FunctionalArea'].

(See lines 1120-1125 of model.php, which considers everything in $this-
data, including HABTM relationships.)

So I my View posts the data to $this-data['FunctionalArea']
['FunctionalArea'], and in the Controller I copy it to $this-data
['Question']['FunctionalArea'], so that both validation and saving
work.

On Aug 10, 5:24 pm, mcrawford mcrawf...@gmail.com wrote:
 Hmm, this is not quite right either. Now the associated models do not
 save...
 According tohttp://book.cakephp.org/view/85/Saving-Related-Model-Data-HABTM
 I should be using
 $form-input('FunctionalArea')
 but that doesn't work with the validation. But it does work with the
 save function.

 Dave, thanks, I did find that link when Googling for a solution. I was
 hoping to avoid writing my own validation method since the multiple
 one does exist, although it doesn't sound like people are having
 success using it.

 On Aug 10, 11:49 am, mcrawford mcrawf...@gmail.com wrote:

  Ah, I found it in the Form helper...

  $form-input('Question.FunctionalArea')

  I need to use the full dot-separated name of the field to get the form
  field to be what the validation is expecting.

  On Aug 10, 11:32 am, mcrawford mcrawf...@gmail.com wrote:

   Hi,

   I have a model set up like this:

   class Question extends AppModel {
           var $name = 'Question';
           var $hasAndBelongsToMany = array(
                   'FunctionalArea' = array('joinTable' = 
   'question_functions')
           );
           var $validate = array(
                   'title' = 'notEmpty',
                   'content' = 'notEmpty',
                   'FunctionalArea' = array(
                           'rule' = array('multiple', array('min'=1)),
                           'required' = true
                   )
           );

   }

   Then in my form I set up an input with FunctionalArea as the field
   name, using Cake's form helper. This produces an input with name=data
   [FunctionalArea][FunctionalArea][]. Now if I save the form with NO
   validation, the vanilla $this-Question-save($this-data); works just
   fine. The join table is all correct after saving.

   But when I put in that validation for FunctionalArea that I have in
   the above code, the validation doesn't work correctly. The model's
   invalidFields method does this:
   if (isset($data[$this-alias])) {
           $data = $data[$this-alias];}

   So that the data in data[FunctionalArea][FunctionalArea] never gets to
   the validate method. So the validation always fails (because
   FunctionalArea is required).

   My question is: what is the correct Cake way to do this? I'm trying to
   use the automatic save feature, form fields, and the validation, but I
   don't see how I can use them together, because the validation seems to
   be ignoring the very place where the save needs the data.


--~--~-~--~~~---~--~~
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 some page .../id disappeared ?

2009-08-11 Thread euromark (munich)

well, in most cases (and mine: 100%) you use so called
Affenformulare (http://de.wikipedia.org/wiki/Affenformular) or ape
forms
which have either no adress value or the own one (and post to
themselves again)

this is the usual cake way anyway - process it in the corresponding
controller method and decide what to do with it

of course there are always exceptions :)
but using the ape appraoch you could easily change the name or the
method, the form would still work
(but the links to it probably not anymore..)

i once even baked the view code this way
advantage: you can have apply instead of add and consider
instead of edit
and you dont have to change the view code at all



On 11 Aug., 17:10, JamesF usaexportexpe...@gmail.com wrote:
 i found that any time i didn't verbosely link i ended up having to
 change all sorts of functions whenever my boss wanted a different url

 On Aug 11, 2:29 am, brian bally.z...@gmail.com wrote:

  @James

  I thought at first that looked like a real pain but verbose array
  linking (finding, routing, containing, etc.) is definitely the way to
  go, I agree. It's often self-documenting, for one thing. And it goes
  to the heart of what Cake is, I think. Big kudos to the devs for
  pulling this together so coherently.

  On Mon, Aug 10, 2009 at 9:53 PM, JamesFusaexportexpe...@gmail.com wrote:

   @euromark

   your code is certainly more to the point, but i can't break the habit
   of verbosely linking all my actions.

   On Aug 8, 9:53 pm, euromark (munich) dereurom...@googlemail.com
   wrote:
   as i said, i would go with JUST url=/.$this-params['url]['url']
   in this case there is no need to use action or the manually built
   url like james suggested

   be aware of the / in front of it though (otherwise the url is not
   built correctly)

   On 9 Aug., 02:06, JamesF usaexportexpe...@gmail.com wrote:

make sure you $form-create is submitting to the id as a parameter as
well

echo $form-create('FormName', array('url'=array
('controller'='myController', 'action'='myAction', $id,
'admin'=true)));

On Aug 7, 7:13 pm, leafchild leafchild.b...@gmail.com wrote:

 URL some page  .../id disappeared ?

 I have site there are different form pages to organize products.

 Some form page such as admin_edit page - URL:  ... 
 admin/product/edit/
 1
 After I submit URL still same either there is an error or not.

 However, some form page lose id from URL after submit,
 and showing index error.

 for example, URL: ...admin/category/customer/edit/1 - ...admin/
 category/customer/edit
 ==
 if (!empty($this-data)) {
    // empty}

 ==
 I deleted all the code inside of if statement for taking care of
 submitting data.
 The one keep same URL doesn't show error but other does.

 Not sure difference between these two has.
 I don't know why? Does anyone know what's the issue?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



cake media plugin imagemagick adapter

2009-08-11 Thread Josoroma

Hi!

Im using the media plugin adapter:
http://wiki.github.com/davidpersson/media/configuration

By default this plugin is working with the GD adapter (we have both GD
and ImageMagick). For us everything works fine, but some uploaded
images display a warning: ... gd-jpeg, libjpeg: recoverable error:
Corrupt JPEG data: 37...

My questions is:

How do i set imagemagick to be the default adapter?

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



Re: How can I leave entered value even there is an errro and couldn't complete

2009-08-11 Thread leafchild book
Hi anurag,
You are saying I have to get POST data manually instead of using validation
($this-Customer-validates())?
If I set id, then all the new information is replace back with old
information when coming back page with errors.


Hi brian,
I didn't use Containable, only I do is when I get data I set recursive=6 so
I get all related information,
but this recursive stop working after  coming back to page with errors. How
can I still make recursive active
so I don't get an  Undefined index page.


Thanks,
leafchild



On Tue, Aug 11, 2009 at 8:56 AM, brian bally.z...@gmail.com wrote:


 I can't follow all of that but it seems like you'd be better off using
 Containable.

 On Tue, Aug 11, 2009 at 5:06 AM, leafchildleafchild.b...@gmail.com
 wrote:
 
  Yes, I use $form-input()
 
  I found an issue because I was SQL again for the specific data before
  going back to the page to show user an errors.
  (I had an code like this that's why I couldn't keep the entered value
  when there is an error.
  ===
  function admin_edit(id = null){
  if (!empty($this-data)) {
 ...
  $this-data = $this-Customer-read(null, $id);
  }
  if (empty($this-data)) {
  ...
   $this-data = $this-Customer-read(null, $id);
   }
 
  }
  ===
  I took out the line $this-data = $this-Customer-read(null, $id);
  in  if (!empty($this-data)) statement now I can keep the entered
  value when there is an error.
  However, now I have an other issue.
 
  In this admin/customers/edit page, I need to set $this-Customer-
 recursive = 6; to get all kind of information relates to Customer
  from other table.
  Either coming back with an error or success updating information(I
  want to page to back to edit page not index page after save),
  I get Undefined index error everywhere in this page because after
  coming back to page, $this-data has only the information model show
  relationship(I think,,, I have 4 has one relationship in this model
  (Customer) and only those information is available from $this-data
  after submit)
 
  How can I get $this-data has recursive = 6 data to avoid getting
  undefined index error?
 
 
  thanks,
  leafchild
 
 
 
 
 
 
  On Aug 7, 6:22 pm, brian bally.z...@gmail.com wrote:
  Are you using FormHelper to create your form elements? If you do, for
 example:
 
  echo $form-input('Post')
 
  ... the helper will add the value of the element based upon $this-data.
 
  If you are using the helper, maybe you should post your controller and
  view code.
 
 
 
  On Fri, Aug 7, 2009 at 6:56 PM,leafchildleafchild.b...@gmail.com
 wrote:
 
   I have a page with form.
 
   If user entered name, address,,,and ,all kinds of information and
   submit but there is mistakes such as not entered email
   properly and came back to form page with error message. How can I keep
   the entered value user entered properly.
 
   Currently in my form page, if user has an error, all the entered value
   are gone and user has to entered everything.
  
 

 


--~--~-~--~~~---~--~~
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: Uploading file issue - worning mkdir()

2009-08-11 Thread brian

Don't set the permissions wide open for webroot dir! That's not a good
idea at all.

What is the full path of the directory you want to upload to?

I'm sorry, I'm not familiar with the plugin and don't understand your
other question about the data.

On Tue, Aug 11, 2009 at 4:06 AM, leafchildleafchild.b...@gmail.com wrote:

 The uploaded img directory permission is set to 777 and just in case I
 even changed webroot permission to 777
 but I'm still seeing  same warning message. Where else I need to
 check?

 Also how can I stop update with entire file data to database?

 after trying to upload file debug show:
 ==
 [id] =1
 [uploadfile] = Array
               (
                   [name] = IMG_0801.JPG
                   [type] = image/jpeg
                   [tmp_name] = /tmp/phpbo9DjW
                   [error] = 0
                   [size] = 404887
               )
 [desc] =
 ...
 ===

 uploadfile field needs only file name but looking at sql trying to
 update
 filed with file array information.






 On Aug 7, 6:24 pm, brian bally.z...@gmail.com wrote:
 Check the permissions for the directory. The webserver has to have
 write access to the dir.



 On Fri, Aug 7, 2009 at 4:02 PM,leafchildleafchild.b...@gmail.com wrote:

  I'm trying to make this plugin(http://www.milesj.me/resources/script/
  uploader-plugin) works.

  However, after I install I'm getting an error - Warning (2): mkdir()
  [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line
  466]
  Actually I tried another behavior to upload file and got same error.
  Do  I need to do some kind of server setting? I'm using MT(dv)

  Also after submit to upload file I'm getting an SQL error because data
  need to be one but it try to update entire file data:

  ==
  [id] =1
  [uploadfile] = Array
                (
                    [name] = IMG_0801.JPG
                    [type] = image/jpeg
                    [tmp_name] = /tmp/phpbo9DjW
                    [error] = 0
                    [size] = 404887
                )
  [desc] =
  ...
  ===
  uplodefile 's data is not array just [NAME] of file.

  How can I stop doing it? I can't use $this-Landing-save($this-
 data) if I have file uploading?
 


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



Re: How can I leave entered value even there is an errro and couldn't complete

2009-08-11 Thread brian

I don't even know if you *can* set recursive to 6. Use Containable and
specify exactly which associations you want.

On Tue, Aug 11, 2009 at 1:44 PM, leafchild bookleafchild.b...@gmail.com wrote:
 Hi anurag,
 You are saying I have to get POST data manually instead of using validation
 ($this-Customer-validates())?
 If I set id, then all the new information is replace back with old
 information when coming back page with errors.

 Hi brian,
 I didn't use Containable, only I do is when I get data I set recursive=6 so
 I get all related information,
 but this recursive stop working after  coming back to page with errors. How
 can I still make recursive active
 so I don't get an  Undefined index page.

 Thanks,
 leafchild


 On Tue, Aug 11, 2009 at 8:56 AM, brian bally.z...@gmail.com wrote:

 I can't follow all of that but it seems like you'd be better off using
 Containable.

 On Tue, Aug 11, 2009 at 5:06 AM, leafchildleafchild.b...@gmail.com
 wrote:
 
  Yes, I use $form-input()
 
  I found an issue because I was SQL again for the specific data before
  going back to the page to show user an errors.
  (I had an code like this that's why I couldn't keep the entered value
  when there is an error.
  ===
  function admin_edit(id = null){
  if (!empty($this-data)) {
     ...
      $this-data = $this-Customer-read(null, $id);
  }
  if (empty($this-data)) {
  ...
       $this-data = $this-Customer-read(null, $id);
   }
 
  }
  ===
  I took out the line $this-data = $this-Customer-read(null, $id);
  in  if (!empty($this-data)) statement now I can keep the entered
  value when there is an error.
  However, now I have an other issue.
 
  In this admin/customers/edit page, I need to set $this-Customer-
 recursive = 6; to get all kind of information relates to Customer
  from other table.
  Either coming back with an error or success updating information(I
  want to page to back to edit page not index page after save),
  I get Undefined index error everywhere in this page because after
  coming back to page, $this-data has only the information model show
  relationship(I think,,, I have 4 has one relationship in this model
  (Customer) and only those information is available from $this-data
  after submit)
 
  How can I get $this-data has recursive = 6 data to avoid getting
  undefined index error?
 
 
  thanks,
  leafchild
 
 
 
 
 
 
  On Aug 7, 6:22 pm, brian bally.z...@gmail.com wrote:
  Are you using FormHelper to create your form elements? If you do, for
  example:
 
  echo $form-input('Post')
 
  ... the helper will add the value of the element based upon
  $this-data.
 
  If you are using the helper, maybe you should post your controller and
  view code.
 
 
 
  On Fri, Aug 7, 2009 at 6:56 PM,leafchildleafchild.b...@gmail.com
  wrote:
 
   I have a page with form.
 
   If user entered name, address,,,and ,all kinds of information and
   submit but there is mistakes such as not entered email
   properly and came back to form page with error message. How can I
   keep
   the entered value user entered properly.
 
   Currently in my form page, if user has an error, all the entered
   value
   are gone and user has to entered everything.
  
 




 


--~--~-~--~~~---~--~~
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: Pagination Help

2009-08-11 Thread brian

If you place the markup that lists the posts in an element, you can
specify to render just that, instead of the entire view, for AJAX
requests.

Here's an example that works for me.

views/users/index.ctp:

h1Member Directory/h1

?= $this-element('users/pagination') ?



views/elements/users/pagination.ctp:

table id=user_list
caption/caption
thead
tr
th?= $paginator-sort('Name', 'User.last_name', 
array('title' =
'sort by last name')) ?/th
th?= $paginator-sort('Organization', 
'User.organization',
array('title' = 'sort by organization')) ?/th
th?= $paginator-sort('Country', 'User.country', 
array('title'
= 'sort by country')) ?/th
/tr
/thead
tfoot
tr
th colspan=3
?= $this-element('paginator_links') ?
/th
/tr
/tfoot
tbody
?php
foreach ($users as $user)
{
?
...
?php
}
?
/tbody
/table


users_controller.php:

public function index()
{
$this-set('users', $this-paginate('User'));

/* render only the element for AJAX requests
 */
if ($this-RequestHandler-isAjax())
{
$this-viewPath = 'elements/users';
$this-render('pagination');
}
}


users.js:

$(function()
{
stripeRows('#user_list tbody');
initAsyncUserPagination();
});

/**
 * Initialise AJAX requests for the users table.
 * Both the pagination and sort links will be bound so that
 * requests are made asynchronously.
 */
function initAsyncUserPagination()
{
$('#user_list .PaginationLinks a, #user_list thead a').click(function()
{
$('#user_list').fadeTo('fast', 0.1);

$('#content').loading(true);
var href = $(this).attr('href');

/* fetch the form
 */
$.ajax({
url: href,
cache: false,
success: function(html)
{
$('#content').loading(false);

/* replace the entire #user_list table
 */

$('#user_list').replaceWith(html).fadeTo('slow', 100);
stripeRows('#user_list tbody');

/* call this function again to init new content
 */
initAsyncUserPagination();
}
});
return false;
}); 
}

function stripeRows(selector)
{
$(selector + ' tr:nth-child(even)').addClass('Odd');
}


On Tue, Aug 11, 2009 at 1:10 PM, Dave Maharaj ::
WidePixels.comd...@widepixels.com wrote:
 I have the ajax jquery pagintiion set up no problem.

 I am using a default layout,single column for content.

 Now when i load the posts page (which has the pagination) the index view is
 split into 2 columns, right side is menu, left side is the paginator. But
 when i click next, the 2 column loads into the pagination div.

 I put just the pagination content into an element and load element from the
 view, click next and it stll loads the full view.

 How can only load the pagination into a div. I know it has todo with my
 index function because it loads the default template which then pulls the
 index view which has the 2 cols...so when i load the ajax pagination the
 index function is still pulling the full view.

 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: Ajax Errors

2009-08-11 Thread Tony Thomas

I actually ending up using this:

http://deadlytechnology.com/scripts/javascript/ajax-failure-callback/

It sends a 403 server error back if the transaction doesn't validate
which triggers my error message in the view.

On Aug 11, 2:50 am, Saliem than.sal...@gmail.com wrote:
 I am not quite sure what you are missing but you might want to double
 check a couple of things including:

 the name of your aliquot model file,
 the validate variable in your aliquot model file and
 try using the validationErrors method available for each of the models
 created and returning any errors as json

 please see :

 http://book.cakephp.org/view/410/Validating-Data-from-the-Controller

 On Aug 10, 3:42 pm, Tony Thomas truet...@gmail.com wrote:

  This is something that's so simple, I'm embarrassed to ask. But after
  a few dozen Google searches, I'm going to swallow my pride and post my
  question here.

  I have a simple ajax function in my controller and I want it to return
  an error is the request is not successful. For example:

  function ajax_update_box($boxId, $aliquotIds){
          if ($this-RequestHandler-isAjax()) { // if the request is AJAX
                  if($aliquots = $this-Aliquot-validateMove($aliquotIds, 
  $boxId))
  { // make sure a slot is open in the box
                          foreach($aliquots as $aliquot_id = $position ) { 
  // validateMove
  returns an array
                                  if 
  ($this-Aliquot-save($this-data['Aliquot'] =! true)) {
                                          Configure::write('debug', 0);
                                          $this-autoRender = false;
                                          exit('There was an error and some 
  of the aliquots were not
  moved.');
                                  }
                          }

                          echo $this-unstored();

                  } else { // this is where I want it to return an error.
                          Configure::write('debug', 0);
                          $this-autoRender = false;
                          exit('The move did not work. Check to see if the 
  box is full.');

                  }
                  Configure::write('debug', 0);
                          $this-autoRender = false;
                          exit(0);
          }

  }

  If the request doesn't pass validation in my model, I want to display
  an error message, but I can't seem to get that to work. Everything is
  treated as success. What am I missing?
--~--~-~--~~~---~--~~
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 Javascript link

2009-08-11 Thread Sarah

My original javascript code actually worked on a site (no setup with
cakephp).  The problem I'm having is linking everything together.  I
do appreciate the advice w/ the javascript though.  :)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Want to add another application in cake

2009-08-11 Thread Vijay

My old site is in simple php.We have developed a new version of that
site using cakephp.
Now we want to add the old site in the cakephp.

But the google search gives the old site links.So i want to maintain
the old site too along with new version which is in cakephp.

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



RE: Pagination Help

2009-08-11 Thread Dave Maharaj :: WidePixels.com

Perfect...the 
if ($this-RequestHandler-isAjax())
{
$this-viewPath = 'elements/users';
$this-render('pagination');
} 

Did the trick.

Thanks
Dave

-Original Message-
From: brian [mailto:bally.z...@gmail.com] 
Sent: August-11-09 3:42 PM
To: cake-php@googlegroups.com
Subject: Re: Pagination Help


If you place the markup that lists the posts in an element, you can specify
to render just that, instead of the entire view, for AJAX requests.

Here's an example that works for me.

views/users/index.ctp:

h1Member Directory/h1

?= $this-element('users/pagination') ?



views/elements/users/pagination.ctp:

table id=user_list
caption/caption
thead
tr
th?= $paginator-sort('Name', 'User.last_name',
array('title' = 'sort by last name')) ?/th
th?= $paginator-sort('Organization',
'User.organization', array('title' = 'sort by organization')) ?/th
th?= $paginator-sort('Country', 'User.country',
array('title'
= 'sort by country')) ?/th
/tr
/thead
tfoot
tr
th colspan=3
?= $this-element('paginator_links') ?
/th
/tr
/tfoot
tbody
?php
foreach ($users as $user)
{
?
...
?php
}
?
/tbody
/table


users_controller.php:

public function index()
{
$this-set('users', $this-paginate('User'));

/* render only the element for AJAX requests
 */
if ($this-RequestHandler-isAjax())
{
$this-viewPath = 'elements/users';
$this-render('pagination');
}
}


users.js:

$(function()
{
stripeRows('#user_list tbody');
initAsyncUserPagination();
});

/**
 * Initialise AJAX requests for the users table.
 * Both the pagination and sort links will be bound so that
 * requests are made asynchronously.
 */
function initAsyncUserPagination()
{
$('#user_list .PaginationLinks a, #user_list thead
a').click(function()
{
$('#user_list').fadeTo('fast', 0.1);

$('#content').loading(true);
var href = $(this).attr('href');

/* fetch the form
 */
$.ajax({
url: href,
cache: false,
success: function(html)
{
$('#content').loading(false);

/* replace the entire #user_list table
 */

$('#user_list').replaceWith(html).fadeTo('slow', 100);
stripeRows('#user_list tbody');

/* call this function again to init new
content
 */
initAsyncUserPagination();
}
});
return false;
}); 
}

function stripeRows(selector)
{
$(selector + ' tr:nth-child(even)').addClass('Odd');
}


On Tue, Aug 11, 2009 at 1:10 PM, Dave Maharaj ::
WidePixels.comd...@widepixels.com wrote:
 I have the ajax jquery pagintiion set up no problem.

 I am using a default layout,single column for content.

 Now when i load the posts page (which has the pagination) the index 
 view is split into 2 columns, right side is menu, left side is the 
 paginator. But when i click next, the 2 column loads into the pagination
div.

 I put just the pagination content into an element and load element 
 from the view, click next and it stll loads the full view.

 How can only load the pagination into a div. I know it has todo with 
 my index function because it loads the default template which then 
 pulls the index view which has the 2 cols...so when i load the ajax 
 pagination the index function is still pulling the full view.

 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: clearCache() unexpected behavior

2009-08-11 Thread gerhardsletten

Think it only deletes files under tmp/cache/views
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: internationalization in model

2009-08-11 Thread tobi_one

Hi,

for future reference, this is IMHO the most elegant solution for this
problem:

http://cake.eizoku.com/blog/?p=30#comment-8

Cheers,
tobi_one

On Jul 29, 4:07 am, Dr. Loboto drlob...@gmail.com wrote:
 With Model::invalidate() method reload you do not have such problems
 at all.

 On Jul 29, 12:17 am,tobi_onetobias.h...@gmail.com wrote:

  Hi,

  I am using __() internationalization in my model as described here:

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

  It works great, but there is one problem. I set the language of the
  app in the beforefilter of the app_controller. Apparently the models
  are loaded before this and so the models always return the default
  language.

  Where do you guys set the language of the app? Especially if you are
  using the __contruct method as mentioned in the post from above.

  Thanks!

  Cheers,
 tobi_one


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



server transfer problem

2009-08-11 Thread brian

I'm having some trouble getting a site working on another server. The
people the client hired are using cPanel, PHP is installed as CGI, and
mod_rewrite is not available. Additionally, I have to access their
version of the site through an IP address plus a home subdirectory,
eg:

http://xxx.xxx.xxx.xxx./~foo/

The directory structure:

/home/foo/public_html/index.php
/home/foo/public_html/app/
/home/foo/public_html/app/webroot/
/home/foo/public_html/cake/

However, I'm just getting 404s (Apache's, not Cake's). Even a regular
file in public_html is not found.

I had this working (almost) with the contents of webroot in
public_html and app  cake outside that. But I ran into trouble with
the lack of mod_rewrite and gave up on that. Now, I can't seem to get
anything to show up. Anyone have an idea?

--~--~-~--~~~---~--~~
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: server transfer problem

2009-08-11 Thread Robert P

According to the comments in /app/config/core.php:
1. Delete ALL .htaccess files, and then
2. Uncomment the line that sets App.baseUrl in /app/config/core.php

But then again, the only times I played around with CakePHP without
mod_rewrite was pre-1.0

On Aug 12, 4:25 am, brian bally.z...@gmail.com wrote:
 I'm having some trouble getting a site working on another server. The
 people the client hired are using cPanel, PHP is installed as CGI, and
 mod_rewrite is not available. Additionally, I have to access their
 version of the site through an IP address plus a home subdirectory,
 eg:

 http://xxx.xxx.xxx.xxx./~foo/

 The directory structure:

 /home/foo/public_html/index.php
 /home/foo/public_html/app/
 /home/foo/public_html/app/webroot/
 /home/foo/public_html/cake/

 However, I'm just getting 404s (Apache's, not Cake's). Even a regular
 file in public_html is not found.

 I had this working (almost) with the contents of webroot in
 public_html and app  cake outside that. But I ran into trouble with
 the lack of mod_rewrite and gave up on that. Now, I can't seem to get
 anything to show up. Anyone have an idea?
--~--~-~--~~~---~--~~
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: Want to add another application in cake

2009-08-11 Thread Hols Kay

You can use use mod_rewrite to redirect all the old urls to their Cake
equivalents.

http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html

On Aug 11, 7:43 pm, Vijay k.vidn...@gmail.com wrote:
 My old site is in simple php.We have developed a new version of that
 site using cakephp.
 Now we want to add the old site in the cakephp.

 But the google search gives the old site links.So i want to maintain
 the old site too along with new version which is in cakephp.

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



Re: server transfer problem

2009-08-11 Thread Jonathon Musters

Being a sys admin of a shared server a lot of cpanel servers do not
server php on the. ~username.   I would first check that


On 8/11/09, Robert P shiftyrobs...@gmail.com wrote:

 According to the comments in /app/config/core.php:
 1. Delete ALL .htaccess files, and then
 2. Uncomment the line that sets App.baseUrl in /app/config/core.php

 But then again, the only times I played around with CakePHP without
 mod_rewrite was pre-1.0

 On Aug 12, 4:25 am, brian bally.z...@gmail.com wrote:
 I'm having some trouble getting a site working on another server. The
 people the client hired are using cPanel, PHP is installed as CGI, and
 mod_rewrite is not available. Additionally, I have to access their
 version of the site through an IP address plus a home subdirectory,
 eg:

 http://xxx.xxx.xxx.xxx./~foo/

 The directory structure:

 /home/foo/public_html/index.php
 /home/foo/public_html/app/
 /home/foo/public_html/app/webroot/
 /home/foo/public_html/cake/

 However, I'm just getting 404s (Apache's, not Cake's). Even a regular
 file in public_html is not found.

 I had this working (almost) with the contents of webroot in
 public_html and app  cake outside that. But I ran into trouble with
 the lack of mod_rewrite and gave up on that. Now, I can't seem to get
 anything to show up. Anyone have an idea?
 


-- 
Sent from my mobile device

--~--~-~--~~~---~--~~
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: Sessions and Redirect

2009-08-11 Thread LS

Er...
Sorry, you're right.
My code example was wrong, but using ?php $this-Session-check
('key') ? it also returns false. It creates two sessions (entries) in
the database (cake_sessions).

What i'm doing exactly:

1. User comes from an external site (eg. google.com) to an user-
protected page (eg. mydomain.com/post/add) (user must login to access
the page)
2. Cakephp stores the page the user wants to access in the session
3. User is redirected ?php $this-redirect('/users/login'); ?
4. User authenticates and returns to ?php $this-Session-read
('referer'); ? (note: if using ?php $this-referer() ? in this
case, it returns the original off-site address (google.com), not the
first address the user tried to reach (mydomain.com/post/add)).

Still need help. Please?

Thanks!

On Aug 11, 11:52 am, Robert P shiftyrobs...@gmail.com wrote:
 In TwoController::bug() your call to SessionComponent seems
 nonsensical. Looking at what you are trying to do it should either be

 $this-Session-check('key') which should return TRUE since you set
 this value in OneController::start(), or

 ($this-Session-read('key') == 'info') which should also return TRUE
 for the above reason

 On Aug 11, 10:06 pm, LS lsmo...@gmail.com wrote:

  Hello, everyone.

  I'm into a dead end and I can't seem to get this session and redirect
  things right...

  I've tested this using cakephp, php and database session methods.

  I have two controllers and one action in each one, like this:

  ?php

  class OneController extends AppController {
    function start() {
      $this-Session-write('key', 'info');
      $this-redirect('/two/bug');
      // exit; // -- with or without this, I get the error.
    }
  (...)
  ?

  other file
  ?php

  class TwoController extends AppController {
    function bug() {
      if ($this-Session-check('info')) {
        // This never happens!
        echo(working);
      }
    }

  }

  ?

  When I check the database, I see two sessions, one with the info that
  was written on the controller one, and another one almost empty
  (only timeout and other info).

  I've even set the ?php Configure::write('Session.checkAgent',
  false); ? on the core.php file, but it still no good.

  Can someone enlight me, please?
  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
-~--~~~~--~~--~--~---



Re: console cant connect to the database

2009-08-11 Thread Idalgo

hello, i got the same problem, and i am also using wamp as server,
though i use sqlite for db
it works perfectly fine from website (on handmade models)

console was set like its shown in screencasts from cake bakery

i would be thankfull if someone could solve our problem

On 10 Sie, 09:43, ondrobaco ondrob...@gmail.com wrote:
 hello, im trying tobakean application.
 the database is installed and the cakephp screen saying that the
 application can connect to mysql. when i tried tobakethe models
 using console, it says that it the database doesnt have a tables
 (which it does) and comes up with this error message:

 What would you like toBake? (D/M/V/C/P/Q) m

 ---BakeModel
 Path: C:\wamp\www\textback\models\
 ---

 Warning: mysql_connect(): Can't connect to MySQL server on
 '127.0.0.1' (10061) i
 n C:\wamp\cake\cake\libs\model\datasources\dbo\dbo_mysql.php on line
 374

 Warning: mysql_select_db(): supplied argument is not a valid MySQL-
 Link resource
  in C:\wamp\cake\cake\libs\model\datasources\dbo\dbo_mysql.php on line
 379

 Warning: mysql_get_server_info(): supplied argument is not a valid
 MySQL-Link re
 source in C:\wamp\cake\cake\libs\model\datasources\dbo\dbo_mysql.php
 on line 387

 Warning: mysql_query(): supplied argument is not a valid MySQL-Link
 resource in
 C:\wamp\cake\cake\libs\model\datasources\dbo\dbo_mysql.php on line 411
 Error: Your database does not have any tables.

 any help is greatly appreciated. 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
-~--~~~~--~~--~--~---



jquery / Ajax help

2009-08-11 Thread Dave Maharaj :: WidePixels.com
I have integrated jquery with my pagination but having trouble adding a
history plugin . So if a user leaves the pagination page then clicks back in
the browser it will load up where they left off.
 
Has anyone added a feature like this to pagination and managed to get it
working?
 
Any help or name of the history plugin you used wuld be great.
 
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
-~--~~~~--~~--~--~---



HTML helper in function?

2009-08-11 Thread Josh

Hi,

I have the contents of a tree menu stored in a multi-dimensional
array. The number of dimensions is not fixed, so to turn the array
into a menu in the View file, I have set up a recurring function. This
works fine except that I can't call the $html-link() from the
function.

Fatal error: Call to a member function link() on a non-object in...

Any ideas? Is there a way to make the link() function global as you do
a variable? There are some obvious work-arounds such as writing the
anchor tag without the html helper, or turning the link array into a
simpler two dimensional array where I can then iterate the link()
function. However, I am wonder how I might specifically address the
question of making the html-link() function available to a function
within a view file.

I have a feeling this is either going to be a simple declaration or
not worth the trouble. Thanks in advance.

Here is my code:


//array of links
key: link title
value: link location or sub-array
$linkTree = array(
'User Management' = array(
'Permissions' = array(
'Set Permissions' = '/tools/setPermissions',
'Update ACOS' = '/tools/updateacl',
'View/Edit Groups' = '/admin/groups'
),
'User Settings' = '/tools/userSettings',
'Users' = array(
'List' = '/admin/users',
'Add User' = '/admin/users/add'
)
)
);

//output menu function
function outputMenu ($array, $level) {
global $levelMarker;

foreach ($array as $key = $value) {
if (is_array($value)) {
echo $level . $key;
echo 'br';
outputMenu($value, $level . $levelMarker);
} else {
echo $html-link($level$key, $value);
echo 'br';
}
}
echo br;
}

//output menu settings
$levelMarker = '-';
$level = '';
$linkTreeSimple = array();

//output menu
outputMenu($linkTree, $level);

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



Re: HTML helper in function?

2009-08-11 Thread JamesF

if your controller is set up with var $helpers = array('html') ; you
should be fine..that error is just telling you that cake can't find
HtmlHelper...is there a reason you are executing that logic in your
view and not the controller?

On Aug 11, 7:02 pm, Josh joshs.silver...@gmail.com wrote:
 Hi,

 I have the contents of a tree menu stored in a multi-dimensional
 array. The number of dimensions is not fixed, so to turn the array
 into a menu in the View file, I have set up a recurring function. This
 works fine except that I can't call the $html-link() from the
 function.

 Fatal error: Call to a member function link() on a non-object in...

 Any ideas? Is there a way to make the link() function global as you do
 a variable? There are some obvious work-arounds such as writing the
 anchor tag without the html helper, or turning the link array into a
 simpler two dimensional array where I can then iterate the link()
 function. However, I am wonder how I might specifically address the
 question of making the html-link() function available to a function
 within a view file.

 I have a feeling this is either going to be a simple declaration or
 not worth the trouble. Thanks in advance.

 Here is my code:

     //array of links
     key: link title
     value: link location or sub-array
     $linkTree = array(
         'User Management' = array(
             'Permissions' = array(
                 'Set Permissions' = '/tools/setPermissions',
                 'Update ACOS' = '/tools/updateacl',
                 'View/Edit Groups' = '/admin/groups'
             ),
             'User Settings' = '/tools/userSettings',
             'Users' = array(
                 'List' = '/admin/users',
                 'Add User' = '/admin/users/add'
             )
         )
     );

     //output menu function
     function outputMenu ($array, $level) {
         global $levelMarker;

         foreach ($array as $key = $value) {
             if (is_array($value)) {
                 echo $level . $key;
                 echo 'br';
                 outputMenu($value, $level . $levelMarker);
             } else {
                 echo $html-link($level$key, $value);
                 echo 'br';
             }
         }
         echo br;
     }

     //output menu settings
     $levelMarker = '-';
     $level = '';
     $linkTreeSimple = array();

     //output menu
     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
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: server transfer problem

2009-08-11 Thread JamesF

@brian would you mind pasting your index.php

On Aug 11, 4:25 pm, brian bally.z...@gmail.com wrote:
 I'm having some trouble getting a site working on another server. The
 people the client hired are using cPanel, PHP is installed as CGI, and
 mod_rewrite is not available. Additionally, I have to access their
 version of the site through an IP address plus a home subdirectory,
 eg:

 http://xxx.xxx.xxx.xxx./~foo/

 The directory structure:

 /home/foo/public_html/index.php
 /home/foo/public_html/app/
 /home/foo/public_html/app/webroot/
 /home/foo/public_html/cake/

 However, I'm just getting 404s (Apache's, not Cake's). Even a regular
 file in public_html is not found.

 I had this working (almost) with the contents of webroot in
 public_html and app  cake outside that. But I ran into trouble with
 the lack of mod_rewrite and gave up on that. Now, I can't seem to get
 anything to show up. Anyone have an idea?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Is there a way to select an action from a double-click?

2009-08-11 Thread FrederickD

Thank you for your on-going support! There are a lot of good answers
on this group. I've searched for this answer here and in the book
but cannot find it.

What is the best way to have the user select an action (RUD; read,
update, delete) without a separate link at the end of the row, as in
the default behavior?

Is there a way to describe a 'hot spot' for one or more attributes in
a list so that if there is a double-click an action can be executed?

I'm wondering if this is the world of jQuery. I have not yet explored
that area yet.

Thanks in advance for your 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: internationalization in model

2009-08-11 Thread Alexandru Ciobanu

On 8/11/2009 10:16 PM, tobi_one wrote:
 Hi,

 for future reference, this is IMHO the most elegant solution for this
 problem:

 http://cake.eizoku.com/blog/?p=30#comment-8

 Cheers,
 tobi_one

 On Jul 29, 4:07 am, Dr. Lobotodrlob...@gmail.com  wrote:

 With Model::invalidate() method reload you do not have such problems
 at all.

 On Jul 29, 12:17 am,tobi_onetobias.h...@gmail.com  wrote:

  
 Hi,

  

 It works great, but there is one problem. I set the language of the
 app in the beforefilter of the app_controller. Apparently the models
 are loaded before this and so the models always return the default
 language.

  
 Where do you guys set the language of the app? Especially if you are
 using the __contruct method as mentioned in the post from above.


Why not use 'error' in the input() option array?
http://api.cakephp.org/class/form-helper#method-FormHelperinput

I believe it was designed for this purpose. Perhaps a cake developer can 
confirm/infirm this.

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



Re: Fatal error: Class 'Dispatcher' not found - please help

2009-08-11 Thread Brett Wilton

We encountered this error on an CakePHP1.2 installation and found that
it was related to the installed PHP version. It may be the same for
you, PHP5.2 had a problem which was part of a debian install in our
clients servers case.

Hope that helps.


http://wiltonsoftware.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
-~--~~~~--~~--~--~---



Encoding pluses in URL - Is my patch OK?

2009-08-11 Thread BeanDog

Due to the way Apache's mod_rewrite mismanages query string encoding,
$_GET['url'] isn't what I'd hope it would be when there are pluses
encoded (%2B) in the URL.

It looks like replacing line 614 of dispatcher.php with the following
works on my apache config:

if(isset($_SERVER['REDIRECT_URL']))
$url = $_SERVER['REDIRECT_URL']; //Will have correct special-char
encoding.
else
$url = $_GET['url'];

Is there some reason I'm not aware of that I should _not_ do this?


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



Search function

2009-08-11 Thread Dave Maharaj :: WidePixels.com
I am building a new search function for a input single field.
 
I have the basic set up running but as I move forward I want the user to be
able to enter more than 1 word coma separated.
 
How would I do this?
 
spilt the $queryValues = $query split ',' 
 
So i now have an array of values that they entered but how do I then query
each of those values?
 
Is there a better way to do this?
 
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: wrapper function not working!

2009-08-11 Thread armen

It's not working really. I tried it again...
if you click on the second link, where you register a username and
password, then by clicking the submit button, you should be redirected
to the index page without any problems since I'm creating a session
and redirecting.
 $this-Session-write('User', $data);
 $this-redirect('index');

Second the username and pass is not inserted in the database, so if
you click on the first link to enter the username and password you
just created, it won't let you login.


-Armen



On Aug 11, 12:43 am, anurag pal mail.anurag@gmail.com wrote:
 Hi,

 I have checked the code its working properly.

 Please cross check your method which checking for logged User. It
 might be in beforeFilter because its asking for log-in.

 Regards,
 Anurag Pal

 On Aug 11, 12:25 pm, armen oldar...@gmail.com wrote:

  This is the link to the webpage that im working 
  on...http://warplayart.com/bleed_till_death/UserLoging/users
  and this is the link that you register a 
  user...http://warplayart.com/bleed_till_death/UserLoging/users/register

  But the form on the register page, calles add in for it's action
  variable, even though im calling the register function from the url.
  So i ended up using a wrapper like this which doesn't work.

  What am i doing wrong?

  + when i was just using the add (http://warplayart.com/
  bleed_till_death/UserLoging/users/add) and placed the code inside the
  add function it worked fine.

  -
          function add()          {
                                  $this-register($this-data);
            }

          function register($data = null)                 {

                    if (!empty($data))            {

                      $data['User']['password'] = 
  md5($data['User']['password']);
                                  $this-User-create();

                            if ($this-User-save($data)) {
                                     $this-Session-setFlash(__('User 
  successfully registered',
  true));
                                           $this-Session-write('User', 
  $data);
                                           $this-redirect('index');
                                           exit();
                            }
                            else {
                                     $this-Session-setFlash(__('The Post 
  could not be saved.
  Please, try again.', true));
                            }
                    }
            }
  

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



Re: HTML helper in function?

2009-08-11 Thread Josh

The helpers are set and work fine. However, $html-link() does not
work when called within a function in the view.

As for where the logic is written: this is an element that appears in
all admin tools throughout the site. requestAction() would allow me to
put some of the logic in the controller, however since this is an
array used only for constructing a menu, I don't really see any
advantage to that.

On Aug 11, 7:15 pm, JamesF usaexportexpe...@gmail.com wrote:
 if your controller is set up with var $helpers = array('html') ; you
 should be fine..that error is just telling you that cake can't find
 HtmlHelper...is there a reason you are executing that logic in your
 view and not the controller?

 On Aug 11, 7:02 pm, Josh joshs.silver...@gmail.com wrote:



  Hi,

  I have the contents of a tree menu stored in a multi-dimensional
  array. The number of dimensions is not fixed, so to turn the array
  into a menu in the View file, I have set up a recurring function. This
  works fine except that I can't call the $html-link() from the
  function.

  Fatal error: Call to a member function link() on a non-object in...

  Any ideas? Is there a way to make the link() function global as you do
  a variable? There are some obvious work-arounds such as writing the
  anchor tag without the html helper, or turning the link array into a
  simpler two dimensional array where I can then iterate the link()
  function. However, I am wonder how I might specifically address the
  question of making the html-link() function available to a function
  within a view file.

  I have a feeling this is either going to be a simple declaration or
  not worth the trouble. Thanks in advance.

  Here is my code:

      //array of links
      key: link title
      value: link location or sub-array
      $linkTree = array(
          'User Management' = array(
              'Permissions' = array(
                  'Set Permissions' = '/tools/setPermissions',
                  'Update ACOS' = '/tools/updateacl',
                  'View/Edit Groups' = '/admin/groups'
              ),
              'User Settings' = '/tools/userSettings',
              'Users' = array(
                  'List' = '/admin/users',
                  'Add User' = '/admin/users/add'
              )
          )
      );

      //output menu function
      function outputMenu ($array, $level) {
          global $levelMarker;

          foreach ($array as $key = $value) {
              if (is_array($value)) {
                  echo $level . $key;
                  echo 'br';
                  outputMenu($value, $level . $levelMarker);
              } else {
                  echo $html-link($level$key, $value);
                  echo 'br';
              }
          }
          echo br;
      }

      //output menu settings
      $levelMarker = '-';
      $level = '';
      $linkTreeSimple = array();

      //output menu
      outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-11 Thread JamesF

hmm im not sure if this will work but you could try in your element:

App:import('Helper', Html');

$html = new html();

On Aug 11, 10:47 pm, Josh joshs.silver...@gmail.com wrote:
 The helpers are set and work fine. However, $html-link() does not
 work when called within a function in the view.

 As for where the logic is written: this is an element that appears in
 all admin tools throughout the site. requestAction() would allow me to
 put some of the logic in the controller, however since this is an
 array used only for constructing a menu, I don't really see any
 advantage to that.

 On Aug 11, 7:15 pm, JamesF usaexportexpe...@gmail.com wrote:

  if your controller is set up with var $helpers = array('html') ; you
  should be fine..that error is just telling you that cake can't find
  HtmlHelper...is there a reason you are executing that logic in your
  view and not the controller?

  On Aug 11, 7:02 pm, Josh joshs.silver...@gmail.com wrote:

   Hi,

   I have the contents of a tree menu stored in a multi-dimensional
   array. The number of dimensions is not fixed, so to turn the array
   into a menu in the View file, I have set up a recurring function. This
   works fine except that I can't call the $html-link() from the
   function.

   Fatal error: Call to a member function link() on a non-object in...

   Any ideas? Is there a way to make the link() function global as you do
   a variable? There are some obvious work-arounds such as writing the
   anchor tag without the html helper, or turning the link array into a
   simpler two dimensional array where I can then iterate the link()
   function. However, I am wonder how I might specifically address the
   question of making the html-link() function available to a function
   within a view file.

   I have a feeling this is either going to be a simple declaration or
   not worth the trouble. Thanks in advance.

   Here is my code:

       //array of links
       key: link title
       value: link location or sub-array
       $linkTree = array(
           'User Management' = array(
               'Permissions' = array(
                   'Set Permissions' = '/tools/setPermissions',
                   'Update ACOS' = '/tools/updateacl',
                   'View/Edit Groups' = '/admin/groups'
               ),
               'User Settings' = '/tools/userSettings',
               'Users' = array(
                   'List' = '/admin/users',
                   'Add User' = '/admin/users/add'
               )
           )
       );

       //output menu function
       function outputMenu ($array, $level) {
           global $levelMarker;

           foreach ($array as $key = $value) {
               if (is_array($value)) {
                   echo $level . $key;
                   echo 'br';
                   outputMenu($value, $level . $levelMarker);
               } else {
                   echo $html-link($level$key, $value);
                   echo 'br';
               }
           }
           echo br;
       }

       //output menu settings
       $levelMarker = '-';
       $level = '';
       $linkTreeSimple = array();

       //output menu
       outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-11 Thread JamesF

hmm im not sure if this will work but you could try in your element:

App:import('Helper', Html');

$html = new html();

does html helper work in other parts of your element outside the
function? i usually have no problems at all using $html-link() within
an element function.

On Aug 11, 10:47 pm, Josh joshs.silver...@gmail.com wrote:
 The helpers are set and work fine. However, $html-link() does not
 work when called within a function in the view.

 As for where the logic is written: this is an element that appears in
 all admin tools throughout the site. requestAction() would allow me to
 put some of the logic in the controller, however since this is an
 array used only for constructing a menu, I don't really see any
 advantage to that.

 On Aug 11, 7:15 pm, JamesF usaexportexpe...@gmail.com wrote:

  if your controller is set up with var $helpers = array('html') ; you
  should be fine..that error is just telling you that cake can't find
  HtmlHelper...is there a reason you are executing that logic in your
  view and not the controller?

  On Aug 11, 7:02 pm, Josh joshs.silver...@gmail.com wrote:

   Hi,

   I have the contents of a tree menu stored in a multi-dimensional
   array. The number of dimensions is not fixed, so to turn the array
   into a menu in the View file, I have set up a recurring function. This
   works fine except that I can't call the $html-link() from the
   function.

   Fatal error: Call to a member function link() on a non-object in...

   Any ideas? Is there a way to make the link() function global as you do
   a variable? There are some obvious work-arounds such as writing the
   anchor tag without the html helper, or turning the link array into a
   simpler two dimensional array where I can then iterate the link()
   function. However, I am wonder how I might specifically address the
   question of making the html-link() function available to a function
   within a view file.

   I have a feeling this is either going to be a simple declaration or
   not worth the trouble. Thanks in advance.

   Here is my code:

       //array of links
       key: link title
       value: link location or sub-array
       $linkTree = array(
           'User Management' = array(
               'Permissions' = array(
                   'Set Permissions' = '/tools/setPermissions',
                   'Update ACOS' = '/tools/updateacl',
                   'View/Edit Groups' = '/admin/groups'
               ),
               'User Settings' = '/tools/userSettings',
               'Users' = array(
                   'List' = '/admin/users',
                   'Add User' = '/admin/users/add'
               )
           )
       );

       //output menu function
       function outputMenu ($array, $level) {
           global $levelMarker;

           foreach ($array as $key = $value) {
               if (is_array($value)) {
                   echo $level . $key;
                   echo 'br';
                   outputMenu($value, $level . $levelMarker);
               } else {
                   echo $html-link($level$key, $value);
                   echo 'br';
               }
           }
           echo br;
       }

       //output menu settings
       $levelMarker = '-';
       $level = '';
       $linkTreeSimple = array();

       //output menu
       outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
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: Multidimensional array as named argument

2009-08-11 Thread JamesF

i would just use implode on the array to set up my seperate arguments
and turn it into a url string

On Aug 11, 10:22 am, Tushar maniktus...@gmail.com wrote:
 Is it possible to pass an array through named arguments and have it
 accessible via $this-passedArgs?

 How would you convert an array as such to a named argument

 Array
         (
             [foo] = foo1
             [bar] = Array
                 (
                     [0] = bar0
                     [1] = bar1
                 )
         )

 it becomes foo:foo1/bar:Array if passed to Router::url to generate the
 url

 Is it not possible to have arrays in named arguments? Then how can we
 handle multiple values generated by multiple selects or checkboxes?
--~--~-~--~~~---~--~~
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: Is there a way to select an action from a double-click?

2009-08-11 Thread JamesF

really, really trying to understand what you are attempting here.

On Aug 11, 7:47 pm, FrederickD manzanillo.engl...@gmail.com wrote:
 Thank you for your on-going support! There are a lot of good answers
 on this group. I've searched for this answer here and in the book
 but cannot find it.

 What is the best way to have the user select an action (RUD; read,
 update, delete) without a separate link at the end of the row, as in
 the default behavior?

 Is there a way to describe a 'hot spot' for one or more attributes in
 a list so that if there is a double-click an action can be executed?

 I'm wondering if this is the world of jQuery. I have not yet explored
 that area yet.

 Thanks in advance for your 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: Encoding pluses in URL - Is my patch OK?

2009-08-11 Thread JamesF

well modifying the core in general is bad because it makes your app
harder to debug and we can't really help you when you change the core

. it's kind of like opening your ps2 and voiding the warranty, you
might be able to install the mod chip, but it's no guarantee of future
support.

On Aug 11, 8:44 pm, BeanDog bean...@gmail.com wrote:
 Due to the way Apache's mod_rewrite mismanages query string encoding,
 $_GET['url'] isn't what I'd hope it would be when there are pluses
 encoded (%2B) in the URL.

 It looks like replacing line 614 of dispatcher.php with the following
 works on my apache config:

 if(isset($_SERVER['REDIRECT_URL']))
         $url = $_SERVER['REDIRECT_URL']; //Will have correct special-char
 encoding.
 else
         $url = $_GET['url'];

 Is there some reason I'm not aware of that I should _not_ do this?

 Ben Dilts
--~--~-~--~~~---~--~~
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: Uploading file issue - worning mkdir()

2009-08-11 Thread leafchild book
I'm trying to upload to /webroot/img/uploads/
both /img and /uploads directory has permission 777
and getting an error: Warning (2): mkdir()
[function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line
466]
so I commented out line 466 ~ 476 in folder.php file:
/*
if (mkdir($pathname, $mode)) {
umask($old);
$this-__messages[] = sprintf(__('%s created', true), $pathname);
return true;
} else {
umask($old);
$this-__errors[] = sprintf(__('%s NOT created', true), $pathname);
return false;
}
*/
then everything working ok.

I wander doing this causing any other issue?






On Tue, Aug 11, 2009 at 10:54 AM, brian bally.z...@gmail.com wrote:


 Don't set the permissions wide open for webroot dir! That's not a good
 idea at all.

 What is the full path of the directory you want to upload to?

 I'm sorry, I'm not familiar with the plugin and don't understand your
 other question about the data.

 On Tue, Aug 11, 2009 at 4:06 AM, leafchildleafchild.b...@gmail.com
 wrote:
 
  The uploaded img directory permission is set to 777 and just in case I
  even changed webroot permission to 777
  but I'm still seeing  same warning message. Where else I need to
  check?
 
  Also how can I stop update with entire file data to database?
 
  after trying to upload file debug show:
  ==
  [id] =1
  [uploadfile] = Array
(
[name] = IMG_0801.JPG
[type] = image/jpeg
[tmp_name] = /tmp/phpbo9DjW
[error] = 0
[size] = 404887
)
  [desc] =
  ...
  ===
 
  uploadfile field needs only file name but looking at sql trying to
  update
  filed with file array information.
 
 
 
 
 
 
  On Aug 7, 6:24 pm, brian bally.z...@gmail.com wrote:
  Check the permissions for the directory. The webserver has to have
  write access to the dir.
 
 
 
  On Fri, Aug 7, 2009 at 4:02 PM,leafchildleafchild.b...@gmail.com
 wrote:
 
   I'm trying to make this plugin(http://www.milesj.me/resources/script/
   uploader-plugin) works.
 
   However, after I install I'm getting an error - Warning (2): mkdir()
   [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line
   466]
   Actually I tried another behavior to upload file and got same error.
   Do  I need to do some kind of server setting? I'm using MT(dv)
 
   Also after submit to upload file I'm getting an SQL error because data
   need to be one but it try to update entire file data:
 
   ==
   [id] =1
   [uploadfile] = Array
 (
 [name] = IMG_0801.JPG
 [type] = image/jpeg
 [tmp_name] = /tmp/phpbo9DjW
 [error] = 0
 [size] = 404887
 )
   [desc] =
   ...
   ===
   uplodefile 's data is not array just [NAME] of file.
 
   How can I stop doing it? I can't use $this-Landing-save($this-
  data) if I have file uploading?
  
 

 


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



Re: HTML helper in function?

2009-08-11 Thread JamesF

if you have time would you mind posting a test case or example code? i
would love to see some more of the code in context just so I can
improve my understanding of the issue.

please let us know what works in the end for you it might help someone
in the future

On Aug 12, 1:09 am, Josh joshs.silver...@gmail.com wrote:
 It works fine outside of the function. I've run into this before;
 helper functions not working within View functions. Are you sure
 you've had that work in the past?

 I think the issue is that you normally (in models, controllers,
 components...) need to reference the object where the function is
 located with $this- in order to access functions accessible to the
 whole object. However, View files don't typically have their own
 classes and objects (excluding helpers) since most of the logic is
 handled elsewhere in the app.  Therefore, you get either an unknown
 method error or non-object error.

 I think I will throw this all in an array - menu helper with the Html
 helper. That way I'll be able to reference the object with the link()
 function.

 Thanks for your help.

 On Aug 11, 11:15 pm, JamesF vacationrental...@gmail.com wrote:

  hmm im not sure if this will work but you could try in your element:

  App:import('Helper', Html');

  $html = new html();

  does html helper work in other parts of your element outside the
  function? i usually have no problems at all using $html-link() within
  an element function.

  On Aug 11, 10:47 pm, Josh joshs.silver...@gmail.com wrote:

   The helpers are set and work fine. However, $html-link() does not
   work when called within a function in the view.

   As for where the logic is written: this is an element that appears in
   all admin tools throughout the site. requestAction() would allow me to
   put some of the logic in the controller, however since this is an
   array used only for constructing a menu, I don't really see any
   advantage to that.

   On Aug 11, 7:15 pm, JamesF usaexportexpe...@gmail.com wrote:

if your controller is set up with var $helpers = array('html') ; you
should be fine..that error is just telling you that cake can't find
HtmlHelper...is there a reason you are executing that logic in your
view and not the controller?

On Aug 11, 7:02 pm, Josh joshs.silver...@gmail.com wrote:

 Hi,

 I have the contents of a tree menu stored in a multi-dimensional
 array. The number of dimensions is not fixed, so to turn the array
 into a menu in the View file, I have set up a recurring function. This
 works fine except that I can't call the $html-link() from the
 function.

 Fatal error: Call to a member function link() on a non-object in...

 Any ideas? Is there a way to make the link() function global as you do
 a variable? There are some obvious work-arounds such as writing the
 anchor tag without the html helper, or turning the link array into a
 simpler two dimensional array where I can then iterate the link()
 function. However, I am wonder how I might specifically address the
 question of making the html-link() function available to a function
 within a view file.

 I have a feeling this is either going to be a simple declaration or
 not worth the trouble. Thanks in advance.

 Here is my code:

     //array of links
     key: link title
     value: link location or sub-array
     $linkTree = array(
         'User Management' = array(
             'Permissions' = array(
                 'Set Permissions' = '/tools/setPermissions',
                 'Update ACOS' = '/tools/updateacl',
                 'View/Edit Groups' = '/admin/groups'
             ),
             'User Settings' = '/tools/userSettings',
             'Users' = array(
                 'List' = '/admin/users',
                 'Add User' = '/admin/users/add'
             )
         )
     );

     //output menu function
     function outputMenu ($array, $level) {
         global $levelMarker;

         foreach ($array as $key = $value) {
             if (is_array($value)) {
                 echo $level . $key;
                 echo 'br';
                 outputMenu($value, $level . $levelMarker);
             } else {
                 echo $html-link($level$key, $value);
                 echo 'br';
             }
         }
         echo br;
     }

     //output menu settings
     $levelMarker = '-';
     $level = '';
     $linkTreeSimple = array();

     //output menu
     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
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 

Re: HTML helper in function?

2009-08-11 Thread Josh

It works fine outside of the function. I've run into this before;
helper functions not working within View functions. Are you sure
you've had that work in the past?

I think the issue is that you normally (in models, controllers,
components...) need to reference the object where the function is
located with $this- in order to access functions accessible to the
whole object. However, View files don't typically have their own
classes and objects (excluding helpers) since most of the logic is
handled elsewhere in the app.  Therefore, you get either an unknown
method error or non-object error.

I think I will throw this all in an array - menu helper with the Html
helper. That way I'll be able to reference the object with the link()
function.

Thanks for your help.


On Aug 11, 11:15 pm, JamesF vacationrental...@gmail.com wrote:
 hmm im not sure if this will work but you could try in your element:

 App:import('Helper', Html');

 $html = new html();

 does html helper work in other parts of your element outside the
 function? i usually have no problems at all using $html-link() within
 an element function.

 On Aug 11, 10:47 pm, Josh joshs.silver...@gmail.com wrote:



  The helpers are set and work fine. However, $html-link() does not
  work when called within a function in the view.

  As for where the logic is written: this is an element that appears in
  all admin tools throughout the site. requestAction() would allow me to
  put some of the logic in the controller, however since this is an
  array used only for constructing a menu, I don't really see any
  advantage to that.

  On Aug 11, 7:15 pm, JamesF usaexportexpe...@gmail.com wrote:

   if your controller is set up with var $helpers = array('html') ; you
   should be fine..that error is just telling you that cake can't find
   HtmlHelper...is there a reason you are executing that logic in your
   view and not the controller?

   On Aug 11, 7:02 pm, Josh joshs.silver...@gmail.com wrote:

Hi,

I have the contents of a tree menu stored in a multi-dimensional
array. The number of dimensions is not fixed, so to turn the array
into a menu in the View file, I have set up a recurring function. This
works fine except that I can't call the $html-link() from the
function.

Fatal error: Call to a member function link() on a non-object in...

Any ideas? Is there a way to make the link() function global as you do
a variable? There are some obvious work-arounds such as writing the
anchor tag without the html helper, or turning the link array into a
simpler two dimensional array where I can then iterate the link()
function. However, I am wonder how I might specifically address the
question of making the html-link() function available to a function
within a view file.

I have a feeling this is either going to be a simple declaration or
not worth the trouble. Thanks in advance.

Here is my code:

    //array of links
    key: link title
    value: link location or sub-array
    $linkTree = array(
        'User Management' = array(
            'Permissions' = array(
                'Set Permissions' = '/tools/setPermissions',
                'Update ACOS' = '/tools/updateacl',
                'View/Edit Groups' = '/admin/groups'
            ),
            'User Settings' = '/tools/userSettings',
            'Users' = array(
                'List' = '/admin/users',
                'Add User' = '/admin/users/add'
            )
        )
    );

    //output menu function
    function outputMenu ($array, $level) {
        global $levelMarker;

        foreach ($array as $key = $value) {
            if (is_array($value)) {
                echo $level . $key;
                echo 'br';
                outputMenu($value, $level . $levelMarker);
            } else {
                echo $html-link($level$key, $value);
                echo 'br';
            }
        }
        echo br;
    }

    //output menu settings
    $levelMarker = '-';
    $level = '';
    $linkTreeSimple = array();

    //output menu
    outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
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: Want to add another application in cake

2009-08-11 Thread Vijay Kumbhar
Yes you are right hols

But the old site have more that 100 urls.

So how can it do it by mod_rewrite?

On Wed, Aug 12, 2009 at 3:02 AM, Hols Kay hol...@googlemail.com wrote:


 You can use use mod_rewrite to redirect all the old urls to their Cake
 equivalents.

 http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html

 On Aug 11, 7:43 pm, Vijay k.vidn...@gmail.com wrote:
  My old site is in simple php.We have developed a new version of that
  site using cakephp.
  Now we want to add the old site in the cakephp.
 
  But the google search gives the old site links.So i want to maintain
  the old site too along with new version which is in cakephp.
 
  Can anybody help me in this?
 



-- 
Thanks  Regards,
Vijayk.
Co-founder (www.weboniselab.com)

You Bring the Dreams, We'll Bring the Means

--~--~-~--~~~---~--~~
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: Default values in select lists

2009-08-11 Thread jburns

This doesn't add a new value to the list, just selects one that's
already there. I want the list to start of with a custom row that is
not in the database (such as Please select a value) that will be
selected by default (unless there is already a selection) and the rest
of the list is drawn from the table.

On Aug 11, 9:21 am, arif hossen arifhossen2...@gmail.com wrote:
 You can use below code cakephp format.

 ?php

 echo $html-input('listname',array('options'=$mylist,'Selected'='Please
 select a value));

 ?

 On 8/11/09, jburns jeremybu...@me.com wrote:



  How can I add a blank value (something like Please select a value)
  to the top of a select list when using $this-Xxxx-Yyyy-find
  ('list'); instead of defaulting to the first value in the list?

 --

 Regards,
 Mohammad Arif Hossen
 Web Developer
 United Group International(UGIBD)www.ugibd.net
 Mobile no:  +88 01714355911
 Mobile no:  +88 01922110308
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Currency precision

2009-08-11 Thread jburns

I'd like to take a number and display it as currency but with a
defined precision - for example £100,000. I have tried the following:

$number-currency($number-precision($property['Property']['price'],
0 ),'GBP')

which nests the $number-precision function inside of the $number-
currency function, but the precision is being ignored. Any ideas?
--~--~-~--~~~---~--~~
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: wrapper function not working!

2009-08-11 Thread John Andersen

Please show the code for the view in which you are creating the form
for the user to register him-/herself!
Enjoy,
   John

On Aug 12, 5:15 am, armen oldar...@gmail.com wrote:
 It's not working really. I tried it again...
 if you click on the second link, where you register a username and
 password, then by clicking the submit button, you should be redirected
 to the index page without any problems since I'm creating a session
 and redirecting.
      $this-Session-write('User', $data);
      $this-redirect('index');

 Second the username and pass is not inserted in the database, so if
 you click on the first link to enter the username and password you
 just created, it won't let you login.

 -Armen

 On Aug 11, 12:43 am, anurag pal mail.anurag@gmail.com wrote:

  Hi,

  I have checked the code its working properly.

  Please cross check your method which checking for logged User. It
  might be in beforeFilter because its asking for log-in.

  Regards,
  Anurag Pal

  On Aug 11, 12:25 pm, armen oldar...@gmail.com wrote:

   This is the link to the webpage that im working 
   on...http://warplayart.com/bleed_till_death/UserLoging/users
   and this is the link that you register a 
   user...http://warplayart.com/bleed_till_death/UserLoging/users/register

   But the form on the register page, calles add in for it's action
   variable, even though im calling the register function from the url.
   So i ended up using a wrapper like this which doesn't work.

   What am i doing wrong?

   + when i was just using the add (http://warplayart.com/
   bleed_till_death/UserLoging/users/add) and placed the code inside the
   add function it worked fine.

   -
           function add()          {
                                   $this-register($this-data);
             }

           function register($data = null)                 {

                     if (!empty($data))            {

                       $data['User']['password'] = 
   md5($data['User']['password']);
                                   $this-User-create();

                             if ($this-User-save($data)) {
                                      $this-Session-setFlash(__('User 
   successfully registered',
   true));
                                            $this-Session-write('User', 
   $data);
                                            $this-redirect('index');
                                            exit();
                             }
                             else {
                                      $this-Session-setFlash(__('The Post 
   could not be saved.
   Please, try again.', true));
                             }
                     }
             }
   

   Thanks in advance.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---