Re: Paginator localhost vs. remote server URL generates differently.

2009-03-11 Thread Martin Westin


I'd say that your server is doing things correctly and your local
setup is acting strange. To get any arguments to persist when
paginator creates it's links you need to do this in your view:

$paginator-options(array('url' = $this-passedArgs));

Since you mention nothing about it my guess is that you don't have it
and that for some unknown reason your local setup keeps it around
anyway.

/Martin


On Mar 11, 4:22 am, bee byrne.chri...@gmail.com wrote:
 This is very odd, when i upload my code from my local machine to my
 server, and test out the Paginator on the remote server, the URL is
 incorrectly rendered for the paginator, page 2 on the remote server.

 On localhost, the url for page 2 of my query works properly and
 displays this:http://localhost/.../.../findChildren/1/page:2

 However, when I upload to the server, the /1/ does NOT appear page 2
 link.
 Instead,http://www.mywebsite.com/.../findChildren/page:2

 The code I use for paginator VIEW is below: (it is EXACTLY THE SAME
 for both the localhost and the server)

 echo $paginator-numbers();

 The code in the controller is as follows:
 var $paginate = array(
         'limit' = 4 ,
         'order' = array(
             'Event.name' = 'asc'
             )
             );

             function findChildren($id=null)
             {

                 $events = $this-paginate('Event', array('category_id' =
 $id) );
                 $this-set('events',$events);

             }

 So, it is strange, because i NEVER wrote the code for the path of URL,
 so this must be a setting somewhere in the config?
 I am a newbie, so please excuse me for my confusion and ignorance.
 I appreciate your help in advance.
 Thanks
 Christy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Webservice problem

2009-03-11 Thread lakers fan

Hello,

I followed the following tutorial and it worked fine.

 

http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/

 

 

Then I created a function validate() (which is same as index()) and created 
validate.ctp which is same as index.ctp. But I get the error 

 

Error: The action validate is not defined in controller FooController

 

Any help would be great. The code is on the bottom.

 

 

Thanks,

Bharani

 

Code:

 

class FooController extends AppController
{
var $components = array('RequestHandler');
var $uses = '';
var $helpers = array('Text', 'Xml');

function index()
{
$message = 'Testing';
$this-set('message', $message);
$this-RequestHandler-respondAs('xml');
$this-viewPath .= '/xml';
$this-layoutPath = 'xml';
}
function validate()
{
$message = 'Testing';
$this-set('message', $message);
$this-RequestHandler-respondAs('xml');
$this-viewPath .= '/xml';
$this-layoutPath = 'xml';
} 
} 

_
Hotmail® is up to 70% faster. Now good news travels really fast. 
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to create models for complex database designs like this?

2009-03-11 Thread jason m

assuming your relations are setup correctly in the models, you
probably
just need to use the recursive in the movies controller.
$movies = $this-Movie-find('all', array('recursive'=2));

that should give you a list of celebs data for each cast. then just
use a
pr($movies) to see what is in the array.

On Mar 8, 9:40 pm, Rajesh rajesh.mukk...@gmail.com wrote:
 I am working on movie site. Client have movie records in following
 structure.

 CREATE TABLE IF NOT EXISTS `movies` (
   `id` int(50) NOT NULL AUTO_INCREMENT,
   `movieName` varchar(500) NOT NULL,
   `year` int(11) DEFAULT NULL,
   PRIMARY KEY (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8  ;
 -- 
 CREATE TABLE IF NOT EXISTS `celebrities` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `name` varchar(250) NOT NULL,
   PRIMARY KEY (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8  ;
 -- 
 CREATE TABLE IF NOT EXISTS `casts` (
   `movie_id` int(50) NOT NULL,
   `role` varchar(200) DEFAULT NULL,
   `celebrity_id` int(11) NOT NULL DEFAULT '0',
   KEY `movieid` (`movie_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

 As you can see movies has casts, casts table contains movie_id and
 celebrity_id. celebrities master table is for storing all master
 celebrity names.

 Now my problem is i have created models for movie and celebrity like
 movie hasmany cast. In movie page aim getting movie details along
 related casts. But celebrity_is is showing id instead of name how
 can i get celebrity name instead of id. 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
-~--~~~~--~~--~--~---



Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx

My articles have and belong to many photos. This is so when the photo
is seen somewhere else on the site, I can have a see related
articles. Each article also has one main photo. I can't seem to
figure out the syntax for this in APP/models/article.php file and in
APP/models/photo.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: Turning $_GET/$_POST into named params

2009-03-11 Thread AD7six



On Mar 11, 1:58 am, Casey Stark whentherobotsatt...@gmail.com wrote:
 I've been searching for the best way to do this for a while and I
 agree with Martin now. I really wish cake had a more elegant solution,
 but this one is definitely the cleanest and fastest.

What is hard about doing:

function index() {
if ($this-data) {
 return $this-redirect($this-data['ModelName']);
}
$conditions = $this-params['named'];
.. remove pagination params ..
$this-set('data', $this-paginate($conditions));
}

It's not like this is a 'new' question/problem.

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



'cake bake' having mysql connection problem with MAMP

2009-03-11 Thread bearlee

Hi all,

On my Mac OS X, I've installed MAMP and followed the blog tutorial
provided on CakePHP.
Blog tutorial went fine without any errors (no configuration error).

However, when I tried to follow the 'Simple Acl controlled
Application' tutorial, I could not run 'cake bake'.
Before I rant about my issue any further, let me show you the error
message I get:

Welcome to CakePHP v1.2.1.8004 Console
---
App : app
Path: /Applications/MAMP/htdocs/webroot/app
---
Interactive Bake Shell
---
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[Q]uit
What would you like to Bake? (D/M/V/C/P/Q)
 M
---
Bake Model
Path: /Applications/MAMP/htdocs/webroot/app/models/
---

Warning: mysql_pconnect(): Can't connect to local MySQL server through
socket '/var/mysql/mysql.sock' (2) in /Applications/MAMP/htdocs/
webroot/cake/libs/model/datasources/dbo/dbo_mysql.php on line 372

Warning: mysql_select_db(): supplied argument is not a valid MySQL-
Link resource in /Applications/MAMP/htdocs/webroot/cake/libs/model/
datasources/dbo/dbo_mysql.php on line 375

Warning: mysql_get_server_info(): supplied argument is not a valid
MySQL-Link resource in /Applications/MAMP/htdocs/webroot/cake/libs/
model/datasources/dbo/dbo_mysql.php on line 383

Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /Applications/MAMP/htdocs/webroot/cake/libs/model/
datasources/dbo/dbo_mysql.php on line 407
Error: Your database does not have any tables.


So basically, I believe that PHP is trying to connect with wrong mysql
socket, because according to the phpinfo page and the MAMP start page
indicate that the mysql socket is located /Applications/MAMP/tmp/mysql/
mysql.sock

I tried to change my config/database.php file around to use the socket
path instead of 'localhost' for host and also tried putting in port
(8889 as indicated on the start page of MAMP).

Has anyone encountered the same problem and resolved it?
I don't know why the blog tutorial did not give any problems like this
(it still doesn't!), because the blog tutorial uses the database to
CRUD blog posts.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread Xoubaman

You can model it like a normal HABTM relationship with an extra field
named main_photo.

On Mar 11, 8:30 am, mattalexx mattal...@gmail.com wrote:
 My articles have and belong to many photos. This is so when the photo
 is seen somewhere else on the site, I can have a see related
 articles. Each article also has one main photo. I can't seem to
 figure out the syntax for this in APP/models/article.php file and in
 APP/models/photo.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: when I have set the Configure::write('debug', 0), how can I let a new model can be use.

2009-03-11 Thread Rimoe
Thanks for your answer.because I has no the encourage to delete
tmp/cache/models/*
data.

[?][?]
when I delete all of that data.
my site is can use the comment the (Configure::write('Cache.disable',
true);)

Thanks

sincerely

rimoe

2009/3/10 Mauricio Morales maomora...@gmail.com


 You can manually delete the tmp/cache/models/* data.

 Are you sure that your table was created with the same DB user that
 Cake's App uses?... It could be a permission problem.

 On Mar 9, 4:36 pm, Rimoe meiyo...@gmail.com wrote:
  Thank you for your answer,
  so I have use the (Cache::clear()) in my controller,
  but it has no anything has happened.
  where should i invoke the Cache::clear()?
  do you know,
  then, i have set the Turn on  of (Configure::write('Cache.disable',
 true);)
  but now I can't turn off it, if I do it, my site will not run.
 
  what should I do,  can you tell me more detail?
 
  thank you very much.
 
  sincerely
 
  rimoe
 
  2009/3/9 Dardo Sordi Bogado dardoso...@gmail.com
 
 
 
I have set (Configure::write('debug', 0)) in my core.php,
now I  added a table,
but the cake can't find the model, and can't use the new model,
In the situation, what should I do?
 
   clear the cache!
 
and I want to use the information of debug,
but I don't want to let it show in page, only show in a file,
what can I do.
 
   You can create a custom datasource extending the one you are using but
   loggin the sql queries instead of dumping them at the end of page. Ex:
  http://bin.cakephp.org/view/503102878
 
   HTH,
   - Dardo Sordi.
 


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

inline: 360.gif

Re: the blog post problem

2009-03-11 Thread Jon Bennett

Hi bilal,

  all three htaccess files are there, but i still have to type index.php
  to access, this is how my .htaccess files looks like

  IfModule mod_rewrite.c
RewriteEngine on
RewriteRule^$ app/webroot/[L]
RewriteRule(.*) app/webroot/$1 [L]
  /IfModule

Hmm, you should have 3 different htaccess files, but other than that,
it appears to be a server issue, does the live server have mod_rewrite
on?

Cheers,

Jon

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Use Controller in Helper

2009-03-11 Thread mscdex

On Mar 10, 9:09 pm, wolf net netwolf...@gmail.com wrote:
 Controller: $this-set('controller', $this);
 view: $controller-action();

IMHO that's a bad idea on many levels.

What I meant was something like: $this-set('testResults', $this-
CustomComponent-getTest());
Then in the view you use $testResults.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form Helper, default value

2009-03-11 Thread mscdex

On Mar 11, 12:49 am, Matthieu matthieu.aussag...@gmail.com wrote:
 Hi!

 Id like to choose a default value for this form element et I dont know
 how? (exemple: defautl value: 01-01-1980 of Day-Month-YearÉ

 echo $form-input('birthdate', array('dateFormat' = 'DMY',
 'timeFormat' = 'none', 'minYear' = date('Y') - 100, 'maxYear' = date
 ('Y') - 6));

 thks

Have you tried setting the 'default' or the 'selected' key?
For example:

echo $form-input('birthdate', array('dateFormat' = 'DMY',
'timeFormat' = 'none', 'minYear' = date('Y') - 100, 'maxYear' = date
('Y') - 6, 'selected' = date(Y)));
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



controler problem

2009-03-11 Thread Trandaburu Tiberiu Andrei

hi , i need some informations about how cake works, i have 2 models ,2
controls and 2 view pages with a form on both pages , when submit on
first page i will go on the second page, i wrote in the controller :
$this-redirect('page2controller/actionpage2',null, true); , but it
still asks me if i created the function actionpage2 in the
page1controller

how can i make to use the controller function of second page?

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



Question on MI-Base project

2009-03-11 Thread marco.rizze...@gmail.com

Hi
I would use MI-Base for my application.
I have a question about it
1)I have different databases (one for my application (for example a
blog ) and one where there is saved the user's data (legacy
application) ). How can I manage a situation like 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: Redirect after an edit operation in a paginated view

2009-03-11 Thread Danny Lieberman

That didn't work - even though it seems like it should - I still
suspect CakePHP magic/debug level is breaking behavior
of the controller.Danny

On Mar 9, 2:52 pm, grigri j...@hendersonwebdesign.com wrote:
 I did just this a while ago; it worked fine for my purposes:

 $this-redirect($this-referer());

 However, there was a problem. If, after editing an item, it appears in
 a different page, then it just won't work.

 Example: your index is listed alphabetically. You're on page 3, and
 click edit on the entry Curried Animals: Aardvark to Zebra. You edit
 this to Aardvark to Zebra: A guide to wild curries. It returns you
 to page #3 but your entry is now on page #1. Is this the expected
 result?

 It might be in some cases, and not in others. One of my clients
 remarked that it _wasn't_ what they wanted, because it made what they
 were doing slower.

 I have taken to having a dropdown, similar to the one PhpMyAdmin
 offers, where the user can select the next action. Back to index,
 Find this item, View this item, Edit again, Add new, ... not
 all items on each edit, of course, only the relevant ones. The
 redirect functionality is in a component (which also generates
 appropriate data to set in the select options).

 hth
 grigri

 On Mar 9, 10:26 am, Danny Lieberman onlyj...@gmail.com wrote:

  This would seem to be a trivial task.  I have a list of paginated
  rows.   I want to be able to click on an edit operation on a
  particular page  1 and return to the same page.  I save the referer
  on entry to the function and redirect to the saved referer after the
  database save operation - but the controller always returns to the
  controller index method no matter what the user chooses.

  I'm running in production mode - perhaps this is related to debug=0?

  Here is the code:
          function fu($id = null) {
                  $refer = Controller::referer();    // save the calling
  page
                  if (!$id  empty($this-data)) {
                          $this-Session-setFlash(__('Invalid Contact',
  true));
                          $this-redirect(array('action'='index'));
                  }
                  echo $refer;
                  if (!empty($this-data)) {
                          if ($this-Contact-save($this-data)) {
                                  $this-Session-setFlash(__('The
  Contact has been saved', true));
                  //              $this-redirect(array
  ('action'='index'));
                                  $this-redirect($refer); // redirect
  back to the calling page after save
                          } else {
                                  $this-Session-setFlash(__('The
  Contact could not be saved. Please, try again.', true));
                          }
                  }
                  if (empty($this-data)) {
                          $this-data = $this-Contact-read(null, $id);
                  }
                  $this-set('contact', $this-Contact-read(null,
  $id));

  Looks like something really stupid is breaking this but I cant figure
  out what

  Danny
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: controler problem

2009-03-11 Thread ibanez_nuke
you should write $this-redirect(array('controller' =
'age2controller', 'action'
= 'actionpage2'));  instead of

$this-redirect('page2controller/actionpage2',null, true);

On Wed, Mar 11, 2009 at 5:14 PM, Trandaburu Tiberiu Andrei 
birli...@gmail.com wrote:


 hi , i need some informations about how cake works, i have 2 models ,2
 controls and 2 view pages with a form on both pages , when submit on
 first page i will go on the second page, i wrote in the controller :
 $this-redirect('page2controller/actionpage2',null, true); , but it
 still asks me if i created the function actionpage2 in the
 page1controller

 how can i make to use the controller function of second page?

 



-- 
Mohd Noor Azam Bin Mohd Fauzi
System Analyst
Sepadu InfoServe Sdn Bhd
15-A2, Tingkat 2, Jalan 3/1,
Pandan Indah Industrial park,
Pandan Indah 55100 Kuala Lumpur

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx

What's the syntax for adding an extra field to the
$hasAndBelongsToMany var?

Thank you for you response.

On Mar 11, 2:43 am, Xoubaman xouba...@gmail.com wrote:
 You can model it like a normal HABTM relationship with an extra field
 named main_photo.

 On Mar 11, 8:30 am, mattalexx mattal...@gmail.com wrote:

  My articles have and belong to many photos. This is so when the photo
  is seen somewhere else on the site, I can have a see related
  articles. Each article also has one main photo. I can't seem to
  figure out the syntax for this in APP/models/article.php file and in
  APP/models/photo.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: the blog post problem

2009-03-11 Thread bilal

Hi Jon,

You are right, all three files are different, the server had
mod_rewrite off, i turned it on and tried again but it didnt help. :(

what else could we look at ...

On Mar 11, 4:58 am, Jon Bennett jmbenn...@gmail.com wrote:
 Hi bilal,

   all three htaccess files are there, but i still have to type index.php
   to access, this is how my .htaccess files looks like

   IfModule mod_rewrite.c
     RewriteEngine on
     RewriteRule    ^$ app/webroot/    [L]
     RewriteRule    (.*) app/webroot/$1 [L]
   /IfModule

 Hmm, you should have 3 different htaccess files, but other than that,
 it appears to be a server issue, does the live server have mod_rewrite
 on?

 Cheers,

 Jon

 --

 jon bennett
 w:http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Question on MI-Base project

2009-03-11 Thread AD7six



On Mar 11, 10:28 am, marco.rizze...@gmail.com
marco.rizze...@gmail.com wrote:
 Hi
 I would useMI-Basefor my application.
 I have a question about it
 1)I have different databases (one for my application (for example a
 blog ) and one where there is saved the user's data (legacy
 application) ). How can I manage a situation like this?

Same way you'd manage it with any project  - create 2 datasources, and
set http://api.cakephp.org/search/useDbConfig in your models
appropriately.

hth,

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



Re: 'cake bake' having mysql connection problem with MAMP

2009-03-11 Thread bearlee

I found out the problem.

MAMP comes with its own PHP (reside in /Applications/MAMP/bin/...)
Mac OS X has its own PHP (reside in /usr/var/bin/..)

So, when I run the 'cake bake', it is using the Mac OS X default PHP
with its php.ini instead of the one that came with MAMP (this one is
all configured fine).
Hence, I had to add the path to MAMP's PHP...not sure if this would
affect me in the long run when I don't use MAMP and do need actually
default PHP on Mac OS X.



On Mar 11, 1:31 am, bearlee brianleeu...@gmail.com wrote:
 Hi all,

 On my Mac OS X, I've installed MAMP and followed the blog tutorial
 provided on CakePHP.
 Blog tutorial went fine without any errors (no configuration error).

 However, when I tried to follow the 'Simple Acl controlled
 Application' tutorial, I could not run 'cake bake'.
 Before I rant about my issue any further, let me show you the error
 message I get:

 Welcome to CakePHP v1.2.1.8004 Console
 ---
 App : app
 Path: /Applications/MAMP/htdocs/webroot/app
 ---
 Interactive Bake Shell
 ---
 [D]atabase Configuration
 [M]odel
 [V]iew
 [C]ontroller
 [P]roject
 [Q]uit
 What would you like to Bake? (D/M/V/C/P/Q) M

 ---
 Bake Model
 Path: /Applications/MAMP/htdocs/webroot/app/models/
 ---

 Warning: mysql_pconnect(): Can't connect to local MySQL server through
 socket '/var/mysql/mysql.sock' (2) in /Applications/MAMP/htdocs/
 webroot/cake/libs/model/datasources/dbo/dbo_mysql.php on line 372

 Warning: mysql_select_db(): supplied argument is not a valid MySQL-
 Link resource in /Applications/MAMP/htdocs/webroot/cake/libs/model/
 datasources/dbo/dbo_mysql.php on line 375

 Warning: mysql_get_server_info(): supplied argument is not a valid
 MySQL-Link resource in /Applications/MAMP/htdocs/webroot/cake/libs/
 model/datasources/dbo/dbo_mysql.php on line 383

 Warning: mysql_query(): supplied argument is not a valid MySQL-Link
 resource in /Applications/MAMP/htdocs/webroot/cake/libs/model/
 datasources/dbo/dbo_mysql.php on line 407
 Error: Your database does not have any tables.

 So basically, I believe that PHP is trying to connect with wrong mysql
 socket, because according to the phpinfo page and the MAMP start page
 indicate that the mysql socket is located /Applications/MAMP/tmp/mysql/
 mysql.sock

 I tried to change my config/database.php file around to use the socket
 path instead of 'localhost' for host and also tried putting in port
 (8889 as indicated on the start page of MAMP).

 Has anyone encountered the same problem and resolved it?
 I don't know why the blog tutorial did not give any problems like this
 (it still doesn't!), because the blog tutorial uses the database to
 CRUD blog posts.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Multiple language supports

2009-03-11 Thread Sensible

Hi,

I want to support multiple languages on my site.

I read through docs for that, but i  am confused how to do that.

First my requirements.

I have shopping cart application.

I want multiple language support for my site with following features.

1. I am uploading products and its related information.
2. I have categories with information.
3. And suppose articles.

I want to use 2 languages in my application. 1 English 2. Arabic.

And i want to manage all the things from database.
If any other option is available than i can accept that.

So what i have to do for that..?

I have to add each product, category and its related information 2
times...or manage it in other way...!

Or is their any facility in cakephp like, i enter only English
information and it is saved in both language.

Waiting for reply.
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: Multiple language supports

2009-03-11 Thread Martin Westin

 Or is their any facility in cakephp like, i enter only English
 information and it is saved in both language.

The developers working on the Cake core are smart, but don't hold your
breath :)

What you are aiming for is two different things.

1. Translations of your application's static texts. All the button-
labels, Flash-messages and things.

This is very simple. All the steps are explained in the manual and
countless blogs about l10n, i18n Most of the hard work consists of
creating the translation files and make them include valid plural
definitions. This can be found for most languages online (forgot
where) but leaving it as-is will work for straight singular
translations.

I think i use the absolutely least sofisticated way of switching
languages. I have an action that simply sets a cookie with the
language and redirects you back to the previous page. This cookie is
then read in bootstrap.php and the language set.


2. Translations of dynamic content. Blog-posts, CMS-pages, shop-
products... whatever your app contains. Cake has a behaviour to help
you out with this. It is called Translate and using it is also
described, step by step, in the manual. I haven't used this on any
project so I don't know if there are any common pit-falls. The docs
look straight forward though.
http://book.cakephp.org/view/92/Translate


 I have to add each product, category and its related information 2
 times...or manage it in other way...!

Using translate you don't have to create duplicate products, but you
do have to write and save two descriptions, names... This can be done
from a single form if you fiddle a little. Translate works by
magically replacing fields so you will still have only your normal
setup of Models and records.


You will need to specify what exactly part of these things is not
working for you to get better help. This is a big topic.



On Mar 11, 10:54 am, Sensible smi...@gmail.com wrote:
 Hi,

 I want to support multiple languages on my site.

 I read through docs for that, but i  am confused how to do that.

 First my requirements.

 I have shopping cart application.

 I want multiple language support for my site with following features.

 1. I am uploading products and its related information.
 2. I have categories with information.
 3. And suppose articles.

 I want to use 2 languages in my application. 1 English 2. Arabic.

 And i want to manage all the things from database.
 If any other option is available than i can accept that.

 So what i have to do for that..?

 I have to add each product, category and its related information 2
 times...or manage it in other way...!

 Or is their any facility in cakephp like, i enter only English
 information and it is saved in both language.

 Waiting for reply.
 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
-~--~~~~--~~--~--~---



Error with use Upload Behaviour of MI-BASE

2009-03-11 Thread marco.rizze...@gmail.com

Hi
I try to use the upload and image_upload behaviour of MI-BASE project
for add field photo to user model
My code is:
In model

var $actsAs= array(
'ImageUpload' = array(
'fileField' = 'photo',
'allowedMime' = array('image/jpeg', 'image/gif', 
'image/
png','image/bmp'),
'allowedExt' = array('jpeg', 'jpg', 'gif', 'png', 
'bmp'),
'baseDir' = '{APP}uploads',
'mustUploadFile' = false,
'overwriteExisting' = true,
'version' =array()
)
);

In controller:
 $this-data['User']['foreign_id']=$id;
$this-data['User']['dir']='users';
$this-data['User']['class']='users';
if ($this-User-save($this-data)) {
.
}

By I get these errors:

Notice (8): Undefined variable: field [APP\models\behaviors
\upload.php, line 524]
Notice (8): Undefined index:   [APP\models\behaviors\upload.php, line
524]
Warning (2):mkdir() [function.mkdir]: No such file or directory [CORE
\cake\libs\folder.php, line 465]


Is configuration wrong?





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Redirect after an edit operation in a paginated view

2009-03-11 Thread Danny Lieberman

Doesn't work - I have diagnosed the problem

There are two methods in the controller that perform an update - edit
and fu (followup)   the fu controller has its own fu.ctp view and edit
has edit.ctp BUT whenever the user submits the fu.ctp form - the
control is passed to the EDIT method not to the originally calling
method

This looks like a bug to me

Danny

On Mar 9, 4:09 pm, AD7six andydawso...@gmail.com wrote:
 On Mar 9, 11:26 am, Danny Lieberman onlyj...@gmail.com wrote:



  This would seem to be a trivial task.  I have a list of paginated
  rows.   I want to be able to click on an edit operation on a
  particular page  1 and return to the same page.  I save the referer
  on entry to the function and redirect to the saved referer after the
  database save operation - but the controller always returns to the
  controller index method no matter what the user chooses.

  I'm running in production mode - perhaps this is related to debug=0?

  Here is the code:
          function fu($id = null) {
                 $refer = Controller::referer();    // save the calling
  page
                  if (!$id  empty($this-data)) {
                          $this-Session-setFlash(__('Invalid Contact',
  true));
                          $this-redirect(array('action'='index'));
                  }
                  echo$refer;
                  if (!empty($this-data)) {
                          if ($this-Contact-save($this-data)) {
                                  $this-Session-setFlash(__('The
  Contact has been saved', true));
                  //              $this-redirect(array
  ('action'='index'));
                                  $this-redirect($refer); // redirect
  back to the calling page after save
                          } else {
                                  $this-Session-setFlash(__('The
  Contact could not be saved. Please, try again.', true));
                          }
                  }
                  if (empty($this-data)) {
                          $this-data = $this-Contact-read(null, $id);
                  }
                  $this-set('contact', $this-Contact-read(null,
  $id));

  Looks like something really stupid is breaking this but I cant figure
  out what

  Danny

 Try this logic:

 In the controller:

 if (!$this-data) {
  $this-set('referer', $this-referer($default));} else {

   if ($this-Model-save()) {
   $this-redirect ($this-data['_App']['referer']);

 }
 }

 in the view:
 ...
 echo $form-input('_App.referer', array('value' = $referer, 'type' =
 'hidden'));
 ...

 Personally, I always add a referer to all forms to use for exactly the
 purpose you highlight.

 hth,

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



Re: Redirect after an edit operation in a paginated view

2009-03-11 Thread Danny Lieberman

This doesn't work
I have an edit method and a fu method - both do database saves.  BUT
the cake automagic stuff always sends the user back to the edit method
after fu save operation - this looks like a bug

Danny

On Mar 9, 2:52 pm, grigri j...@hendersonwebdesign.com wrote:
 I did just this a while ago; it worked fine for my purposes:

 $this-redirect($this-referer());

 However, there was a problem. If, after editing an item, it appears in
 a different page, then it just won't work.

 Example: your index is listed alphabetically. You're on page 3, and
 click edit on the entry Curried Animals: Aardvark to Zebra. You edit
 this to Aardvark to Zebra: A guide to wild curries. It returns you
 to page #3 but your entry is now on page #1. Is this the expected
 result?

 It might be in some cases, and not in others. One of my clients
 remarked that it _wasn't_ what they wanted, because it made what they
 were doing slower.

 I have taken to having a dropdown, similar to the one PhpMyAdmin
 offers, where the user can select the next action. Back to index,
 Find this item, View this item, Edit again, Add new, ... not
 all items on each edit, of course, only the relevant ones. The
 redirect functionality is in a component (which also generates
 appropriate data to set in the select options).

 hth
 grigri

 On Mar 9, 10:26 am, Danny Lieberman onlyj...@gmail.com wrote:

  This would seem to be a trivial task.  I have a list of paginated
  rows.   I want to be able to click on an edit operation on a
  particular page  1 and return to the same page.  I save the referer
  on entry to the function and redirect to the saved referer after the
  database save operation - but the controller always returns to the
  controller index method no matter what the user chooses.

  I'm running in production mode - perhaps this is related to debug=0?

  Here is the code:
          function fu($id = null) {
                  $refer = Controller::referer();    // save the calling
  page
                  if (!$id  empty($this-data)) {
                          $this-Session-setFlash(__('Invalid Contact',
  true));
                          $this-redirect(array('action'='index'));
                  }
                  echo $refer;
                  if (!empty($this-data)) {
                          if ($this-Contact-save($this-data)) {
                                  $this-Session-setFlash(__('The
  Contact has been saved', true));
                  //              $this-redirect(array
  ('action'='index'));
                                  $this-redirect($refer); // redirect
  back to the calling page after save
                          } else {
                                  $this-Session-setFlash(__('The
  Contact could not be saved. Please, try again.', true));
                          }
                  }
                  if (empty($this-data)) {
                          $this-data = $this-Contact-read(null, $id);
                  }
                  $this-set('contact', $this-Contact-read(null,
  $id));

  Looks like something really stupid is breaking this but I cant figure
  out what

  Danny
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread Xoubaman

Just model it like a normal HABTM relationship, no special syntaxis,
and add the field in the database.

When saving, try this:

http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/

I haven't done it before, so i can't secure his fiability, but looks
good.

On Mar 11, 10:38 am, mattalexx mattal...@gmail.com wrote:
 What's the syntax for adding an extra field to the
 $hasAndBelongsToMany var?

 Thank you for you response.

 On Mar 11, 2:43 am, Xoubaman xouba...@gmail.com wrote:

  You can model it like a normal HABTM relationship with an extra field
  named main_photo.

  On Mar 11, 8:30 am, mattalexx mattal...@gmail.com wrote:

   My articles have and belong to many photos. This is so when the photo
   is seen somewhere else on the site, I can have a see related
   articles. Each article also has one main photo. I can't seem to
   figure out the syntax for this in APP/models/article.php file and in
   APP/models/photo.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: Redirect after an edit operation in a paginated view

2009-03-11 Thread AD7six



On Mar 11, 11:52 am, Danny Lieberman onlyj...@gmail.com wrote:
 This doesn't work
 I have an edit method and a fu method - both do database saves.  BUT
 the cake automagic stuff always sends the user back to the edit method
 after fu save operation - this looks like a bug

Assumptions + monologues are ace, you might want to discuss things on
#cakephp rather than use the group for brain dumps ;).

The default form action (which obviously, you can change - check the
book) has always been add/edit depending on whether you have no model
data loaded or not. Which given your description means your controller/
fu form is posting to controller/edit.

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



Suspected bug in controller method routing

2009-03-11 Thread Danny Lieberman

I have a controller with  the usual CRUD functions and I added an
additional function called fu (followup)

The fu function has it's own fu.ctp view and after the user enters
data in the form, it saves the data to the database using a save
method

The only problem is that cake always returns control after the form
submit to the edit function, not the fu function.  This is bolloxing
up the application to say the least.

I guess that this is some kind of automagic stuff  but I have not been
able to figure out how to ensure that control after save will not be
automagically passed to an edit function

Be happy to get an explanation how to fix this issue

Danny
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Suspected bug in controller method routing

2009-03-11 Thread majna

yes, set controller and action params in form helper.

On Mar 11, 12:05 pm, Danny Lieberman onlyj...@gmail.com wrote:
 I have a controller with  the usual CRUD functions and I added an
 additional function called fu (followup)

 The fu function has it's own fu.ctp view and after the user enters
 data in the form, it saves the data to the database using a save
 method

 The only problem is that cake always returns control after the form
 submit to the edit function, not the fu function.  This is bolloxing
 up the application to say the least.

 I guess that this is some kind of automagic stuff  but I have not been
 able to figure out how to ensure that control after save will not be
 automagically passed to an edit function

 Be happy to get an explanation how to fix this issue

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



Re: How to create models for complex database designs like this?

2009-03-11 Thread villas

 But celebrity_id is showing id instead of name how
 can i get celebrity name instead of id.

Only fields named 'title' or 'name' are displayed automatically in
lists etc.
I appreciate that this answer doesn't directly solve your problem with
the 'celebrities' table,  but it may be helpful with your 'movies'
table.

http://book.cakephp.org/view/438/displayField


On Mar 8, 12:40 pm, Rajesh rajesh.mukk...@gmail.com wrote:
 I am working on movie site. Client have movie records in following
 structure.

 CREATE TABLE IF NOT EXISTS `movies` (
   `id` int(50) NOT NULL AUTO_INCREMENT,
   `movieName` varchar(500) NOT NULL,
   `year` int(11) DEFAULT NULL,
   PRIMARY KEY (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8  ;
 -- 
 CREATE TABLE IF NOT EXISTS `celebrities` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `name` varchar(250) NOT NULL,
   PRIMARY KEY (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8  ;
 -- 
 CREATE TABLE IF NOT EXISTS `casts` (
   `movie_id` int(50) NOT NULL,
   `role` varchar(200) DEFAULT NULL,
   `celebrity_id` int(11) NOT NULL DEFAULT '0',
   KEY `movieid` (`movie_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

 As you can see movies has casts, casts table contains movie_id and
 celebrity_id. celebrities master table is for storing all master
 celebrity names.

 Now my problem is i have created models for movie and celebrity like
 movie hasmany cast. In movie page aim getting movie details along
 related casts. But celebrity_is is showing id instead of name how
 can i get celebrity name instead of id. 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
-~--~~~~--~~--~--~---



Multiple upload field in a model with AD7six Upload Behaviour

2009-03-11 Thread marco.rizze...@gmail.com

My question is:
If in a model I have many image fields and many upload field how can I
set the model to permit the use of  AD7six Upload Behaviour  with all
these fields?
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: Model without table

2009-03-11 Thread villas

Check out Jonathan Snook's article:
http://snook.ca/archives/cakephp/contact_form_cakephp/

On Mar 10, 8:10 am, kaushik kaushikwo...@gmail.com wrote:
 I am going to develop a section in a site, where there is no database
 operation. Only there will a form and a mail will fire on submit of
 the very form. How to design model for this section?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Suspected bug in controller method routing

2009-03-11 Thread Danny Lieberman

Doh.

Not exactly a bug but not exactly intuitive behavior either.

I think that the correct behavior in the MVC model is for a controller
function X to map to view X - both in invocation and on return.

I would not have assumed that the view needs to explicitly specify
return of control to the  controller function that invoked the view in
the first place.

That behavior is a bit inconsistent I think.

But - now I know

Danny



On Mar 11, 1:40 pm, majna majna...@gmail.com wrote:
 yes, set controller and action params in form helper.

 On Mar 11, 12:05 pm, Danny Lieberman onlyj...@gmail.com wrote:

  I have a controller with  the usual CRUD functions and I added an
  additional function called fu (followup)

  The fu function has it's own fu.ctp view and after the user enters
  data in the form, it saves the data to the database using a save
  method

  The only problem is that cake always returns control after the form
  submit to the edit function, not the fu function.  This is bolloxing
  up the application to say the least.

  I guess that this is some kind of automagic stuff  but I have not been
  able to figure out how to ensure that control after save will not be
  automagically passed to an edit function

  Be happy to get an explanation how to fix this issue

  Danny
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread ohcibi

if you have two different types of photos for your news, which should
use the same photo-model you can define other model-aliases. like
this:

app/models/article.php:
var $hasAndBelongsToMany = array(
'Photo' = array(
'className' = 'Photo', // should be the name of the Photo-
Model
// rest of habtm defintion of the normal photos
)
);
var $belongsTo = array(
'MainPhoto' = array(
'className' = 'Photo', // should be the name of the Photo-
model
)
);

app/models/photo.php
var $hasAndBelongsToMany = array(
'Article'= array(
'className' = 'Article'
)
);
var $hasMany = array(
'Article' = array(
'className' = 'Article'
)
);

providing a main_photo_id field in your articles-table you can now do
normal find()'s and cake will fetch all the 'Photos' which are related
via habtm and the one 'MainPhoto' as they were two different models...
no need for an extra field in the join-table.

you could also define the relation like Article hasOne MainPhoto and
Photo belongsTo Article (and then you have to provide an article_id
field in your photos-table), but then you cant use the same MainPhoto
for different articles its up to you how to do it, but basically,
if you want to use the same model for different relations, you can use
different alias-names for this model

On Mar 11, 11:52 am, Xoubaman xouba...@gmail.com wrote:
 Just model it like a normal HABTM relationship, no special syntaxis,
 and add the field in the database.

 When saving, try this:

 http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-jo...

 I haven't done it before, so i can't secure his fiability, but looks
 good.

 On Mar 11, 10:38 am, mattalexx mattal...@gmail.com wrote:



  What's the syntax for adding an extra field to the
  $hasAndBelongsToMany var?

  Thank you for you response.

  On Mar 11, 2:43 am, Xoubaman xouba...@gmail.com wrote:

   You can model it like a normal HABTM relationship with an extra field
   named main_photo.

   On Mar 11, 8:30 am, mattalexx mattal...@gmail.com wrote:

My articles have and belong to many photos. This is so when the photo
is seen somewhere else on the site, I can have a see related
articles. Each article also has one main photo. I can't seem to
figure out the syntax for this in APP/models/article.php file and in
APP/models/photo.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: Can't use the formHelper with in cake:nocache

2009-03-11 Thread 丁宇(Felix Ding)

Same here, any solutions?
BTW, HtmlHelper works between cake:nocache and /cake:nocache, it
seems that only FormHelper doesn't work.

On Jan 21, 10:46 am, maeto-lay maeto...@gmail.com wrote:
 I try to change all of my pages to use the view caching feature of
 cakephp.
 The problem occurred when I try to useing the cache in the page that
 have
 formHelper.

 This is my code.

 cake:nocache
 ?php
 echo $form-create('User');
 echo $form-input('User.username');
 echo $form-end('submit');
 ?
 /cake:nocache

 And when I refresh the page to see if cache working I found this
 error.

 Notice (8): Undefined property:  stdClass::$model
 [CORE\cake\libs\view\helper.php, line 328]
 Notice (8): Undefined property:  stdClass::$association
 [CORE\cake\libs\view\helper.php, line 361]
 Notice (8): Undefined property:  stdClass::$field
 [CORE\cake\libs\view\helper.php, line 361]

 Fatal error: Call to a member function entity() on a non-object in
 C:\xampplite\htdocscontainer\htdocs\cake\libs\view\helper.php on line
 316

 I don't want to hand code all the form in my web so if anyone can help
 me
 please light me up.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: the blog post problem

2009-03-11 Thread Jon Bennett

Hi bilal,

 You are right, all three files are different, the server had
 mod_rewrite off, i turned it on and tried again but it didnt help. :(

 what else could we look at ...

hmm - is the html helper outputting links with index.php in them, or
are you doing this manually? Does the site work if you manually try
urls without index.php in them? what about when you bypass rewrite
altogether, eg:

http://domain.com/index.php?url=/posts/index

cheers,

Jon


-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



String 'NULL' inserted instead of value NULL with ACL, MSSQL. Help?

2009-03-11 Thread George

I've been grinding away with ACL on a project, and I'm running into
what appears to be a bug with the ACL code and dbo_mssql.php.
Basically inserting new aco records fail due to cake generating
incorrect SQL code (it puts single quotes around a NULL, thus
inserting the string NULL, not NULL itself). I found this ticket
(https://trac.cakephp.org/ticket/6024) in the trac which is basically
exactly what's happening to me as well. It appears this hasn't been
fixed in the latest nightly though, and I was wondering if anyone had
an idea on how to apply a fix until the bug has been resolved. I also
found an older reported bug that appears to be the same thing (https://
trac.cakephp.org/ticket/5381).

I've been digging in libs/model/datasources/dbo/dbo_mssql.php, and
libs/model/db_acl.php, but haven't been able to see where the quotes
are being applied to the NULL value. My guess is there just needs to
be an extra conditional to check for a null value and not apply quotes
in that case. If anyone knows where this can be resolved, that would
be awesome.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Paginator localhost vs. remote server URL generates differently.

2009-03-11 Thread bee


THAT WORKED
Thank you very much.
(it does still work odd in localhost, where it keeps adding /1/1/ )
but at least it works on the actual server.
Have a good day.

On Mar 11, 12:36 am, Martin Westin martin.westin...@gmail.com wrote:
 I'd say that your server is doing things correctly and your local
 setup is acting strange. To get any arguments to persist when
 paginator creates it's links you need to do this in your view:

 $paginator-options(array('url' = $this-passedArgs));

 Since you mention nothing about it my guess is that you don't have it
 and that for some unknown reason your local setup keeps it around
 anyway.

 /Martin

 On Mar 11, 4:22 am, bee byrne.chri...@gmail.com wrote:



  This is very odd, when i upload my code from my local machine to my
  server, and test out the Paginator on the remote server, the URL is
  incorrectly rendered for the paginator, page 2 on the remote server.

  Onlocalhost, the url for page 2 of my query works properly and
  displays this:http://localhost/.../.../findChildren/1/page:2

  However, when I upload to the server, the /1/ does NOT appear page 2
  link.
  Instead,http://www.mywebsite.com/.../findChildren/page:2

  The code I use for paginator VIEW is below: (it is EXACTLY THE SAME
  for both thelocalhostand the server)

  echo $paginator-numbers();

  The code in the controller is as follows:
  var $paginate = array(
          'limit' = 4 ,
          'order' = array(
              'Event.name' = 'asc'
              )
              );

              function findChildren($id=null)
              {

                  $events = $this-paginate('Event', array('category_id' =
  $id) );
                  $this-set('events',$events);

              }

  So, it is strange, because i NEVER wrote the code for the path of URL,
  so this must be a setting somewhere in the config?
  I am a newbie, so please excuse me for my confusion and ignorance.
  I appreciate your help in advance.
  Thanks
  Christy- Hide quoted text -

 - Show quoted text -

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



Model1 hasMany Model2 with count(), how to get SQL like this?

2009-03-11 Thread Svel

Searching for 2 days and found nothing =(

How i can build this SQL code:
SELECT `m1`.`id`, COUNT(`m2`.`id`) as cnt
FROM `m1` LEFT JOIN `m2` ON (`m1`.`id` = `m2`.`m1_id`) WHERE 1=1
GROUP BY `m2`.`m1_id`
ORDER BY `m1`.`id`

is it real without custom Model-query() ?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Suspected bug in controller method routing

2009-03-11 Thread Martin Westin


I don't understand the problem at all.

If you have done no redirects you would get:

The action fu renders the view fu.
The view fu contains a form pointing to the action save.
The action save processes the form and renders the view save.

To have the action save returning control to edit of fu you would
have to have a redirect somewhere. (either explicitly or via $this-
flash() )

Whenever I have an action like save (that does only the saving or
processing of other actions) I often just have:
public function save() {
$ret = $this-Message-save($this-data);
if ( $ret ) {
$this-Session-setFlash( ___('message_save_ok'), 'default',
array(), 'ok');
$this-redirect($this-referer());
} else {
$this-Session-setFlash( ___('message_save_err'), 'default',
array(), 'error');
$this-redirect('.');
}
}

If I was into flash instead of setFlash the logic would be a little
different.

Ignoring the message-flashing, what happens is: if save fails, go to
the index. If successful go back to where you were. When the action is
the primary save-function I will also check if this is a new save or
an update and add suitable logic to handle that. Sometimes you want to
go back to add to create the next item. Sometimes you want to go to
edit and continue editing this item. It depends on the type of data
being saved.


My point is just that for you to end up back at edit you have to have
a redirect in there somewhere. So it is not a bug in Cake by any
standard... possibly a limitation of some auto-magic that tries to
figure out where you want to be redirected to.

/Martin


On Mar 11, 1:07 pm, Danny Lieberman onlyj...@gmail.com wrote:
 Doh.

 Not exactly a bug but not exactly intuitive behavior either.

 I think that the correct behavior in the MVC model is for a controller
 function X to map to view X - both in invocation and on return.

 I would not have assumed that the view needs to explicitly specify
 return of control to the  controller function that invoked the view in
 the first place.

 That behavior is a bit inconsistent I think.

 But - now I know

 Danny

 On Mar 11, 1:40 pm, majna majna...@gmail.com wrote:



  yes, set controller and action params in form helper.

  On Mar 11, 12:05 pm, Danny Lieberman onlyj...@gmail.com wrote:

   I have a controller with  the usual CRUD functions and I added an
   additional function called fu (followup)

   The fu function has it's own fu.ctp view and after the user enters
   data in the form, it saves the data to the database using a save
   method

   The only problem is that cake always returns control after the form
   submit to the edit function, not the fu function.  This is bolloxing
   up the application to say the least.

   I guess that this is some kind of automagic stuff  but I have not been
   able to figure out how to ensure that control after save will not be
   automagically passed to an edit function

   Be happy to get an explanation how to fix this issue

   Danny
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Model1 hasMany Model2 with count(), how to get SQL like this?

2009-03-11 Thread Martin Westin

You probably want a little, slightly obscure, gem called joins.

In use it looks something like:
$this-find('all', array(
'conditions' = $conditions,
'joins' = array(
array(
'table' = 'model2',
'alias' = 'Model2',
'type' = 'inner',
'foreignKey' = model1_id,
'conditions'= array(
'Model2.another_fk = Model1.id'
)
)
)
));

Check out Nate's nice article on the subject: (he talks about habtm
but it is just as useful for hasMany)
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find


/Martin

On Mar 11, 2:39 pm, Svel svel.so...@gmail.com wrote:
 Searching for 2 days and found nothing =(

 How i can build this SQL code:
 SELECT `m1`.`id`, COUNT(`m2`.`id`) as cnt
 FROM `m1` LEFT JOIN `m2` ON (`m1`.`id` = `m2`.`m1_id`) WHERE 1=1
 GROUP BY `m2`.`m1_id`
 ORDER BY `m1`.`id`

 is it real without custom Model-query() ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Error with use Upload Behaviour of MI-BASE

2009-03-11 Thread AD7six



On Mar 11, 11:43 am, marco.rizze...@gmail.com
marco.rizze...@gmail.com wrote:
 Hi
 I try to use the upload and image_upload behaviour of MI-BASE project
 for add field photo to user model
 My code is:

I've been updating the behaviors recently, that looks like an
incorrect variable name (should be $fieldName).

You'd be better off finding me on irc to discuss problems with code
I've written (that isn't in the core) or for simple (or general)
errors such as this - investigating/fixing/asking first.

Cheers,

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



Re: Multiple upload field in a model with AD7six Upload Behaviour

2009-03-11 Thread AD7six



On Mar 11, 12:59 pm, marco.rizze...@gmail.com
marco.rizze...@gmail.com wrote:
 My question is:
 If in a model I have many image fields and many upload field how can I
 set the model to permit the use of  AD7six Upload Behaviour  with all
 these fields?
 Many Thanks

Hi Marco,

The overall upload logic I use expects 1 upload per model (most of the
time I use an exclusive media model for uploaded data). You could at a
stretch use various different uploads (1 image, 1 pdf, 1 archive) on
the same model but that's twisting the upload behavior(s) away from
what they were designed to do.

If you want to try and implement that - feel free.

Cheers,

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



Best Way to Nest Lists w/ nestedList()

2009-03-11 Thread Tony Thomas

I'm trying to create navigation in CakePHP that uses this method with
CSS drop-downs:

http://www.webmonkey.com/tutorial/Add_CSS_Drop-Down_Menus

So, of course I want to leverage nestedList(), but since I have two
levels of nested lists, I'm getting unexpected results.

Here's what I want:

Main List Item 1
Secondary List Item 1
Secondary List Item 2
Tertiary List Item 1
Main List Item 2

Here's what I have set up at the moment:

$nav = $html-nestedList(
array(
$html-link('Main List Item 1', '#') = array(
$html-link('Secondary List Item 1', '/url/'),
array($html-link('Secondary List Item 2', '/url/') =
array($html-link('Tertiary List Item 1', '/
url'))),
$html-link('Secondary List Item 2', '/url/'),
$html-link('Secondary List Item 3', '/visits/'),
),
$html-link('Main List Item 2', '#'),
$html-link('Main List Item 3', '#'))
This gets me close, but the result is this:

Main List Item 1
Secondary List Item 1
1
Secondary List Item 2 (winds up in the tertiary list)
Tertiary List Item 1
Secondary List Item 2
Secondary List Item 3
Main List Item 2
Main List Item 3

How can I set this up using nestedList so that the list is formatted
without the 1 above and with the secondary list item 2 in the proper
place? Or am I approaching this from the wrong angle altogether?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: String 'NULL' inserted instead of value NULL with ACL, MSSQL. Help?

2009-03-11 Thread George

I found what so far seems like a temporary fix for this issue. It's
probably not ideal, but the only drawback I think would be if you
wanted to actually insert the string 'NULL', you can't after this fix.

On line 278 in cake/libs/model/datasources/dbo/dbo_mssql.php, change:

if (in_array($column, array('integer', 'float', 'binary')) 
is_numeric($data)) {

to

if ((in_array($column, array('integer', 'float', 'binary')) 
is_numeric($data)) || $data == 'NULL') {

Now, if $data is NULL, it will get caught in this conditional and
return without enclosing single quotes. I suppose you could change the
last part to strtolower($data) == 'null' to catch any form of NULL
instead.



On Mar 11, 9:04 am, George geo...@hakumei.net wrote:
 I've been grinding away with ACL on a project, and I'm running into
 what appears to be a bug with the ACL code and dbo_mssql.php.
 Basically inserting new aco records fail due to cake generating
 incorrect SQL code (it puts single quotes around a NULL, thus
 inserting the string NULL, not NULL itself). I found this ticket
 (https://trac.cakephp.org/ticket/6024) in the trac which is basically
 exactly what's happening to me as well. It appears this hasn't been
 fixed in the latest nightly though, and I was wondering if anyone had
 an idea on how to apply a fix until the bug has been resolved. I also
 found an older reported bug that appears to be the same thing (https://
 trac.cakephp.org/ticket/5381).

 I've been digging in libs/model/datasources/dbo/dbo_mssql.php, and
 libs/model/db_acl.php, but haven't been able to see where the quotes
 are being applied to the NULL value. My guess is there just needs to
 be an extra conditional to check for a null value and not apply quotes
 in that case. If anyone knows where this can be resolved, that would
 be awesome.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CakePHP in Google Summer of Code

2009-03-11 Thread Diego Caro A.

Hello everyone,
   today I went to a talk by Google Summer of Code[1], a
google program for open source projects. This program offers student
developers stipends to write code.

Well, I want CakePHP in Google SoC. For this, we need a send a
proposal with ideas to Google with a mentor (dedicated to the new
developer guide), more info at [2].

My first idea for develop in this program are:
 - Mechanism to search into different models (like
searchable-behaviour-for-cakephp [3]) for mysql and postgresql.

Now, we need ideas, get a mentor and submit CakePHP into Google SoC

Bye, and discuss this!.


[1]: http://code.google.com/soc/
[2]: http://socghop.appspot.com/
[3]: http://code.google.com/p/searchable-behaviour-for-cakephp/
-- 
Diego Caro A.
Estudiante Ing. Civil Informática

diegocaro | http://diego.bloog.cl

No tengo talentos especiales, pero sí soy
 profundamente curioso, Albert Einstein.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Validate rule: multiple (CookBook - 4.1.4.17 Multiple)

2009-03-11 Thread WebbedIT

You will need to apply the validation rules in the Category and Scene
models or in the beforeFilter of the model in which you are running
the add/edit actions you can add

$this-ModelName-Category-validate = array(
  'Category' = array(
'rule' = array('multiple', array('min'=1)),
'message' = 'Select one or more categories'
  )
);
$this-ModelName-Scene-validate = array(
  'Scene' = array(
'rule' = array('multiple', array('min'=1)),
'message' = 'Select one or more scenes'
  )
);

You will probably find that the rules are still ignored and I think
this is down to saveAll not validating HABTM data before saving it.
To get around this I edited the core /cake/libs/model/model.php
(details earlier in the thread), but I am far from an expert, so not
sure if this is the right thing to do or the right way to go about
it.

As yet no-one who knows better has taken part in the conversation to
confirm if my suspicion about saveAll is right?!?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 value in forms from datatable

2009-03-11 Thread Paco Gomez

Hi,

I'm newbie in cakephp, I have the typical form for Users with their
profile information:
Username
SureName
Email
...

I don't know if it's possible to fill inputs fields of form in the
view automaticly from the dataTable Users

Thank you very much in advantage.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 value in forms from datatable

2009-03-11 Thread brian

On Wed, Mar 11, 2009 at 11:55 AM, Paco Gomez paco.gomez.ar...@gmail.com wrote:

 Hi,

 I'm newbie in cakephp, I have the typical form for Users with their
 profile information:
 Username
 SureName
 Email
 ...

 I don't know if it's possible to fill inputs fields of form in the
 view automaticly from the dataTable Users

You haven't said what you've tried already. When you do a find()
read() into $this-data the FormHelper will use that to fill in the
fields.

echo $form-input('User.email', array(other options here));

FormHelper will look for the value in $this-data['User']['email']. If
you're not sure that your find() is getting the correct data you can
put this somewhere in your form view:

debug($this-data);

Note that your fieldnames should be lowercase (and I think you meant
surname, not surename, btw).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 value in forms from datatable

2009-03-11 Thread Diego Caro A.

On Wed, Mar 11, 2009 at 12:55 PM, Paco Gomez paco.gomez.ar...@gmail.com wrote:
 ...

 I don't know if it's possible to fill inputs fields of form in the
 view automaticly from the dataTable Users

Yes, is possible, editing $this-data variable in the controller of the view.

For example, you want fill the input User.username in view, then you
will set the default data like:

$this-data = array('User' = array('username' = 'defaultusername'));


Check this code:


function edit($id = null) {
if (!empty($this-data)) {
if ($this-User-save($this-data)) {
//saved
}
}
if (empty($this-data)) {
//fill user data
$this-data = $this-User-read(null, $id);
}
}



-- 
Diego Caro A.
Estudiante Ing. Civil Informática

diegocaro | http://diego.bloog.cl

No tengo talentos especiales, pero sí soy
 profundamente curioso, Albert Einstein.

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



Re: CakePHP in Google Summer of Code

2009-03-11 Thread BeroFX

Why not a project that integrates a bunch of services into a single
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
-~--~~~~--~~--~--~---



Re: MooTools Ajax with Cake

2009-03-11 Thread mark_story

No worries,  glad to hear you got it all sorted.  MooTools can have a
pretty steep learning curve, as it doesn't have as many one liners as
other libraries, but if you stick with it, there is a lot of power and
features under the hood.  As for neat shortcuts, look at
Element.implement() you can add on additional element shortcuts that
trigger effects.  The Chain class is also a really powerful and
interesting class.

-Mark

On Mar 10, 10:06 pm, Arak Tai'Roth nielsen.dus...@gmail.com wrote:
 Also not to be an ass. But I have effects working, you are right there
 is tons of documentation. I was just checking if anyone had any cool
 ideas I hadn't thought of.

 I also did get it working just fine with multiple elements of the same
 name.

 Copy and pasting can lead to a lot of issues with no understanding I
 agree. However it gets you something to work on right away and gives
 you a more practical way to learn, and for me, that's far more useful.

 On Mar 10, 10:56 am, mark_story mark.st...@gmail.com wrote:

  Not to be an ass, but mootools has tons of documentation, examples and
  tutorials.  You can find lots of information on how you use effects in
  the mootools docss.  Furthermore if you have more than one element
  with the same ID don't expect anything to work properly.  In addition
  Element.load() does do an AJAX request.  Just as a GET instead of a
  POST type request.  But if you are new to Ajax and Mootools, I would
  start with the docs, copy+pasting is going to lead to lots of these
  type issues.

  -Mark

  On Mar 9, 4:39 pm, Arak Tai'Roth nielsen.dus...@gmail.com wrote:

   Well it looks like I got it all working. Now I just need to figure out
   how to add some kind of effect to it. If anyone has any advice on
   that, that would be perfect.

   On Mar 9, 11:43 am, Arak Tai'Roth nielsen.dus...@gmail.com wrote:

So I completely revamped the code in my ajax file to this:

window.addEvent('domready', function()
{
        $('ajax_replace').addEvent('click', function(event)
        {
                event.stop();

                var req = new Request(
                {
                        method: 'get',
                        url: $('ajax_replace').get('href'),
                        data: { 'do' : '1' },
                        onComplete: function(response)
                        {
                                
$('about_descriptioncontent').set('html', response);
                        }
                }).send();
        });

});

It now kinda works. I had an onRequest portion in there and that was
triggering, and the content was changing, it was incredibly messed up
(ie. wasn't outputting what I was expecting it to). However this only
works for the first of my links, the other ones don't do anything at
all.

On Mar 9, 11:25 am, Arak Tai'Roth nielsen.dus...@gmail.com wrote:

 I don't want to do a simple GET request, I do want this as AJAX,
 that's just the code I found. I am extremely new to MooTools, never
 used it before this, in addition I am new to using AJAX period.

 One thing I just realized and am slightly confused about. With the
 code $('ajax_replace) I am under the understanding that I am
 referencing the element id = ajax_replace. However I have multiples of
 those on this page, 4 right now, likely more later once I have this
 working. How does it know which one to add the event too (I want it
 added to all of them) and how does it know which one to get the URL
 from?

 I am assuming it doesn't know, and might be the reason why things
 aren't working.

 On Mar 9, 11:06 am, mark_story mark.st...@gmail.com wrote:

  Well I would start with seeing if the Selector is working? does the
  click event even fire? I use mootools quite often, and there is
  nothing in cake that prevents you from doing so. Why aren't you just
  using Element.load() instead?  If you only want to do a simple GET
  request, I would just do

  window.addEvent('domready', function() {
    $('ajax_replace').addEvent('click', function(event) {
      event.stop();
      $('about_descriptioncontent').load(this.get('href'));
    }

  });

  Or you can keep your existing code, but you may want to prevent the
  default browser action anyways.  As you won't see the ajax result, 
  as
  the default action will still happen.

  -Mark

  On Mar 9, 12:03 pm, Arak Tai'Roth nielsen.dus...@gmail.com 
  wrote:

   Also considering I am using multiple links I tried this as well:

   url: $$('a.ajax_replace').get('href'),

   and

   $$('a.ajax_replace').addEvent('click', function()

   and then changing the id's to classes. I was thinking this might 
   work,
   but alas, it did not either.

   On Mar 9, 9:19 am, Arak Tai'Roth nielsen.dus...@gmail.com 
   wrote:

Re: CakePHP in Google Summer of Code

2009-03-11 Thread Diego Caro A.

On Wed, Mar 11, 2009 at 2:17 PM, BeroFX ber...@gmail.com wrote:

 Why not a project that integrates a bunch of services into a single
 one? :)

For example..??



-- 
Diego Caro A.
Estudiante Ing. Civil Informática

diegocaro | http://diego.bloog.cl

No tengo talentos especiales, pero sí soy
 profundamente curioso, Albert Einstein.

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



dompdf problem

2009-03-11 Thread Diego Villar
Hi guys,
I am using dompdf for export to pdf files, in my Pc (windows) function ok,
but on the server (linux) I have this error:

bStrict Standards/b: Non-static method App::import() should not be
called statically, assuming $this from incompatible context

and more similar errors

I change my php.ini for not display errors but then this error is
displayed:
Unable to load PDF, headers already sent


Can someone help me?

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



recursive in parents

2009-03-11 Thread fain182

my situation is this:
A has many B
B has many C

in the view of C i see only the data of B  and C, i want to see the
data of A too..
i tried to set the recursive to 2 or 3 but it makes something like:
array A
array B that has A
   array A that belongs to B


did you have any suggestion?
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
-~--~~~~--~~--~--~---



Re: Model without table

2009-03-11 Thread mscdex

On Mar 10, 7:32 am, Walther waltherl...@gmail.com wrote:
 Just add in your model:

 var $table = false;


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



Automagic date field without the day

2009-03-11 Thread FranktheTank

I'm looking to create an automagic date field, but I only want to show
the month and year selects.  The user doesn't need to see or pick a
day.  I have used the date and year type inputs for other things, but
they are kind of inconvenient and it would be nice to treat the date
info like all the rest of the form's data. Any thoughts?

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



find() question

2009-03-11 Thread Dave Maharaj :: WidePixels.com
Not sure what I am doing here. Been trying to no avail.
 
What I am trying to do is find the id of the logged in user from TEACHERS
table WHERE the user_id is $this-Auth-user('id');
 
$conditions = array('Teachers.user_id'=$userId);
$fields = 'Teachers.user_id';
 
$teacherID = $this-User-Teacher-find('list', compact('conditions',
'fields'));
 
Ideas on what I am doing wrong?
 
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
-~--~~~~--~~--~--~---



Unlimited Slugs for an Action

2009-03-11 Thread jabocs

Looking for a way to have a unlimited number of slugs for sub-
sections.

For Example:

http://www.mysite.com/about/page1

http://www.mysite.com/about/sub1/page1

http://www.mysite.com/about/sub1/sub2/page1

http://www.mysite.com/about/sub1/sub2/sub3/page1


Would this be in the Routing or Bootstrap?

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



Form helper bug?

2009-03-11 Thread TeckniX

Setup:
Say your cake app isn't the root of your HTML folder -
So instead of being at the root of your document_root (/home/html/)
it's actually located in (/home/html/cake/)
you have normal files in the html folder, and a mod_rewrite rule so
that when you go to domain.com/bake it loads cake
your url path is: domain.com/bake
your doc_root is: /home/html/
your app_root is: /home/html/cake/app/
etc...

Question:
How do you you use the form helper and try to send a user to
http://domain.com/bake/add via the form action?

What I tried:
 'url' = '/bake/add' in the form helper actually writes this in the
form action: action=/cake/bake/add
 'url' = 'bake/add' in the form helper aalso writes this in the form
action: action=/cake/bake/add


Shouldn't the helper be modified so that if /bake/add is requested
then the action should be action=/bake/add but if 'bake/add' is
requested then the action can be relative to the cake structure, which
here would be: action=cake/bake/add' ?


While talking on IRC I realize that there are other solutions to this,
such as moving the files around or renaming the cake folder - but I
would like to find a correct solution so that I can redirect a form
action where I want, without having to use a 'http' format.

the typical folder structure:
http://bin.cakephp.org/view/198561794

Any help/suggestions on how to do this without writing out the entire
http:// url would be appreciated!

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



Re: find() question

2009-03-11 Thread TeckniX

Fields should be an array I believe. So your entire query should be:

$this-User-find('list', array('conditions' =array
('Teachers.user_id' = $this-Auth-user('id')), 'fields'=array
('Teachers.user_id')

On Mar 11, 2:36 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 Not sure what I am doing here. Been trying to no avail.

 What I am trying to do is find the id of the logged in user from TEACHERS
 table WHERE the user_id is $this-Auth-user('id');

 $conditions = array('Teachers.user_id'=$userId);
 $fields = 'Teachers.user_id';

 $teacherID = $this-User-Teacher-find('list', compact('conditions',
 'fields'));

 Ideas on what I am doing wrong?

 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: Unlimited Slugs for an Action

2009-03-11 Thread jabocs

Ok, I kept digging, and found my own answer again across a couple
different posts so in case it can help anybody else in the future:

I added this to the very end of my routes.php:

Router::connect('/*', array('controller' = 'slug_pages', 'action' =
'view'));

to catch all wild card created sections to go to the view action of my
SlugPagesController

Then in my view action my first line of code is:

$getParms = func_get_args();


so as in my example of http://www.mysite.com/about/sub1/sub2/sub3/page1
I would get an array like this:

Array
(
[0] = about
[1] = sub1
[2] = sub2
[3] = sub3
[4] = page1
)

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



Caking for FUN+Profit

2009-03-11 Thread mariuz


Here is my next presentation prepared for php meetup in boston

http://mapopa.blogspot.com/2009/03/caking-for-funprofit-here-is-my-next.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: recursive in parents

2009-03-11 Thread dr. Hannibal Lecter

A silly guess would be that you didn't set up your B=A relation
properly.

Could you please show us your relations?

Hint: http://bin.cakephp.org/

On Mar 11, 6:39 pm, fain182 fain...@gmail.com wrote:
 my situation is this:
 A has many B
 B has many C

 in the view of C i see only the data of B  and C, i want to see the
 data of A too..
 i tried to set the recursive to 2 or 3 but it makes something like:
 array A
     array B that has A
        array A that belongs to B

 did you have any suggestion?
 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
-~--~~~~--~~--~--~---



Re: MooTools Ajax with Cake

2009-03-11 Thread Arak Tai'Roth

very cool, thanks for your help.

On Mar 11, 11:31 am, mark_story mark.st...@gmail.com wrote:
 No worries,  glad to hear you got it all sorted.  MooTools can have a
 pretty steep learning curve, as it doesn't have as many one liners as
 other libraries, but if you stick with it, there is a lot of power and
 features under the hood.  As for neat shortcuts, look at
 Element.implement() you can add on additional element shortcuts that
 trigger effects.  The Chain class is also a really powerful and
 interesting class.

 -Mark

 On Mar 10, 10:06 pm, Arak Tai'Roth nielsen.dus...@gmail.com wrote:

  Also not to be an ass. But I have effects working, you are right there
  is tons of documentation. I was just checking if anyone had any cool
  ideas I hadn't thought of.

  I also did get it working just fine with multiple elements of the same
  name.

  Copy and pasting can lead to a lot of issues with no understanding I
  agree. However it gets you something to work on right away and gives
  you a more practical way to learn, and for me, that's far more useful.

  On Mar 10, 10:56 am, mark_story mark.st...@gmail.com wrote:

   Not to be an ass, but mootools has tons of documentation, examples and
   tutorials.  You can find lots of information on how you use effects in
   the mootools docss.  Furthermore if you have more than one element
   with the same ID don't expect anything to work properly.  In addition
   Element.load() does do an AJAX request.  Just as a GET instead of a
   POST type request.  But if you are new to Ajax and Mootools, I would
   start with the docs, copy+pasting is going to lead to lots of these
   type issues.

   -Mark

   On Mar 9, 4:39 pm, Arak Tai'Roth nielsen.dus...@gmail.com wrote:

Well it looks like I got it all working. Now I just need to figure out
how to add some kind of effect to it. If anyone has any advice on
that, that would be perfect.

On Mar 9, 11:43 am, Arak Tai'Roth nielsen.dus...@gmail.com wrote:

 So I completely revamped the code in my ajax file to this:

 window.addEvent('domready', function()
 {
         $('ajax_replace').addEvent('click', function(event)
         {
                 event.stop();

                 var req = new Request(
                 {
                         method: 'get',
                         url: $('ajax_replace').get('href'),
                         data: { 'do' : '1' },
                         onComplete: function(response)
                         {
                                 
 $('about_descriptioncontent').set('html', response);
                         }
                 }).send();
         });

 });

 It now kinda works. I had an onRequest portion in there and that was
 triggering, and the content was changing, it was incredibly messed up
 (ie. wasn't outputting what I was expecting it to). However this only
 works for the first of my links, the other ones don't do anything at
 all.

 On Mar 9, 11:25 am, Arak Tai'Roth nielsen.dus...@gmail.com wrote:

  I don't want to do a simple GET request, I do want this as AJAX,
  that's just the code I found. I am extremely new to MooTools, never
  used it before this, in addition I am new to using AJAX period.

  One thing I just realized and am slightly confused about. With the
  code $('ajax_replace) I am under the understanding that I am
  referencing the element id = ajax_replace. However I have multiples 
  of
  those on this page, 4 right now, likely more later once I have this
  working. How does it know which one to add the event too (I want it
  added to all of them) and how does it know which one to get the URL
  from?

  I am assuming it doesn't know, and might be the reason why things
  aren't working.

  On Mar 9, 11:06 am, mark_story mark.st...@gmail.com wrote:

   Well I would start with seeing if the Selector is working? does 
   the
   click event even fire? I use mootools quite often, and there is
   nothing in cake that prevents you from doing so. Why aren't you 
   just
   using Element.load() instead?  If you only want to do a simple GET
   request, I would just do

   window.addEvent('domready', function() {
     $('ajax_replace').addEvent('click', function(event) {
       event.stop();
       $('about_descriptioncontent').load(this.get('href'));
     }

   });

   Or you can keep your existing code, but you may want to prevent 
   the
   default browser action anyways.  As you won't see the ajax 
   result, as
   the default action will still happen.

   -Mark

   On Mar 9, 12:03 pm, Arak Tai'Roth nielsen.dus...@gmail.com 
   wrote:

Also considering I am using multiple links I tried this as well:

url: $$('a.ajax_replace').get('href'),

and


Redirect Loop

2009-03-11 Thread Tony Thomas

I've been working on a local copy of my CakePHP app that runs on a my
computer. Today I've only been working on a layout and the style
sheet. I took a break and went back to it which prompted a new login.
Suddenly I'm getting a redirect loop. Firefox gives me this following
message:

Redirect Loop

Firefox has detected that the server is redirecting the request for
this address in a way that will never complete.

The browser has stopped trying to retrieve the requested item. The
site is redirecting the request in a way that will never complete.

* Have you disabled or blocked cookies required by this site?
* NOTE: If accepting the site's cookies does not resolve the
problem, it is likely a server configuration issue and not your
computer.

Any thoughts on what might cause that if I wasn't working in the a
controller? More importantly, how do I fix it?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: recursive in parents

2009-03-11 Thread fain182

mhmm.. i think that's all right with relations... I baked them..

http://bin.cakephp.org/saved/43619



On Wed, Mar 11, 2009 at 9:40 PM, dr. Hannibal Lecter
lecter...@gmail.com wrote:

 A silly guess would be that you didn't set up your B=A relation
 properly.

 Could you please show us your relations?

 Hint: http://bin.cakephp.org/

 On Mar 11, 6:39 pm, fain182 fain...@gmail.com wrote:
 my situation is this:
 A has many B
 B has many C

 in the view of C i see only the data of B  and C, i want to see the
 data of A too..
 i tried to set the recursive to 2 or 3 but it makes something like:
 array A
     array B that has A
        array A that belongs to B

 did you have any suggestion?
 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
-~--~~~~--~~--~--~---



Auth Error message

2009-03-11 Thread Dave Maharaj :: WidePixels.com
I am trying to get a custom error message for a user logging in who has not
clicked the email confirmation link So it will say please confirm your email
blah blah blah..
 
I was trying to use
http://bakery.cakephp.org/articles/view/authed-adds-rule-based-userscope-to-
auth but all it ended up doing was changing the loginError or authError
nothing came from the unconfirmed user trying to login.
 
Can someone point me in the right direction.
 
 
var $components = array('Auth', 'Acl', 'RequestHandler', 'Authed');
  
  function beforeFilter()
  {
  $this-Auth-userScope = array('User.confirmed' = '1');


// these two we are familiar with
$this-Authed-loginError = __(Wrong password / username. Please try
again., true);
$this-Authed-authError = __(Sorry, you are not authorized. Please log
in first., true);
 
// now this one is new
$this-Authed-userScopeRules = array(
'User.confirmed' = array(
'expected' = 1,
'message' = __(Your account is not active yet. Click the Link
in our Mail., true)
)
); 
 
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: recursive in parents

2009-03-11 Thread dr. Hannibal Lecter

Yes, it seems ok. How do you get your data with find()?

On Mar 11, 10:26 pm, fain182 fain...@gmail.com wrote:
 mhmm.. i think that's all right with relations... I baked them..

 http://bin.cakephp.org/saved/43619

 On Wed, Mar 11, 2009 at 9:40 PM, dr. Hannibal Lecter

 lecter...@gmail.com wrote:

  A silly guess would be that you didn't set up your B=A relation
  properly.

  Could you please show us your relations?

  Hint:http://bin.cakephp.org/

  On Mar 11, 6:39 pm, fain182 fain...@gmail.com wrote:
  my situation is this:
  A has many B
  B has many C

  in the view of C i see only the data of B  and C, i want to see the
  data of A too..
  i tried to set the recursive to 2 or 3 but it makes something like:
  array A
      array B that has A
         array A that belongs to B

  did you have any suggestion?
  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
-~--~~~~--~~--~--~---



Re: recursive in parents

2009-03-11 Thread fain182

sorry.. there was a my fault...
thank you and excuse me ;-)


On Wed, Mar 11, 2009 at 10:51 PM, dr. Hannibal Lecter
lecter...@gmail.com wrote:

 Yes, it seems ok. How do you get your data with find()?

 On Mar 11, 10:26 pm, fain182 fain...@gmail.com wrote:
 mhmm.. i think that's all right with relations... I baked them..

 http://bin.cakephp.org/saved/43619

 On Wed, Mar 11, 2009 at 9:40 PM, dr. Hannibal Lecter

 lecter...@gmail.com wrote:

  A silly guess would be that you didn't set up your B=A relation
  properly.

  Could you please show us your relations?

  Hint:http://bin.cakephp.org/

  On Mar 11, 6:39 pm, fain182 fain...@gmail.com wrote:
  my situation is this:
  A has many B
  B has many C

  in the view of C i see only the data of B  and C, i want to see the
  data of A too..
  i tried to set the recursive to 2 or 3 but it makes something like:
  array A
      array B that has A
         array A that belongs to B

  did you have any suggestion?
  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
-~--~~~~--~~--~--~---



xml parser removing html entities

2009-03-11 Thread Antoni

Hello,

I am using the provided xml class to parse my rss feed from my blog.
But when I parse the xml and spit out the array all of the html
entities have been removed.

here is what a link looks like: a href=http://picasaweb.google.com/lh/
photo/05ihu8FUhDHgVl9LmOx3kw?
authkey=Gv1sRgCLr4g4iGjZCvgwEfeat=embedwebsite

It is missing the  (lt;) and  (gt;) signs.

and here is the php code:
function index() {
App::import('Xml');

// antoni-s blog
$aBlog = http://antoni-s.blogspot.com/atom.xml;;

// now parse it
$antoni_xml = new XML($aBlog);
$antoni_xml = Set::reverse($antoni_xml); // this is what i call
magic

// see the returned array
//debug($antoni_xml);

//set the array for antoni-s to news view
$this-set('news',$antoni_xml);

// antoni-tech blog
$tBlog = http://antoni-tech.blogspot.com/atom.xml;;

// now parse it
$tech_xml = new XML($tBlog);
$tech_xml = Set::reverse($tech_xml); // this is what i call 
magic

// see the returned array
//debug($tech_xml);

//set the array for antoni-s to news view
$this-set('tech',$tech_xml);

}//end function

If someone could help I would appreciate it. Thanks

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



How is build CakeBook

2009-03-11 Thread kicaj

Hi,

How is build book.cakephp.org?
When I write Polish version (e.g. 
http://book.cakephp.org/pl/complete/14/Struktura-CakePHP),
...and when I click for 
http://book.cakephp.org/pl/view/19/CakePHP-File-Structure
i see english (default language) text because there is no translated
to Polish.

My question is How does it work (exactly: display default version when
there is no translated)?

I try do this the same, but I don't know How?

Can anybody help?
Something solutions would be well:)

Thanks a lot!

P.S. Sorry but english is not my language on a daily basis...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx

Thank you both for your responses.I will try these out and post back.

On Mar 11, 7:28 am, ohcibi i...@dwgadf.de wrote:
 if you have two different types of photos for your news, which should
 use the same photo-model you can define other model-aliases. like
 this:

 app/models/article.php:
 var $hasAndBelongsToMany = array(
     'Photo' = array(
         'className' = 'Photo', // should be the name of the Photo-
 Model
         // rest of habtm defintion of the normal photos
     )
 );
 var $belongsTo = array(
     'MainPhoto' = array(
         'className' = 'Photo', // should be the name of the Photo-
 model
     )
 );

 app/models/photo.php
 var $hasAndBelongsToMany = array(
     'Article'= array(
         'className' = 'Article'
     )
 );
 var $hasMany = array(
     'Article' = array(
         'className' = 'Article'
     )
 );

 providing a main_photo_id field in your articles-table you can now do
 normal find()'s and cake will fetch all the 'Photos' which are related
 via habtm and the one 'MainPhoto' as they were two different models...
 no need for an extra field in the join-table.

 you could also define the relation like Article hasOne MainPhoto and
 Photo belongsTo Article (and then you have to provide an article_id
 field in your photos-table), but then you cant use the same MainPhoto
 for different articles its up to you how to do it, but basically,
 if you want to use the same model for different relations, you can use
 different alias-names for this model

 On Mar 11, 11:52 am, Xoubaman xouba...@gmail.com wrote:

  Just model it like a normal HABTM relationship, no special syntaxis,
  and add the field in the database.

  When saving, try this:

 http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-jo...

  I haven't done it before, so i can't secure his fiability, but looks
  good.

  On Mar 11, 10:38 am, mattalexx mattal...@gmail.com wrote:

   What's the syntax for adding an extra field to the
   $hasAndBelongsToMany var?

   Thank you for you response.

   On Mar 11, 2:43 am, Xoubaman xouba...@gmail.com wrote:

You can model it like a normal HABTM relationship with an extra field
named main_photo.

On Mar 11, 8:30 am, mattalexx mattal...@gmail.com wrote:

 My articles have and belong to many photos. This is so when the photo
 is seen somewhere else on the site, I can have a see related
 articles. Each article also has one main photo. I can't seem to
 figure out the syntax for this in APP/models/article.php file and in
 APP/models/photo.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: CakePHP in Google Summer of Code

2009-03-11 Thread Gwoo

Hi Diego,

I have been thinking a lot about GSOC.

Here is a (short) list of ideas
http://bin.cakephp.org/saved/43627

Please expand on it.

I will submit an application and hopefully we will be accepted.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx

It works! You guys rock. Thanks.

On Mar 11, 7:28 am, ohcibi i...@dwgadf.de wrote:
 if you have two different types of photos for your news, which should
 use the same photo-model you can define other model-aliases. like
 this:

 app/models/article.php:
 var $hasAndBelongsToMany = array(
     'Photo' = array(
         'className' = 'Photo', // should be the name of the Photo-
 Model
         // rest of habtm defintion of the normal photos
     )
 );
 var $belongsTo = array(
     'MainPhoto' = array(
         'className' = 'Photo', // should be the name of the Photo-
 model
     )
 );

 app/models/photo.php
 var $hasAndBelongsToMany = array(
     'Article'= array(
         'className' = 'Article'
     )
 );
 var $hasMany = array(
     'Article' = array(
         'className' = 'Article'
     )
 );

 providing a main_photo_id field in your articles-table you can now do
 normal find()'s and cake will fetch all the 'Photos' which are related
 via habtm and the one 'MainPhoto' as they were two different models...
 no need for an extra field in the join-table.

 you could also define the relation like Article hasOne MainPhoto and
 Photo belongsTo Article (and then you have to provide an article_id
 field in your photos-table), but then you cant use the same MainPhoto
 for different articles its up to you how to do it, but basically,
 if you want to use the same model for different relations, you can use
 different alias-names for this model

 On Mar 11, 11:52 am, Xoubaman xouba...@gmail.com wrote:

  Just model it like a normal HABTM relationship, no special syntaxis,
  and add the field in the database.

  When saving, try this:

 http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-jo...

  I haven't done it before, so i can't secure his fiability, but looks
  good.

  On Mar 11, 10:38 am, mattalexx mattal...@gmail.com wrote:

   What's the syntax for adding an extra field to the
   $hasAndBelongsToMany var?

   Thank you for you response.

   On Mar 11, 2:43 am, Xoubaman xouba...@gmail.com wrote:

You can model it like a normal HABTM relationship with an extra field
named main_photo.

On Mar 11, 8:30 am, mattalexx mattal...@gmail.com wrote:

 My articles have and belong to many photos. This is so when the photo
 is seen somewhere else on the site, I can have a see related
 articles. Each article also has one main photo. I can't seem to
 figure out the syntax for this in APP/models/article.php file and in
 APP/models/photo.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
-~--~~~~--~~--~--~---



Using invalidate() in a behavior

2009-03-11 Thread Miles J

So I have an uploader behavior that I built, but im trying to add
validation for correct filetypes, etc. How do I trigger the validation
for the corresponding parent model? I tried doing invalidate() but
that doesn't work.

Is this even possible?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Model1 hasMany Model2 with count(), how to get SQL like this?

2009-03-11 Thread Svel

Thank You =)

Little fix to your reply:
$this-find('all', array('fields' = array('COUNT(BaseImage.id) as
cnt', 'Base.id'),
'group' = array('BaseImage.id'),
'joins' = array(
array(
'type' = null, // or INNER or LEFT - uppered, couse no 
automatic
'alias' = 'BaseImage',
'table' = 'base_images', // defaults to 'join_table' =)
'conditions' = array('Base.id = BaseImage.base_id') // 
but not
array('Base.id' = 'BaseImage.base_id')
)
)
));

What about 'foreignKey' for joins?
all other keys found in cake/libs/model/datasources/dbo_source.php
lines 1101-1105 and 1223-1229 and 1491-1494

resulting array looks like:
array(
[0] = array(
[0] = array([cnt] = 1)
[Base] = array(...)
)
[1] = ...
)
... no [BaseImages] key

PS: sorry for my english

On 11 мар, 18:04, Martin Westin martin.westin...@gmail.com wrote:
 You probably want a little, slightly obscure, gem called joins.

 In use it looks something like:
 $this-find('all', array(
     'conditions' = $conditions,
     'joins' = array(
         array(
             'table' = 'model2',
             'alias' = 'Model2',
             'type' = 'inner',
             'foreignKey' = model1_id,
             'conditions'= array(
                 'Model2.another_fk = Model1.id'
             )
         )
     )
 ));

 Check out Nate's nice article on the subject: (he talks about habtm
 but it is just as useful for 
 hasMany)http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-...

 /Martin

 On Mar 11, 2:39 pm,Svelsvel.so...@gmail.com wrote:

  Searching for 2 days and found nothing =(

  How i can build this SQL code:
  SELECT `m1`.`id`, COUNT(`m2`.`id`) as cnt
  FROM `m1` LEFT JOIN `m2` ON (`m1`.`id` = `m2`.`m1_id`) WHERE 1=1
  GROUP BY `m2`.`m1_id`
  ORDER BY `m1`.`id`

  is it real without custom Model-query() ?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 Query

2009-03-11 Thread Dave Maharaj :: WidePixels.com
I been at this for hours and still no luck. What I am trying to do is run a
simple query to find a user_id based on the Auth-id and pass the result to
the view.
 
This is being run in the students_controller which is checking the TEACHERS
table. In the view where I have wantsAccess all that gets displayed is
Array.
 
view: ?php echo $wantsAccess; ?
 
$this-set('wantsAccess', $this-Teacher-find('all', array( 'conditions' =
array('Teacher.user_id' = $this-Auth-user('id')),'fields' =
array('Teacher.id')
)
));
 
Can someone explain me how to run just a simple query. 
 
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: Custom Query

2009-03-11 Thread Miles J

Its find('first') and your query result will always be an array.

Try echo $wantsAccess['Teacher']['id']. You need to debug
($wantsAccess) to see its array values.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 Query

2009-03-11 Thread brian

On Wed, Mar 11, 2009 at 10:59 PM, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 I been at this for hours and still no luck. What I am trying to do is run a
 simple query to find a user_id based on the Auth-id and pass the result to
 the view.

 This is being run in the students_controller which is checking the TEACHERS
 table. In the view where I have wantsAccess all that gets displayed is
 Array.

 view: ?php echo $wantsAccess; ?


?php debug($wantsAccess); ?


 $this-set('wantsAccess', $this-Teacher-find('all', array( 'conditions' =
 array('Teacher.user_id' = $this-Auth-user('id')),'fields' =
 array('Teacher.id')
 )
 ));

If you want just a single row, use find('first', ...). If you really
want just the ID, use the field() method:

$this-set(
'wantsAccess',
$this-Teacher-field(
'id',
array(
'Teacher.user_id' = $this-Auth-user('id')
)
)
);

This will return just the ID (no array). Note that you don't put the
'conditions' key because that 2nd param is *only* for conditions.

Another bit of advice: I've gotten in the habit of naming my vars much
more specifically (ie. $user_id rather than $wantsAccess) in order to
keep things clearer months down the road when I need to make changes
(and curse my lack of comments ;-)

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



Update CakePHP core

2009-03-11 Thread Kal

Hi CakePHP group members,

I think there are few security holes in version of CakePHP 1.1.19, our
website have been hacked partially twice in the last 2 days.

How can we upgrade our CMS based on CakePHP 1.1.19 to latest version
1.2.1.8004?

Kind regards
Kal
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 Query

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

Thanks again,

That works perfectly the way I want. I really appreciate your help and
advice.

Dave 

-Original Message-
From: brian [mailto:bally.z...@gmail.com] 
Sent: March-12-09 1:20 AM
To: cake-php@googlegroups.com
Subject: Re: Custom Query


On Wed, Mar 11, 2009 at 10:59 PM, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 I been at this for hours and still no luck. What I am trying to do is 
 run a simple query to find a user_id based on the Auth-id and pass 
 the result to the view.

 This is being run in the students_controller which is checking the 
 TEACHERS table. In the view where I have wantsAccess all that gets 
 displayed is Array.

 view: ?php echo $wantsAccess; ?


?php debug($wantsAccess); ?


 $this-set('wantsAccess', $this-Teacher-find('all', array( 
 'conditions' = array('Teacher.user_id' = 
 $this-Auth-user('id')),'fields' =
 array('Teacher.id')
 )
 ));

If you want just a single row, use find('first', ...). If you really want
just the ID, use the field() method:

$this-set(
'wantsAccess',
$this-Teacher-field(
'id',
array(
'Teacher.user_id' = $this-Auth-user('id')
)
)
);

This will return just the ID (no array). Note that you don't put the
'conditions' key because that 2nd param is *only* for conditions.

Another bit of advice: I've gotten in the habit of naming my vars much more
specifically (ie. $user_id rather than $wantsAccess) in order to keep things
clearer months down the road when I need to make changes (and curse my lack
of comments ;-)



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



Re: CakePHP in Google Summer of Code

2009-03-11 Thread Dr. Tarique Sani
FWIW Having mentored 2 consecutive GSoC I would say this is a good idea -
though we have had problems with students vanishing once the summer is
over

Cheers
Tarique


On Thu, Mar 12, 2009 at 4:37 AM, Gwoo gwoo.cake...@gmail.com wrote:


 Hi Diego,

 I have been thinking a lot about GSOC.

 Here is a (short) list of ideas
 http://bin.cakephp.org/saved/43627

 Please expand on it.

 I will submit an application and hopefully we will be accepted.
 



-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

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



Re: Update CakePHP core

2009-03-11 Thread mscdex

On Mar 11, 11:56 pm, Kal kalpatt...@gmail.com wrote:
 How can we upgrade our CMS based on CakePHP 1.1.19 to latest version
 1.2.1.8004?

One place to start would be at the following place in the Cake manual:
http://book.cakephp.org/view/411/Migrating-from-CakePHP-1-1-to-1-2
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---