Re: one form,two submit,hao to submist to action what you want?

2006-08-11 Thread [EMAIL PROTECTED]

here the code:

if($this-params['form']['submit']=='Edit'){
   //edit your data
}elseif($this-params['form']['submit']=='Delete'){
   //delete your data
}

But there is a problem if you use different languages


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



persistModel issue ?

2006-08-11 Thread [EMAIL PROTECTED]

when I change persistModel from false to true in my controller
I got an error on $this-MyModel-bindModel()


the exacte line of code:

$this-Server-bindModel(array('hasMany'=array('Execution'=array( 
'conditions'=  'Execution.application_id='.$application['id'].'
AND Execution.created='.$application['created'].''.' AND
Execution.statut_id=1';

Have anyone encountered this problem before ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Cake and Traffic

2006-08-12 Thread [EMAIL PROTECTED]

Felix,
I do agree that its easy to setup on shared hosts.

Do you have any links of high traffic sites?

regards,
clayton


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: $ajax-link() causes Mozilla to crash

2006-08-12 Thread [EMAIL PROTECTED]

Update:
Its working already. Just updated it with the latest prototype.js
version

Regards,
clayton


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Broken view path problem with IIS

2006-08-12 Thread [EMAIL PROTECTED]

I've seen the same issue with the slashes missing, I think that
stripslashes() is being run over that text before it gets output to the
screen. But I'm not sure if it's affecting the internals, and I'm not
running on IIS (although I am running on Windows).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Validation: Futureproof / Accepted Technique?

2006-08-13 Thread [EMAIL PROTECTED]

I would very much like to know this as well, validation is one of those
things that ends up being a constant problem for me, at least when I
need to go more advanced than the default systems.

I've fairly successfully used beforeValidate() to do what validation I
need so far, but that's a bit unwieldy and I seem to have broken it on
my latest iteration, haven't figured out what I'm doing wrong yet.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Problem witch model !

2006-08-13 Thread [EMAIL PROTECTED]

I have 3 tables files,users,categories

CREATE TABLE `categories` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `name` varchar(64) collate utf8_bin NOT NULL default '',
  `priority` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=29
;

CREATE TABLE `files` (
  `id` int(6) NOT NULL auto_increment,
  `user_id` int(6) NOT NULL default '0',
  `album_id` int(4) NOT NULL default '0',
  `created` datetime NOT NULL default '-00-00 00:00:00',
  `hash` varchar(32) collate utf8_bin NOT NULL default '',
  `filename` varchar(255) collate utf8_bin NOT NULL default '',
  `category_id` int(2) NOT NULL default '0',
  `comment` varchar(255) collate utf8_bin default NULL,
  `tag` varchar(125) collate utf8_bin NOT NULL default '0',
  KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin
AUTO_INCREMENT=3545 ;

CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(50) collate utf8_bin NOT NULL default '',
  `password` varchar(32) collate utf8_bin NOT NULL default '',
  `name` varchar(50) collate utf8_bin NOT NULL default '',
  `email` varchar(100) collate utf8_bin NOT NULL default '',
  `last_visit` datetime NOT NULL default '-00-00 00:00:00',
  `group_id` int(10) unsigned NOT NULL default '0',
  `active` tinyint(1) unsigned NOT NULL default '0',
  `created` datetime NOT NULL default '-00-00 00:00:00',
  `modified` datetime NOT NULL default '-00-00 00:00:00',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `email` (`email`,`username`),
  KEY `group_id` (`group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3
;

its work ok

---
?php  class File extends AppModel {
  var $name = 'File'; // required for php4 installs
  var $belongsTo = 'User';}
?
--
when i add Category
--
?php  class File extends AppModel {
  var $name = 'File'; // required for php4 installs
  var $belongsTo = 'User,Category';}
?
---
than i have a error

Fatal error: Cannot instantiate non-existent class: category in
/home/andriu/cake/libs/model/model_php4.php on line 460
4 queries took 4 msNr   Query   Error   AffectedNum. rows   Took 
(ms)
1   DESC `files`23  23  1
2   DESC `users`10  10  1
3   DESC `groups`   4   4   1
4   DESC `permissions`  4   4   1

whats wrong witch category ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



RecruitOffice DB™ - An Open Source System

2006-08-14 Thread [EMAIL PROTECTED]

RecruitOffice DB™ brings the power of Web-based recruiting, staffing
to your fingertips, anytime, anywhere. Because RecruitOffice DB™ is
an Application Service Provider (ASP), you have no software to buy or
install. No need to wait. Simply log on to have a powerful, integrated
solution for applicant tracking and candidate placement. Quick,
portable, and affordable, RecruitOffice DB™ puts you in control of
the hiring process, from start to finish. Point, click, and place!

If your GOALS are to

.:|:.Decrease Time-To-Hire
Focuses recruiters on the best candidates first, reducing the time
spent reviewing unqualified candidates. Centralizes candidates from all
sources into your system, eliminating scattered resumes. All Web Based.
Manage Your Business From Any Place in the World.

.:|:.Minimize Cost-Per-Hire
Streamlines and centralizes your recruiting process, resulting in
significant cost savings. Powers and maintains your recruitment website
at a fraction of your current costs. No Office, No/Less Employees
Needed.

You can ACHIEVE it by implementing our

.:|:.World Class Web-Based Tool: RecruitOffice DB™ Platinum

RecruitOffice DB™ is a web-based staffing, recruitment management
system that streamlines your sourcing, screening, clients (employers)
management and candidate (job seekers) management process so you can
more quickly fill your open positions with the most qualified
candidates. The entire system can be implemented for your company in a
matter of days, with minimal IT resources.

URL: http://rodb.takveen.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How add condition for associated model in findAll()

2006-08-15 Thread [EMAIL PROTECTED]

use bindModel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



API documentation needs stylesheet change

2006-08-15 Thread [EMAIL PROTECTED]

At the present time,  Cake web-based API documentation for classes is
difficult to read, with no separation between classes above and below
the desired one.

Here is a simple solution to that annoying problem, along with a
proposed solution.

In api.css, please add the following lines:
-
TABLE.memname {
background-color:rgb(90%,90%,100%);
margin-top: 1em;
color:green;
font-weight: bold;
}
-

This small change will make the API documentation much easier to read.
For example, in your browser, compare the view before and after the CSS
change at

http://api.cakephp.org/class_controller.html.

Thank you.

Ralph Dratman


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: API documentation needs stylesheet change

2006-08-15 Thread [EMAIL PROTECTED]

In the prior message, I meant to write, with no visible separation
between methods above and below the desired method.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Getting Cake to work without access to the apache config file

2006-08-15 Thread [EMAIL PROTECTED]

I have hosting at 1and1.com, so i dont have access to modify the
DocumentRoot property.
Is there any way i can get cake to work without having to use urls like
mysite.com/cake/users ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: API documentation needs stylesheet change

2006-08-15 Thread [EMAIL PROTECTED]

Thank you for entering that ticket, John.

I meant to write that you can see a sample of the improved appearance
at

http://jengels.maxsoft.com/test/

versus the existing page at

http://api.cakephp.org/class_controller.html

(The top of my sample page is not rendered correctly. I didn't bother
to fix those parts of the layout, because they are not relevant to the
comparison. The changes are further down the page.)

This is a trivial problem only to those who believe clear documentation
is not very important. I think experience suggests otherwise. Even an
incomplete project can be quite useful if it includes good, readable
documentation.

But I'm guessing you might agree, since you took the trouble to
ticket-ize it. 

Regards,

Ralph


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: More than one way to skin a concatenate... (generateList)

2006-08-15 Thread [EMAIL PROTECTED]

Mini,

That's a great suggestion. I'm also using sql views (not to be confused
with Cake views!) to make things easier in my project.

Incidentally, I wonder if the use of Postgres could reduce the number
of steps in that solution by means of triggers. I suspect a calculated
field could be constructed transparently, including updates, in
Postgres.

I looked into Postgres for myproject, and was pleased that the
translation from Mysql to Postgres was really quite easy, and worked
fine --- but Mysql seems to have better development tools available, at
least in my limited investigation.

Regards,

Ralph


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



How to operate relational database in cakephp

2006-08-16 Thread [EMAIL PROTECTED]

  hi,guys:
  I am new in Cake. so can any one please tell me how to solve the
issue below:
There are two tables : Clients and Sites,one client has many
sites(client_id is the foreign key in table Site).Now I want to create
a thtml page in which users can add Client's information PLUS
site_name(which is from table Site).
  In this case , what should I do?

Thank you for your support


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: API documentation needs stylesheet change

2006-08-16 Thread [EMAIL PROTECTED]

Wow! Fast work, gwoo and John. That is most helpful. You guys rock.

Thank you.

Best regards,

Ralph


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Cannot use Model only for Validation (no table behind) $useTable = false;

2006-08-16 Thread [EMAIL PROTECTED]

HI everybody,

I want to use a model only for my validation logic! So i set my model
up with $useTable = false, but then cake generates a startup query on
my database. How can i fix that problem?

My CakeVersion is CakePHP 1.1.7.3363

The SQL Log says:
3   startup 1064: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near 'startup' at line 10

greets alex


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Need dynamic database config

2006-08-16 Thread [EMAIL PROTECTED]

I need a dynamic db config. I have to pick the name of the database i
want to connect from my session data. In The irc channel someone told
my that i have to put this in an before filter method:

var $beforeFilter = array ('_selectDatabase');

and in my method:

function _selectDatabase ()
{
if (APP_TYPE == 'online')
{
$db = ConnectionManager::getDataSource('default');
$db-disconnect();
$db-config['database'] = $_SESSION['datenbank'];
//print_r($db-config);
$db-connect();
}
}

but it did not work. it semms that i cannot connect to my db!
The print_r($db-config); prints the correct credentials out. What i am
doing wrong?

greets and many thanks
alex


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



$html-checkbox() and database field enum('true','false')

2006-08-16 Thread [EMAIL PROTECTED]

I have a database table with a field of type enum('true','false') to
represent boolean data.  I'd like to use HtmlHelper's checkbox function
to edit values for this field.  This seems to work fine if the user
checks the checkbox, but leaves the db field blank if the user doesn't
check the checkbox:

$html-checkbox('Content/nav', null, array('value'='true',
'checked'='checked')

I understand that the 'value' attribute is used as the field's value if
the checkbox is checked.  Is there a way to set the value Cake will use
if the checkbox is *not* checked?

Would I be better off using some other type for this boolean field in
the database, so $html-checkbox() will just work without any weird
hacks on my part?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Make AJAX call from onLoad event

2006-08-16 Thread [EMAIL PROTECTED]

My answer

?php echo $ajax-Javascript-event('window','load',
$ajax-remoteFunction(array('update'=  'menu',


'loading'= Element.hide('menu');Element.show('loading'),


'complete'=Element.hide('loading');Effect.Appear('menu'),


'url'= '/pages/menu')));?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Trying CakePHP for the first time and get error

2006-08-16 Thread [EMAIL PROTECTED]

I get the following warnings after I unzip cake into my htdocs Apache
directory and then launch cake from my localhost.  I'm using XAMPP and
my Apache has started successfully.  I must have some directory
settings not set correct somewhere.

Warning: opendir(C:\Program Files\xampp\xampp\htdocs\cake\app\models\)
[function.opendir]: failed to open dir: Invalid argument in C:\Program
Files\xampp\xampp\htdocs\cake\cake\basics.php on line 390

Warning: readdir(): supplied argument is not a valid Directory resource
in C:\Program Files\xampp\xampp\htdocs\cake\cake\basics.php on line 392

Warning: closedir(): supplied argument is not a valid Directory
resource in C:\Program Files\xampp\xampp\htdocs\cake\cake\basics.php on
line 397

Thanks!
Darren


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Polymorphism in Cake Models

2006-08-16 Thread [EMAIL PROTECTED]

Does anyone know if Cake supports polymorphism?  If so, is there a good
place for me to read up on it?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: AJAX Update div not working

2006-08-16 Thread [EMAIL PROTECTED]

josh southern wrote:
 For IE - that ended up being a problem with my Norton Internet Security
 Popup Blocker. If I disable that (or add the site I'm working on to the
 white list), everything works perfect in IE as well.

That's really disturbing to me. I'm working a very large app that
relies heavily on ajax updating. I'd been having this issue in IE as
well, and if it's the fault of the popup blocker, I'm going to have
some trouble. Since when do popup blockers block ajax? Does anyone have
any more information on this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to associate models without tables?

2006-08-16 Thread [EMAIL PROTECTED]

Good Idea.

The flexiblity of not having to have a database table for every model
would nice though.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Getting Cake to work without access to the apache config file

2006-08-16 Thread [EMAIL PROTECTED]

What I'm trying to to is use a url like mysite.com/users
instead of mysite.com/cake/index.php/users and instead of
mysite.com/cake/users


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Polymorphism in Cake Models

2006-08-16 Thread [EMAIL PROTECTED]

Thanks John.  I am pretty new to PHP.  Been programming in it for about
6 months and just found Cake.  I'm absolutely loving it.  I appreciate
the help.  I'll try using the functions you suggested.

Brian


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Cannot use Model only for Validation (no table behind) $useTable = false;

2006-08-17 Thread [EMAIL PROTECTED]

if i use $useTable = null; it throws me this error: No Database table
for model Sms (expected sms), create it first.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Optimizing cake projects

2006-08-17 Thread [EMAIL PROTECTED]

you can use cake:nocache?php echo $myDynamicContent;
?/cake:nocache to cache static par of your view


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



set function

2006-08-17 Thread [EMAIL PROTECTED]

Hi,

I have problem regarding the set function.
following code in user_controller.php

class UsersController extends AppController
{
 function user {
   $this-set('var','this user
fun');
}

 function  add {
   $this-set('var1','this add
fun');
}
}
i have user.thtml view file, so i can only use $var in my view file but
$var1 cannot be used in user.thtml view file and it gives error for
undefined variable in user.thtml file.

Plz help me.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Optimizing cake projects

2006-08-17 Thread [EMAIL PROTECTED]

I don't know, I read it in the manual at
http://manual.cakephp.org/chapter/view_cache


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



using generateList with 2 related models

2006-08-17 Thread [EMAIL PROTECTED]

I have 2 models:

Users
Counties

I have set up User model with HABTM relationship, because a user has
one or more counties with their account

tables look like this

users
 - id
 - username
 - password
 - email

counties
 - id
 - county

users_counties
 - user_id
 - county_id

I need to generate a key=val list of a user's counties to populate
various select lists, I can't seem to make this work by just giving the
relationships in the models, the SQL would look like:

select County.id, County.count from counties as County INNER JOIN
users_counties on County.id = users_counties.county_id where
users_counties.user_id = ?

I am needing to set the value of user_id by getting if from my Session

Right now I have resorted to:
  $u = $this-Session-read('User');
  $this-User-id = $u['User']['id'];
  $data = $this-User-read();

Then I loop through $data['County'] and do my own select tag.

I'm hoping there is an easier way, any help is appreciated.

Thanks,
Brian


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Problem witch model !

2006-08-17 Thread [EMAIL PROTECTED]

I didn't create category.php in model ! :) now is ok !


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Request other model in controler

2006-08-17 Thread [EMAIL PROTECTED]

so i have a 1st model and controller for Files and 2th / controller and
model for Comments,
my question is - Can I use findAll() for Comments in files Controller ?

-
class FilesController extends AppController{
var $name='Files';

var $components = array ('Pagination');
var $helpers = array('Pagination','html');

function index(){
$files = $this-File-FindAll($criteria=NULL, NULL, $order, 
$limit,
$page,0);
$this-set('files',$files);
$this-render('index');
 }
 function view($id){
$this-File-id = $id;
$this-set( 'files', $this-File-read(null,null,null,3) );
$this-set( 'neighbours', $this-File-findNeighbours(null,
'File.id', $id));
  // !
  // !
  // !!!  EXAMPLE i neeed this
  // !
$coments = $Comment-FindAll($criteria=NULL, NULL, $order, $limit,
$page,0);

$this-set('comments',$comments);

 }


--


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



How can I do this?

2006-08-17 Thread [EMAIL PROTECTED]

Hello group,

I would like to get some ideas on what is the best way to do the
following in CakePHP.

I am developing a little content management app that allows the user to
create pages.
I want to allow them to add dynamic content to their pages. That
dynamic content, let's say a stock market chart, is being generated
somewhere else in my app.

Since I don't want to allow PHP code on their pages / content creation
form, I will probably use some kind of made up tag language, that I can
easily filter out and replace with a function inside the app.

For example, if they put [CHART_GOOG] in their form, it will be
replaced with a chart of the google stock.

So when I parse the page, that is stored in the database, and generate
the dynamic content, where should this content be generated at.

Should I make like a dynamiccontent.php component, and just call it
within the pages_controller.php? Should the component actually output
the complete html, and then I just put in a var and show it my view?
If so, how can I output something to html inside my component?

Or maybe I should just do it all within my pages controller?

Any ideas and suggestions are appreciated!

gregory


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Cannot use Model only for Validation (no table behind) $useTable = false;

2006-08-18 Thread [EMAIL PROTECTED]

That is the thin, i to nothin like $this-Model-validates, i only use
$uses = array ('..', '..', 'Sms');

I think its in the model initialization that causes the startup query


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Trying CakePHP for the first time and get error

2006-08-18 Thread [EMAIL PROTECTED]

Figured it out. In case others get this. I found that if I created an
empty models directory in the app folder, the warnings go away.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to use caching of views in multilinguaal sites?

2006-08-18 Thread [EMAIL PROTECTED]

if you solution that problem maybe u can write about this in the cake
wiki ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Integrate a JS Datepicker

2006-08-18 Thread [EMAIL PROTECTED]

I was looking for a calendar datepicker too! Thanks a lot mate ;)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



anyone has experience with http://www.domainsname.us.

2006-08-18 Thread [EMAIL PROTECTED]

anyone has experience with http://www.domainsname.us. The have some
good expired domains for sale that  i will like to purchase.
thanks in advance


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Field is apparently a reserved word.

2006-08-18 Thread [EMAIL PROTECTED]

Field seems to be a reserved word in cake.
i had a table called fields, with a model filename of field.php.
A simple bake of the model and controller with scaffolding turned on
gave me all sorts of warnings.

i renamed it something else, and it works fine.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Filtering Data

2006-08-19 Thread [EMAIL PROTECTED]

sam D,

really you want to avoid the custom sql (using -query) as much as
possible

Why? That method seems to work fine. I use query().

Please elaborate.

Ralph


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: User Bar Logic

2006-08-19 Thread [EMAIL PROTECTED]

I understand why you would want to write it in the app_controler (so
that all controllers might inherit from this).  The problem is, there
doesn't seem to be a way to declare variables outside of functions.
And, as you probably are finding out, when a application controller
inherits from the app_controller, the function declared in
app_controller (with the variable foo, let's say) would be
overwritten.  Good question, but not sure how to make it work or
achieve visibility.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: url and routing

2006-08-20 Thread [EMAIL PROTECTED]


darx wrote:
 Hi bakers,
 i know it's been asked before but none of the threads was so claryfing.

I know exactly what you mean :) I've gone through about 20 topics on
this group, of which most ones end up in pointing to the same solution
(which is ad7six locale package)

I also noted this pretty radical different point of view between the
locale package and what you and me try to achieve.
Whereas you and me want to have the urls in native language of the
user, the locale package focuses on using english-url's and then
showing content in the right language (at least, that's what i
understood of it when skimming ad7six' tutorial on the wiki)

So our problem (well at least mine, yours is similar but not entirely
the same i think) is that controllers and actions should be named in
english (programming in a language other then english is not a good
practice imo), while we want our url's in a language other then
english. (but map these urls to english ones, or at least call the
english controllers and actions)

The solution that i've come up with, is to take $from_url, split it in
parts, and then check each part if it should be mapped to something
else. (eg map indici to index, map newzi to news, etc), then i
reconstruct the $from_url again, which is the translated (where
nessecary) version of the original one, and the normal routing
functions go on from that.

I'm still tweaking my code, and will post it later on
 (ftr: it would be cool if the routes.php would have something like
components like controllers do, to modularize code also on other levels
then models, views and controllers. or is this possible already?)

Oh, and for the record, my site is in 1 language only (dutch) so i
don't have to worry about selecting languages in my controller (or
view), i just map the dutch url to an english one and all my views
shows the dutch content anyway


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: url and routing

2006-08-20 Thread [EMAIL PROTECTED]

Uhm, afaik, every url must do a pass trough the routing system, so if
you put all your mapping , or filtering logic in there, you can
change it there, and only there, in case anything needs to changed
(please, correct me if i'm wrong)

and yes, imo the user benefits from an url in his own language.  not
every visitor understands english decently enough to understand _all_
urls (which can get complicated if you get difficult words as actions)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: url and routing

2006-08-20 Thread [EMAIL PROTECTED]

As promised, here is my solution.
fresh from the kitchen, so it needs some cooling down.
but it's eatable i think (at least it tastes good to me!)

in routes.php add this _BEFORE_ your routes

include_once(translate.php);
$from_url = translate($from_url);

then create translate.php in the same folder as routes.php and put this
in it:
(make sure there are no newlines or whitespace outside the php tags!)

?php
function translate($var = null,$level=total)
{
if($var)
{
if($level==total)
{
$old = explode('/',$var);
$lastone = end($old);
if(empty($lastone)) array_pop($old);
$new = array();

/* translate each part where you have a mapping 
table for */
if(sizeof($old))$new[0] = 
translate($old[0],controller);
if(sizeof($old)1)$new[1] = 
translate($old[1],action);

/* copy remaining entries, if any.  
array_merge() is not suitable
for this :( */
for ($i = 2; $i  sizeof($old); $i++)
{
$new[$i] = $old[$i];
}

/* construct the translated url.  this also 
adds a trailing /
even if it wasn't in the original */
$new_url=;
foreach($new as $n)
{
$new_url .= $n./;
}
return $new_url;
}
else
{
$table = array('controller' = 
array('nieuws' = 'news',

'aanbiedingen' = 
'offers'

),

'action'= array('bekijk' = 'view',

'verwijder' = 'delete',

'voegtoe' = 'add'

)

);
if(isset($table[$level]))
{
foreach ($table[$level] as $orig = 
$new)
{
if($var == $orig) $var = $new;
}
}
else
{
if(DEBUG) echo(translate table for 
level .$level. not found:
.$var. left untranslated\n);
}
return $var;
}
}
}
?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: url and routing

2006-08-20 Thread [EMAIL PROTECTED]

http://cakephp.org/pastes/show/5f136ad39fe38b274fd2090c2a24c5d7 this
will be easier to copy/paste from (mind you, at line 51 there is a
newline, but the backslash isn't shown)

Felix and mouth.
i haven't mentioned this before, but the app i'm building is a project
for school, and i thought it would be really cool if the whole user
experience (including urls) would be in dutch.  it would give a little
extra touch to my application.

 apart from the programming which is (obviously) in english, the
website on itself is only 1 language, dutch.  so i think that on itself
solves some things you mentioned.
also, i don't plan to use ajax, i will use (little) javascripts though
also, the translator is just a (transparant) layer that performs a
translation and then the whole system (with routing etc) is left
untouched.  as long i watch out that there are no words in english that
will be recognized as dutch and stranslated, anything in english should
go straight through.  I _will_ use a webservice (soap) though, fully in
english, but i don't think there will be problems with that (given the
remark above)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Trying CakePHP for the first time and get error

2006-08-20 Thread [EMAIL PROTECTED]

I used Winzip.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: url and routing

2006-08-20 Thread [EMAIL PROTECTED]

 Dieter: Alright, as I already tried to communicate numerous times, I'm
 not criticizing you for trying to build a website with i18n url's, I
 criticized the available ways of achieving it - concluding in the
 opinion that it's not worth it for me. You do a web site for school, you
 might enjoy it, it's small (?), only 1 language, I can see it work out.


i've never felt offended or critisized by any of your posts, i didn't
realise my posts would let you think otherwise.  i'm here to discuss
this matter because i want to hear opinions, experiences,... to learn
from them.  but the opinions i've seen this far are the general ones
(as you said in your last post) that keep multi-lingual and what-not
sites in mind.
that's why i explained my project a little more. (only 1 language,
little javascript, soap webservice etc), so that you (and the others)
could formulate your ideas again on my approach for this specific
project


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Debug working with IE but not Firefox

2006-08-20 Thread [EMAIL PROTECTED]

I had the same problem... the debug 2 wasn't working at all...
thanks mate for the tip


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Help me with my logic please

2006-08-21 Thread [EMAIL PROTECTED]

Hello fellow bakers!

first of all I'd like to tell you that I am an experienced php
developer for years, firstly with plain procedural way, last year OOP
and now I started baking with cakePHP, so I am really new to MVC
concept.

I decided that my first baked application would be a classifieds
system, but not a generic one... I am going for used cars classifieds.

Firstly I defined the database structure. I will list you some basic
tables to show you what I have in mind:


table: companies
table: users
table: user_favorites
table: classifieds (id, user_id, company_id, type, created, modified,
status)
table: photos
table: cars
table: cars_specs
table: classifieds_cars
table: classifieds_others

now,
a user can belong to a company (not a must though)
user can have many classifieds
user can have many favorites (favorite classifieds)

a classified can be posted by a user or a company

There are many classifieds types... two basic though: classifieds cars
and classifieds others...

So this is basics... hope I have explained myself ok.

Now how to do the logics of the site.
It depends on what type of classified we are dealing with...
(cars,others)
so do I need to make the controller logics for only classifieds (delete
classified, add photo, etc - the logics that is the same for both
types), then cars (unique methods just for cars) and others (unique
methods for others) or just classifieds_cars, and classifieds_others
(separated logics)?

and I you suggest me the first option (the common logics)... how do I
manage to combine those? common+cars and commons+others ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



othAuth: logging in as other user + warning when permissions not sufficient

2006-08-21 Thread [EMAIL PROTECTED]

Hey guys, i just installed othauth, injected the logic in
app_controller, created some users, groups, incremented $gid a bit and
set $strict_gid_check to false in the component configuration (yes i
know this is not a clean method, i will fix this later and pass the
right stuff to the login method)


but now i have 2 questions

1)i can login both as user A, or as user B, but when i'm logged in as A
i can't login as B without logging out first (and vice versa).  is this
a bug, or a feature? ;-) any way i can enable upgrading accounts
without making dirty hacks in oth's code?

2) say i'm not logged in and request to do a protected method, so i get
the login prompt, and enter the (valid) login information for a user
who's permission level is not sufficient for the action.  what happens
now is that i'm redirected back to the login page.  anyone knows a nice
method to return to the loginpage, but show also a message permissions
not sufficient for this user or something like that?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Join Table in Conditions of a findAll

2006-08-21 Thread [EMAIL PROTECTED]

I have a database schema with categories and products that are joined
with categories_products table. This makes it so a product can be
assigned to multiple categories.

I would like to find all of the products that belong to a category.

I've tried:

$this-Product-findAll(array(CategoriesProduct.category_id='$id'),
$fields, null, 10, $page, 1);

but I get an unknown column CategoriesProduct.category_id error.

Is there anyway that I can do this besides writing my own query?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Testing controllers with SimpleTest revisited

2006-08-22 Thread [EMAIL PROTECTED]

loadmodels?
http://api.cakephp.org/basics_8php-source.html


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Testing controllers with SimpleTest revisited

2006-08-22 Thread [EMAIL PROTECTED]

if it says that you are redeclaring it, you are probably loading it
twice

eg trying to load it manually while it's already loaded automatically.
are you sure you need to load it manually?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Help me with my logic please

2006-08-22 Thread [EMAIL PROTECTED]

So I should write first the common logic in the classified controller

and then the unique methids in appropriate controllers that uses common
logic from the classified?

In non MVC applications I would use a classified class and then a cars
and other classes that would extend the classifieds class...how do I
adopt this technique into cake?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



FCKeditor CakePHP: howto enable opera without having fckeditor.js

2006-08-22 Thread [EMAIL PROTECTED]

Hello, on the wiki, there are 2 tutorials covering fckeditor:
http://wiki.cakephp.org/tutorials:beginners_only?s=fckeditor#step_7rich_text_editing_with_fckeditor
and: http://wiki.cakephp.org/tutorials:online_editor-fckeditor

both of them tell you the same when it comes to copying files from the
fckeditor archive to the cake/app folders.  they tell you to copy some
files, but _not_ to copy fckeditor.js, so that's what i did and what
everybody else did, i guess

now, there is the problem that for some weird reason that fckeditor
doesn't enable itself when you're using opera (it uses the user agent
string to see that), so you have to enable it manually as explained
here: http://wiki.fckeditor.net/FAQ#opera

now here is the catch! they use fckeditor.js, and we use fckeditor.php,
which is -functionality-wise- about the same i guess, but written in an
other language.
what they don't mention in the faq is thet setting the EnableOpera
variable in the php version has no effect.  Even more, if you check the
logic in the php file, you'll see that the constructor calls
CreateHtml(), which calls IsCompatible()

Now, the problem is when you compare the .js version and the .php
you'll see that the js one checks for EnableOpera but the .php version
doesn't do that at all.  So as far as i know, when using the php
version there is no option to enable the editor when you are using
opera. (this is hardcoded) none of this is mentioned in their faq.

So what did i do?
I added this right before the else return false; in IsCompatible.

else if(strpos($sAgent, 'Opera') !== false)
{
return true;
}

That way the editor works in opera.
If i overlooked something, please tell me, otherwise may god have mercy
on our souls, cause this is bad programming/documenting practice.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: FCKeditor CakePHP: howto enable opera without having fckeditor.js

2006-08-22 Thread [EMAIL PROTECTED]

oh and for the record, i tried passing EnableOpera everywhere i could
before altering the code.  (in the view, after creating the object and
before rendering it, in the constructorcode of the class, in the
config.js ...) all to no avail.

I also i forgot to mention that opera does show the toolbar and stuff,
but it doesn't work like it should.  buttons become un-usable after
clicking them a few times etc.  (but afaik, there are more known
problems with javascript code and the new opera 9.   wether it's opera
who is very (and always has been) very strict on things, or just can't
handle the code, i don't know)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: 's' vs. 'ies' plural for table names

2006-08-22 Thread [EMAIL PROTECTED]

thanks mate :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



getting started.

2006-08-22 Thread [EMAIL PROTECTED]

Hi.

I started to use cake a week ago - so far everything has been a bit
overwhelming :/ I am trying to create a simple recipe page:
Recipes have many ingredients. Ingredients take price and unit from
raw_materials. I have used the baker script to create the basic pages.
Right now the related ingredients look like this: (recipe view page)

id
recipe_id
raw_material_id
ingredient_number
result: 10 3 5 4

I would like it to print the ingredients like this:
ingredient_number
raw_material_unit
raw_material_name
result: 4 kg chicken.

This is my database layout:
CREATE TABLE `recipes` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(20) collate latin1_general_ci default NULL,
  `description` text collate latin1_general_ci,
  PRIMARY KEY  (`id`)
)

CREATE TABLE `ingredients` (
  `id` int(11) NOT NULL auto_increment,
  `recipe_id` int(11) NOT NULL,
  `raw_material_id` int(11) NOT NULL,
  `ingredient_number` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
)

CREATE TABLE `raw_materials` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(20) collate latin1_general_ci default NULL,
  `unit` varchar(10) collate latin1_general_ci default NULL,
  `price` int(11) default NULL,
  PRIMARY KEY  (`id`)
)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Models relations in nested tables and more...

2006-08-22 Thread [EMAIL PROTECTED]

Hi!
I would like to make a scaffold on my cars table...
What am I trying to do is the following:

hierarchy of the cars is pretty simple:
make-model-variant-

so instead of having at least 3 tables I decided to make only one, but
nested

the fields are id, parentid, name, description, year
so the parentid=0 represents the make
lets say:
id=1
parentid=0
name=BMW

id=2
parentid=1 (BMW)
name=series 5

Now nthat I have the tree hierarchy made I need to set car
specifications (horse power, max speed, number of doors, etc)

So in order to do this and to be able to add specifications later on I
made two additional tables:

table: fields
id, fieldname

table: cars_specs
car_id, field_id, value

I think the logic here is self explanatory

now, to make this work I obviously need to make some model relations...

I managed to make scaffolding work on nested cars table

so far, this is what I've got:


?php
class CarsController extends AppController {

var $scaffold;

}
?

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

var $belongsTo = array(
'Parent' =
array('className'='Car',
  'foreignKey'='parentid')
);

var $hasMany = array(
'SubCar' =
array('className'='Car',
  'foreignKey'= 'parentid')
);


var $hasMany = array(
'CarsSpec' =
 array('className' = 'CarsSpec'),

);

}
?




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

var $belongsTo = array(
'Car' =
 array('className' = 'Car',
'conditions' = '',
'order' = '',
'foreignKey' = '',
'counterCache' = ''),

);

var $hasMany = array(
'cfields' =
 array('className' = 'cfields'),

);

}
?


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

}
?




and now I am getting the error

Fatal error: Cannot instantiate non-existent class: cfields in
f:\root\cakephp - testing
ground\oglasnik\cake\libs\model\model_php4.php on line 460



What am I doing wrong?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: 's' vs. 'ies' plural for table names

2006-08-22 Thread [EMAIL PROTECTED]

then get cooking chef, i'm hungry ;-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



how to enqueu ajax remote fonction ?

2006-08-22 Thread [EMAIL PROTECTED]

My primary objective is to update multiple div at once like but not
like this exemple: // test.thtml
code
?=$ajax-link('Update 2 Div\'s', '/controller/test', array('update' =
array('first', 'second'))); ?

?=$ajax-div('first'); ?
This is the first div, it has the current time:
?=strtotime('now'); ?
?=$ajax-divEnd('first'); ?

?=$ajax-div('second'); ?
This is the second div, it shows server variables:
? pr($_SERVER); ?
?=$ajax-divEnd('second'); ?
/code

what I need looks like
?=$ajax-link('Update 2 Div\'s', '/controller/test', array('update' =
array('first', 'second'),'url'=('/pages/first/','/pages/second')); ?

Is it possible ?

thx


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Keep getting Undefined index: campaign_page_id error

2006-08-22 Thread [EMAIL PROTECTED]

The page_id in pages table matches with campaign_page_id in the
campaign table.


TABLES:

campaign: campaign_id INT, campaign_page_id INT
pages: page_id INT, page_url VARCHAR


MODELS:

campaign.php

class Campaign extends AppModel
{
   var $name = 'Campaign';

   var $useTable = 'campaign';
   var $primaryKey = 'campaign_id';

   var $belongsTo = array('Page' =
array('className'= 'Page',
  'conditions'   = '',
  'order'= '',
  'foreignKey'   = 'page_id'
)
  );
}


page.php

class Page extends AppModel
{
   var $name = 'Page'; # equals name of the field vendor in table
vendors.
 # by convention first column in all tables,
must be id.
   var $useTable = 'pages';
   var $primaryKey = 'page_id';

   var $hasMany = array('Campaign' =
array('className'= 'Campaign',
  'conditions'   = '',
  'order'= '',
  'foreignKey'   = 'campaign_page_id',
)
  );
}


pages_controller.php

class PagesController extends AppController
{
  var $name = 'Pages';

  function display()
  {
  $this-set('data', $this-Page-findAll());
  }
}


here is the view:

 foreach ($data as $output): ?
tr
td
   ?php echo $output['Page']['page_id']?
/td
td
   ?php echo $output['Page']['page_url']?
/td
td
   ?php echo $output['Campaign']['campaign_page_id']?
/td

/tr
?php endforeach; ?


page_id and page_url show up fine, but campaign_page_id does not.  I
get this error:

Undefined index: campaign_page_id



I just started in CakePHP, so I don't know if my error is in the
models, controller, or view.  Please help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Can't get basic example to work.

2006-08-22 Thread [EMAIL PROTECTED]

This should be easy but its killing me so I just have to ask. I can't
get a basic example MVC to work.

I use xampp to run mySql and apache on my pc (windows)
It's installed here. (DocumentRoot)  C:\Program
Files\xampp\xampp\htdocs

Cake is installed here:
C:\Program Files\xampp\xampp\htdocs\cake
Under that there are app, cake, and vendors folders.

In the app folder I created a simple model, view and controller.  My
//localhost points to the htdocs folder, how do I see my example
Posts view?

I thought it would be here:
http://localhost/cake/itch

Oh, and I verified that my cake/index.php shows up and says it can
connect to my database.

Am I missing something?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: tagErrorMsg not working since upgrade

2006-08-23 Thread [EMAIL PROTECTED]

Well, it's not been working properly for me either, but I just assumed
it was something I was doing wrong rather than a problem with Cake. Can
anyone else confirm this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Generate Password

2006-08-23 Thread [EMAIL PROTECTED]

Simplerules wrote:
 I am writing a Users Controller and need to generate a password if
 somebody has forgotten theirs, what is the cleanest way to generate a
 short password with numbers and letters?


I did this today, using:

$chars =
array(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9);
$password = null;

for($i = 0; $i  rand(8, 12); $i++)
{
$r = rand(0, 35);
$password .= $chars[$r];
}


However, in reflection, a cleaner approach to generate a range of
/letters/ could be done like so:

$password = null;
for($i = 0; $i  rand(8, 12); $i++)
{
$password .= chr(rand(97, 122));
}


(Possibly useful reference: http://www.asciitable.com/)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: getting started.

2006-08-23 Thread [EMAIL PROTECTED]

bump


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: how to enqueu ajax remote fonction ?

2006-08-23 Thread [EMAIL PROTECTED]

no one ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Models relations in nested tables and more...

2006-08-23 Thread [EMAIL PROTECTED]

Tahnks AD7six for your answer!

firstly I changed my table cars_specs to cars_cfields and than I
changed as you suggested..

now the scaffold works, but in my edit form I cannot find nothing about
cars_cfiels...
my ultimate goal is to make a form where I woulkd select the make, the
model name... and in the end there should be all the cfields with a
text box to insert the value... and when seeing the details only those
not empty would be shown... I gues this is not possible by simple
scaffold, righ? ;)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



css compression doesn't work

2006-08-23 Thread [EMAIL PROTECTED]

Can anyone explain me how to get it working!

The COMPRESS_CSS comment are too few

/**
 * Compress output CSS (removing comments, whitespace, repeating tags
etc.)
 * This requires a/var/cache directory to be writable by the web server
(caching).
 * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or
use Controller::cssTag().
 */


I use ?php echo $html-css('style_ie'); ?
in html link rel=stylesheet type=text/css
href=/cleaninstall/app/webroot/ccss/style_ie.css /

but the /webroot/ccss directory is empty.

How to get it work?

The only idee I got is that I ve no /var/cache writeable directory. But
is it really needed, can't cake use an internal directory?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Map non-cake PHP files to a default controller like PagesController

2006-08-23 Thread [EMAIL PROTECTED]

I'm trying to integrate CakePhp into an existing PHP application. Due
to the not a file RewriteCond statement in the .htaccess file in
/webroot, if I have a php file /webroot/noncake.php, then going to
www.example.com/noncake.php will get me that file without running any
cake code.

What I'd like to do is have all requests for *.php files map to a
default controller, say PhpFilesController, which would then render the
requested php file within the default layout as if it were a view file.
This is somewhat similar to the way the PagesController renders thtml
files in /views/pages/. The difference is that I'd like to be able to
map requests for .php files anywhere under /webroot to a similar
controller which would essentially include the requested php file as if
it were a normal view.

The reason is that I'd like to be able to render these php files, which
are essentially legacy content on the site, within a customizable
layout that renders other elements such as a per-user customizable
navigation bar.

So far I've managed to get all requests for *.php files to map to the
standard /webroot/index.php?url=(original url) like standard cake-bound
requests are mapped. I just added the following to /webroot/.htaccess:

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*\.php)$ index.php?url=$1 [L]

This worked, with http://example.com/test.php leading me to a standard
Cake 404 page that reads The requested address test.php was not found
on the server. Then I tried adding a

$Route-connect('/*.php', array('controller' = 'pages', 'action' =
'display'));

in hopes that I might somehow get to the pages controller. But no luck
- i still get the 404 error and the request never reaches the pages
controller. Any ideas as to why this route-connect statment is
ineffectual? For reference, the 404 error is thrown on line 97 of the
Dispatcher::dispatch function, located at
http://api.cakephp.org/dispatcher_8php-source.html

Can anyone suggest what kind of Routing or other technique I'd need to
use to make this mapping possible? Once I get this working I'm also
going to need to get requests for www.example.com/adirectory/ to do the
same thing only for /adirectory/index.php, which require even more
mod_rewrite and routing stuff. 

Thanks so much,
Dan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: css compression doesn't work

2006-08-24 Thread [EMAIL PROTECTED]

ok but it simply just doesn't works : my css isn't applied
can you give an exemple of this working?

wouldn't it be more efficient to create a cache version of the css
instead of reprocessing everytime the compression algorithm ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: getting started.

2006-08-24 Thread [EMAIL PROTECTED]

Thanks. It is nice that you guys are taking time to help me. I will do
some redesign of my tables! I did not know that my model was wrong. I
have looked at the blog tutorial many times! But it does not give all
the details and background I need! Is there a more complete tutorial
that explains everything plain and simple?

Best regards.
Asbjørn Morell.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



save data from ONE form to TWO models

2006-08-24 Thread [EMAIL PROTECTED]

hi, here is my problem: i need to get user_id before saving the answers
of this user, but after i call $userID =
$this-requestAction(/users/saveUser), i found that the next saving
action just doesn't work, what shall i do please?


my models and controllers:
http://cakephp.org/pastes/show/8be29a861266efcf9943c3d5180fcf98


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: getting started.

2006-08-24 Thread [EMAIL PROTECTED]

Well I am much interested in how you would change my database! If I
have understood you correctly this is what should be done:

recipes (no changes)

Add a new table that joins ingredients with raw materials.
recipes_ingredients (recipe_id, ingredient_id, raw_material_id)

ingredients (number result: e.g 400 - I will remove the raw_materials
foreign key from this table)
raw_materials (price and unit - maybe also a picture later on. Result:
e.g 100$, kg)

So how do I set up my recipe model?
recipes_ingredients belongs to recipe
ingredients belongs to recipes_ingredients
raw_materials belongs to recipes_ingredients
Could it all be defined in one model? I think I know how to do it with
the bake script. If so, will cakephp know how to show ingredients in
the recipes view? Or do I need to customize something first?

Best regards.
Asbjørn Morell.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: getting started.

2006-08-24 Thread [EMAIL PROTECTED]

Well I am much interested in how you would change my database! If I
have understood you correctly this is what should be done:

recipes (no changes)

Add a new table that joins ingredients with raw materials.
recipes_ingredients (recipe_id, ingredient_id, raw_material_id)

ingredients (number result: e.g 400 - I will remove the raw_materials
foreign key from this table)
raw_materials (price and unit - maybe also a picture later on. Result:
e.g 100$, kg)

So how do I set up my recipe model?
recipes_ingredients belongs to recipe
ingredients belongs to recipes_ingredients
raw_materials belongs to recipes_ingredients
Could it all be defined in one model? I think I know how to do it with
the bake script. If so, will cakephp know how to show ingredients in
the recipes view? Or do I need to customize something first?

Best regards.
Asbjørn Morell.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Map non-cake PHP files to a default controller like PagesController

2006-08-24 Thread [EMAIL PROTECTED]

Good Idea. What does the old() function in your SpagesController look
like?

I'd like to have my legacy files in /webroot/content though. So I was
thinking that I would just have the controller pass the path to the
requested php file as a variable to the view, and then the view would
just consist of

include($pathToFile);

Thanks for your help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Script to make old projects ready for cake

2006-08-24 Thread [EMAIL PROTECTED]

Does anyone have some sort of script or utiltiy that you could use to
make an old project ready for cake?

could be php, or a series of mysql queries on itself...

i think about for example: go through each table in a certain database
and change every unix timestamp in mysql datetime, or go through each
table and replace each occurrence of id with _id, stuff like that
;)

if nobody has something like that i will probably write it myself, but
first i want to check ;)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: save data from ONE form to TWO models

2006-08-24 Thread [EMAIL PROTECTED]

i tried these codes:

$this-Answer-User-save($this-params['data']);
$userID = $this-Answers-User-lastInsertId();

but it said

Fatal error: Call to a member function on a non-object in
/home/felix/cake/sdq/controllers/answers_controller.php on line 29

line 29 is: $userID = $this-Answers-User-lastInsertId();


and, my saveUser():
function saveUser($data)
{
if (!empty($data))
{
//prepare
$data['User']['ip'] = 
$this-RequestHandler-getClientIP();

//save
$this-User-save($data);

//return
return $this-User-getLastInsertID();
}
}

Samuel DeVore 写道:

 Also if the models are related you can do

 if ($this-Answers-User-save(array('User'=$userData) {
  $user_id =$this-Answers-User-lastInsertId();
  $this-params['data']['otherModelData']['userr_id'] = $user_id;
  // now do your save of other stuff



 not tested or what ever but gives you the idea, you may want to save
 yourself the overhead of $this-requestAction

 Sam D

 still cranky and still and old fart  ;)
 On 8/24/06, Pablo Viojo [EMAIL PROTECTED] wrote:
  Check the object that /users/saveUser is returning, I think it's not only
  an id but a more complex structure.
 
  Regards,
 
  --
  Pablo Viojo
  [EMAIL PROTECTED]
   http://pviojo.net
 
 
 
  On 8/24/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  
   hi, here is my problem: i need to get user_id before saving the answers
   of this user, but after i call $userID =
   $this-requestAction(/users/saveUser), i found that the
  next saving
   action just doesn't work, what shall i do please?
  
  
   my models and controllers:
  
  http://cakephp.org/pastes/show/8be29a861266efcf9943c3d5180fcf98
  
  
  
  
  
  

  
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



First Cakephp site: www.penistone-advertiser.co.uk

2006-08-25 Thread [EMAIL PROTECTED]

Hi,

i have recently launced my first site using the Cakephp framework. The
site, called Penistone Advertiser, is a local web classified servce for
Penistone in Yorkshire (UK) listing items for sale. The site is at :

www.penistone-advertiser.co.uk

If you have time to have a quick glance, i would appreciate any
feedback on what is godd and what you think could be improved/added.

Many thanks in advance


Chris Hodgson
Penistone Advertiser
www.penistone-advertiser.co.uk


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



search form.

2006-08-26 Thread [EMAIL PROTECTED]

Hi.

I would like to create a simple search form for my page.. it should
search 1 table and show the result? Could not find any information
about this (manual, wiki, forum etc.)  This is what I have tried so
far:

controller:
function search(){
$conditions = $this-postConditions($this-data);
$this-Recipe-findAll($conditions);
}

index:
?php echo $html-input('Recipe/name'); ?
div class=submit
?php echo $html-submit('search');?
/div

Something is missing because nothing happens when I click search!

Best regards.
Asbjørn Morell.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Script to make old projects ready for cake

2006-08-26 Thread [EMAIL PROTECTED]

http://rafb.net/paste/results/ay4rme65.html

here is my work in progress
you just setup the database details for the project , and then you have
the option to remove prefixes from tablenames, or add prefixes to them,
change parts of fieldnames to _id (for example i always used
modelnameid as foreignkey field, so i set let the script replace id
by _id.  I've tested this a bit and it works to me.

the last feature is to search for fields that contains int values, ask
the user if this field contains a unix timestamp and should be
converted (this works), but the actuall conversion itself is not 100%
complete.  i figured out 2 solutions but they seem pretty ugly to me,
maybe somebody knows something more efficient (like an sql query to do
this all)
solution 1) read the whole column with the FROM_UNIXTIME directive, but
then i don't really know how i could insert all the datetimes back in
the right rows
2) read _every_ field, delete the whole table, recreate it with the
column changed, and insert all the right values.  this should work, but
it seems to me that it requires too many code for a simple operation


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: FindAll vs Query in Component

2006-08-26 Thread [EMAIL PROTECTED]

I'm not certain if this is relevant, but I use a custom query in the
model -- that is, in the association within the model. Then I use
nothing special -- that is, I use FindAll without a custom query -- in
the controller. I then have my associated fields, as expected, in the
view, though I generally have to search around in the data object to
find out how to reference them from there.

Another very useful trick is to have one or more models based on
database VIEWs rather than on ordinary tables. Cake doesn't know the
difference, just treating the view as a table, and you can create the
view from any sort of query, EXCEPT one that uses the current record's
primary key -- ie., the view can't use {$__cakeID__$}, nor can it be
induced to use {$__cakeID__$} by supplying that as as part of a query
which refers to the view. (At first I imagined the latter method would
work, something like unification in Prolog, but no dice. SQL is not
that smart.)

To create a SQL view in MySQL, you need version 5.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: search form.

2006-08-26 Thread [EMAIL PROTECTED]

John:
It is very simple:

CREATE TABLE `recipes` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(20) collate latin1_general_ci default NULL,
  `description` text collate latin1_general_ci,
  PRIMARY KEY  (`id`)
)

I want to search the recipe name: e.g chicken - will take a look at the
fulltext search and custom query. Recipes allready have an index that
prints all recipes. Can I reuse index (view) to show the search
results?

Best regards.
Asbjørn Morell.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: search form.

2006-08-26 Thread [EMAIL PROTECTED]
` = `teachers`.`id`) and
(`scheduleblocks`.`id` = `courses`.`scheduleblock_id`));

Yuck. that query is complicated, but it works nicely.

Note that the real tables being searched (courses, students, teachers,
scheduleblocks) do NOT have fulltext indexes. This allows search
strings shorter than four character (undocumented, as far as I can
tell). However, with a large table (many rows), the indexes might be
needed for speed.

For this project, most of my tables are small, although one does have
40,000+ records and the search is still very fast.

Finally, MySQL's fulltext queries are not portable to other database
engines. 

I hope this helps.

Ralph


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: FindAll vs Query in Component

2006-08-26 Thread [EMAIL PROTECTED]

One more observation.

index (of an array) != index (on a database table).
view (within Cake) != view (a synthetic database table).

These are namespace collisions in the jargon!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: search form.

2006-08-27 Thread [EMAIL PROTECTED]

I forgot to add, in reference to my earlier post with code, how cool
the search input format is with MySQL's fulltext search... with or
without indexes, except that without indexes it allows you to enter
search terms shorter than four characters:

car
finds all entries with the full word car (but won't find carport or
scar)

car*
finds all entries with a word beginning with car (or carport but
not scar)

+car +boy
finds all entries with both car and boy (say, the boy had a car)

+car -boy
finds all entries with car and without boy

+car* -boy
finds all entries with car or carport but without boy

+car* -boy*
finds all entries with car or carport but without boy or boyd

car* boy*
gives you an implicit or and thus finds all entries with car or
carport or boy or boyd

Combine the above input formats with the possibility of searching
across several fields, as in my example, and you have a powerful,
google-like capability.

Unfortunately, this method is not directly portable to other database
engines, though there may be similar equivalents elsewhere -- and one
could at some future time write code to parse the query and submit it
in the format required by other engines.

But for a quick start it's pretty impressive. I never imagined I could
get that far, that fast with fairly simple search code.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: What is the proper way to include helper functions in a model?

2006-08-27 Thread [EMAIL PROTECTED]

i think saving them in a file vendors/myfunctions.php

and then you can use the functions if you do vendor(myfunctions);


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



I need some help about models.

2006-08-27 Thread [EMAIL PROTECTED]

Okay so, I'm building a way to show my categories (rubriques) and my
articles.

Here's the model of my rubrique (categorie):
?php

class Rubrique extends AppModel
{
var $name = 'Rubrique';

//I tried this:
var $belongsTo = array('Article' =
   array('className'  = 'Article',
 'conditions' = '',
 'order'  = 'Article.id DESC',
   )
 );

}

?
I want to associate the controller Rubriques with two tables: the one
called rubriques and the one called articles.

I'll explain the system: i go to /rubriques and it shows me the
different categories of the website.
I click on one, for example Membres, so i get onto this page:
/rubriques/membres (it works with something like slugs).

On this page I want to get all the articles of this categorie (select *
from articles where slug='membres') (in mysql query) (but i dont know
how to do it with cakephp)...

Here's the Rubriques controller:
?php

class RubriquesController extends AppController
{
var $name = 'Rubriques';

function index()
{
$this-set('rubriques', $this-Rubrique-findAll());
}

function consulter($nom)
{

  $this-Rubrique-nom = $nom;
  $this-set('rubrique', $this-Rubrique-findbynom($nom));

//I'm trying to get the articles, I tried many things, but unhelpful...
  $this-Rubrique-findbycategorie($nom);


}
}

?

The view of index from Rubriques is:
div id=titre
div class=titre
div class=image
img src=/img/rubriques/rubriques.png
/div
div class=conteneur
div class=titreRubriques/div
div class=descriptionpFouillez sti!/p/div
/div
/div
/div

?php foreach ($rubriques as $rubrique): ?
div id=rubrique
div class=imageimg src=? echo
/img/rubriques/.$rubrique['Rubrique']['image']; ?/div

div class=texte
?php echo $html-link($rubrique['Rubrique']['titre'],
/rubriques/consulter/.$rubrique['Rubrique']['nom']);
echo p.$rubrique['Rubrique']['description']./p; ?
/div
/div
?php endforeach; ?

(and it works well).

But the one of consulter (that means consult) (to consult a category
(to see their articles)):
div id=titre
div class=titre
div class=image
img src=/img/rubriques/? echo 
$rubrique['Rubrique']['image'];
?
/div
div class=conteneur
div class=titre? echo 
$rubrique['Rubrique']['titre']; ?/div
div class=descriptionp? echo
$rubrique['Rubrique']['description']; ?/p/div
/div
/div
/div
Here's is supposed to be something like a foreach showing the
articles... But i dont know how...

I asked on the channel of cakephp, but peoples are a bit rough on n00b
there... :S

So If someone can help me, HELP ME... I dont want flames, only helpful
comments, thanks a lot!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: othAuth redirect problem

2006-08-28 Thread [EMAIL PROTECTED]

are you sure you are logged in when he sends you back?
did you increase the $gid and set $strict_gid_check to false in the
component's config, like the tutorial says?


A good way to check if you're logged in is to put this in a view/layout
(don't forget to load the helper)

?php
  $othAuth-init($othAuth_data);
  if ($othAuth-sessionValid()) echo okay i'm logged in;
?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



1:many association where order is important

2006-08-28 Thread [EMAIL PROTECTED]

Hey guys, i'm porting an old app to cake, but i've come across this:

i have a form where people can post their top5 of favorite songs
in the legacy database layout i had a table songs with fields id,artist
and title, and a table top5s with fields id, song1_id, song2_id,
song3_id, song4_id, song5_id

so in the form itself, you only entered the 5 artist-title pairs, they
were saved as songs and the proper links would be made. the problem is
that the order of the songs is important, so i can't just give a song a
top5_id to link the songs to the top5 (this is the usual approach),
because i need to know which song is first choice etc.  (unless i would
totally rely on the fact that the songs are saved in order, so the
lowest id would be the first choice)

i've also tried putting a hasOne in the song model, and this in the
top5 model:


var $belongsTo = array(
'Song1' =
 array('className' = 'Song',
'conditions' = '',
'order' = '',
'foreignKey' = '',
'counterCache' = ''),

'Song2' =
 array('className' = 'Song',
'conditions' = '',
'order' = '',
'foreignKey' = '',
'counterCache' = ''),

'Song3' =
 array('className' = 'Song',
'conditions' = '',
'order' = '',
'foreignKey' = '',
'counterCache' = ''),

'Song4' =
 array('className' = 'Song',
'conditions' = '',
'order' = '',
'foreignKey' = '',
'counterCache' = ''),

'Song5' =
 array('className' = 'Song',
'conditions' = '',
'order' = '',
'foreignKey' = '',
'counterCache' = ''),

but i don't know if this is the right approach

i hope someone can guide me in this, to make it working like it should,
hopefully without having to (manually) alter many records in the
database


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: image resize

2006-08-28 Thread [EMAIL PROTECTED]

Hi Khaled,
I use:
$this-DirectoryStructure-basepath = WWW_ROOT.IMAGES_URL
.$this-galleryPath;
$this-ThumbnailGenerator-thumbnailGenerator();
$images = $this-DirectoryStructure-ListDir();
$data = '';
foreach($images as $img) {
if(substr($img,0,6)=='_thmb_')
continue;

elseif($this-ThumbnailGenerator-makeThumbFile(WWW_ROOT.IMAGES_URL.$this-galleryPath.$gal.$img,WWW_ROOT.IMAGES_URL.$this-galleryPath.$gal.'_thmb_'.$img))
{
$data .= 'Ready: '.$img.'br/';
}
}

to parse thru a directory and generate thumbnails. You'll need to
download the DirectoryStructure component too.

Hope that helps!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: I need some help about models.

2006-08-28 Thread [EMAIL PROTECTED]

yeah but, I want to do this:
/rubriques/index to show all the categories
and /rubriques/cat_name to show all the articles from the category
cat_name
and /articles/read/article_title to read the article named
article_title
/articles/index would only be a message like, Choose a category!
That's what I want to do...

Thanks for your help!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



3 table join help?

2006-08-28 Thread [EMAIL PROTECTED]

Can somone show me an online example that includes a 3 table join?
Here is my join table:

car_id int
make_id int
year_id int

so this join table has an id from 3 different tables.  The only
examples I've been able to find have only 2 ids.

The name of the table is cars_makes_years.  I am unsure of what to name
the model.  Should it be cars_makes_year.php?
 

Thanks for any help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: 1:many association where order is important

2006-08-29 Thread [EMAIL PROTECTED]

okay i changed the database layout

i have now table top5s with only 1 field: id
and a table songs with id-artist-title- top5_id

relations: top5 hasmany song, song belongsto top5

but now the problem is, that the scaffolded views are not what i want.
for example top5s/add.thtml is just a page without fields (obviously),
and just a button to save a new top5d
and the view songs/add.thml is just a form to save 1 songs (which is
also logical)

but i want a form (top5s/add.thtml) that lets the user input 5 songs,
and when the form-data gets processed this should save 1 new top5, and
then the 5 songs, with the right top5_id

i got most of the view right, i think, but i don't got a clue of how to
do the controller action, i hope someone can help me with that!
here is what i have:
http://cakephp.org/pastes/show/b44148f8eed94b9472d11e28d7c717b9


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Pagination of another's model controller

2006-08-29 Thread [EMAIL PROTECTED]

Hello all,
I have a following problem.

I have two models Session and Comment and their controllers and
baked views
Session hasMany Comments

My brief question:
How to access CommentsController in SessionsController?

Why am I asking?

Some Sessions has too many comments (thousands), so that when I use
sessions/view i get a HUGE list of connected Comments.

Pagination would be a natural solution indeed... I am using Pagination
package http://cakeforge.org/snippet/detail.php?type=packageid=16

The problem is that if I use the Pagination in Session controller it
automaticaly tries to paginate Sessions (assumes wrong total count
etc.)... There is a component function startup($controller) which
could be a solution (Link the component to the controller), but thats
called automaticaly in Cake's inner logic I think. Reusing could be
solution too, but in SessionsController I dont have CommentsController
accesible.

I tried
$this-requestAction(comment/listCommentPaginated/.$currentSession[id])
but I didnt find a way how to pass parameters for pagination into this
action...

What I am doing wrong? Paginating anothers controller objects doesnt
seem so tricky to me...

Thaks for all responses!

mao, Freeride.CZ


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: url and routing

2006-08-29 Thread [EMAIL PROTECTED]

HTH
http://wiki.cakephp.org/tutorials:routing_for_multilanguage

it work's for me..and so easy ...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Optimising cake

2006-08-30 Thread [EMAIL PROTECTED]

set $recursive to 0 (if you only want stocked item)
set fields to the wanted field (StockedItem.name,StockedItem.quantity,
...)

the rest is cake's magic : look for $persistModel to understand the
number of query difference


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Pagination of another's model controller

2006-08-30 Thread [EMAIL PROTECTED]

Hmm, no responses? But this also means I cant have two paginations on
one page, which is in my opinion severe restriction... As soon as I
finish my project, i will take a look at it...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: help guys

2006-08-30 Thread [EMAIL PROTECTED]

for basic (but complex enough) introduction, take a look here:
http://manual.cakephp.org/chapter/models

There is also comlete example... Saving HABTM works great for me even
with AJAX and other tweaks. All you have to do is follow several
straightforward rules described in the manual.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



<    1   2   3   4   5   6   7   8   9   10   >