Re: Countries, States and Cities: Which relations i'm dealing with?

2010-08-24 Thread Mateo San Román
Hi

Maybe you can do this

Country  hasMany State
State hasMany  City
Country.city_id (the capital)
State.city_id   (the capital)

I would rather go for Tree behavior.

Best regards




On 5 ago, 10:43, DerBjörn  wrote:
> Hi,
>
> i have three tables: countries, states and cities.
>
> Every country has its capital city, so does every state.
> 2 relations are very obvious:
>
> state belongsTo country
> city belongs to state
>
> Now i have a problem to realize the relations referring to the capital
> cities.
> In my opinion there are two hasOne relations:
>
> state hasOne city
> country hasOne city
>
> Both tables (states and countries) has a column names city_id as
> foreign_key, but if i use two hasOnes like
>
> [code]
> var $hasOne = array(
>         'CapitalCity' => array(
>             'className' => 'City',
>             'foreignKey' => 'city_id',
>             'conditions' => '',
>             'fields' => '',
>             'order' => ''
>         )
>     );
> [/code]
>
> i get following error message:
> [quote]Warning (512): SQL Error: 1054: Unknown column
> 'CapitalCity.capitalcity_id' in 'on clause' [CORE/cake/libs/model/
> datasources/dbo_source.php, line 681][/quote]
>
> [quote]Query: SELECT COUNT(*) AS `count` FROM `countries` AS `Country`
> LEFT JOIN `cities` AS `CapitalCity` ON (`CapitalCity`.`city_id` =
> `Country`.`id`) WHERE 1 = 1 [/quote]
>
> Actually it has to be  (`CapitalCity`.`id` = `Country`.`city_id`) to
> make sense. What i did wrong?
> In a forum i asked i ve been told that to realize the capital city
> connections i have to use 2 belongsTo relations, but it doesn't make
> any sense to me.
>
> Somebody can enlight me? :)
> Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: sudo apt-get install cakephp-scripts php5-mysql

2010-08-24 Thread Daniel Samani
It says I already have it installed and is on latest version.

On 25 Aug, 03:37, Steve Love  wrote:
> > sudo apt-get install cakephp-scripts php5-mysql
> > Haven't I already installed php? Any ideas?
>
> Not necessarily. When you installed php5-mysql, you only installed the
> MySQL package for PHP.
>
> What happens when you run the following command?
> sudo apt-get install php5 libapache2-mod-php5
>
> Steve
>
> On Aug 24, 6:19 pm, Daniel Samani  wrote:
>
>
>
> > So i do the following
>
> > sudo apt-get install cakephp-scripts php5-mysql
>
> > mysql (make databases and tables i want)
>
> > sudo cake bake -app /var/www/weblog (and bake the app)
>
> > Now when i visit 127.0.0.1/weblog i download a file instead of showing
> > it
>
> > Haven't I already installed php? Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Relationships

2010-08-24 Thread Philip Thompson
On Aug 24, 2010, at 6:03 PM, cricket wrote:

> On Tue, Aug 24, 2010 at 2:31 PM, Philip Thompson  
> wrote:
>> Hi all.
>> 
>> Sorry for all these newb questions... trying to learn this stuff. Here's the 
>> relationships and tables I have:
>> 
>> Relationships:
>> Hardware HABTM Configuration
>> Configuration belongsTo ConfigurationType
>> 
>> Tables:
>> configurations
>>- configuration_type_id
>> configurations_hardwares
>>- configuration_id
>>- hardware_id
>> configuration_types
>> hardwares
>> 
>> When pulling the information for a specific Hardware record, I'm 
>> successfully getting the Configurations associated with it, but I'm not 
>> getting the information from the configuration_types table. How do I get 
>> info from this other table?
>> 
>> > $options['conditions'] = array('Hardware.id'=>$id);
>> $this->Hardware->find('first', $options);
>> ?>
>> 
>> produces...
>> 
>> Array
>> (
>>[Hardware] => Array
>>(
>>[id] => 3
>>[hardware_type_id] => 2
>>[name] => w-irv-win7dev
>>[description] => Philip Thompson's Windows 7 machine
>>[location_id] => 1
>>)
>> 
>>[Configuration] => Array
>>(
>>[0] => Array
>>(
>>[id] => 1
>>[configuration_type_id] => 1
>>[configuration] => Windows 7 Professional
>>[description] =>
>>[ConfigurationsHardware] => Array
>>(
>>[id] => 1
>>[configuration_id] => 1
>>[hardware_id] => 3
>>)
>>)
>> 
>>[1] => Array
>>(
>>[id] => 3
>>[configuration_type_id] => 5
>>[configuration] => Yes
>>[description] =>
>>[ConfigurationsHardware] => Array
>>(
>>[id] => 2
>>[configuration_id] => 3
>>[hardware_id] => 3
>>)
>>)
>>)
>> )
>> 
>> I get the configuration_type_id result, but I want other fields from 
>> configuration_type. Any help would be greatly appreciated on how to 
>> accomplish this!
>> 
> 
> You need to increase the "recursive" value:
> 
> $options['recursive'] = 2;
> 
> I recommend you take a look at ContainableBehavior, though. It gives
> one much more control (recursive == 2 can fetch too much data).

Excellent! Thanks for your help. It worked!

~Philip

http://lonestarlightandsound.com/

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: sudo apt-get install cakephp-scripts php5-mysql

2010-08-24 Thread Daniel Samani
ogoinfo(); works. I don't really understand what you mean by php mod.
I run sudo a2enmod php5 and get 'Module php5 already enabled' as
feedback. So i guess it's enabled. Thanks for helping me out.

On 25 Aug, 03:09, cricket  wrote:
> On Tue, Aug 24, 2010 at 8:19 PM, Daniel Samani  
> wrote:
> > So i do the following
>
> > sudo apt-get install cakephp-scripts php5-mysql
>
> > mysql (make databases and tables i want)
>
> > sudo cake bake -app /var/www/weblog (and bake the app)
>
> > Now when i visit 127.0.0.1/weblog i download a file instead of showing
> > it
>
> > Haven't I already installed php? Any ideas?
>
> I presume that installing php5-mysql would also pull in the PHP libs
> if they're not already installed but I can't say I've ever tried.
> Perhaps you should begin with a *plain* PHP script, then move to Cake.
>
>  echo 'hello world';
> ?>
>
> Better:
>  phpinfo();
> ?>
>
> Name that info.php and see if it works.
>
> Does this show the php mod?
> ls /etc/apache2/mods-enabled/
>
> If not,
> sudo a2enmod php5
> sudo /etc/init.d/apache2 reload

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: sudo apt-get install cakephp-scripts php5-mysql

2010-08-24 Thread Steve Love
> sudo apt-get install cakephp-scripts php5-mysql
> Haven't I already installed php? Any ideas?

Not necessarily. When you installed php5-mysql, you only installed the
MySQL package for PHP.

What happens when you run the following command?
sudo apt-get install php5 libapache2-mod-php5

Steve

On Aug 24, 6:19 pm, Daniel Samani  wrote:
> So i do the following
>
> sudo apt-get install cakephp-scripts php5-mysql
>
> mysql (make databases and tables i want)
>
> sudo cake bake -app /var/www/weblog (and bake the app)
>
> Now when i visit 127.0.0.1/weblog i download a file instead of showing
> it
>
> Haven't I already installed php? Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Online Documentation

2010-08-24 Thread Michael Gaiser
Hey guys, I know that Cake has a great online set of documentation, but the
only time I really have to work on my project is on the train which
unfortunately does not have internet access. Is there a copy of the online
docs anywhere or do you know of a program that can crawl the
cakephp.orgsite and download a local copy of the docs? Thanks in
advance.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Landing Page Optimization

2010-08-24 Thread Dr. Loboto
Check what you need in controller (cookies?) and render different view/
layout instead of default auto-render.

On Aug 24, 8:45 am, EMR  wrote:
> Hi Guys,
>
> I am completely new to CakePHP and am looking to do some landing page
> optimization (A/B Testing) using Google's Landing Page optimizer. I
> know this is a complete amateur question but can anyone walk me
> through how to set up the different landing pages such that google
> will recognize them? Has anyone gone through using G Landing Page
> Optimizer and can offer tips/point me in the right direction? Right
> now I have a custom layout that I would like to keep for the site but
> not use for my landing page.
>
> Thanks in advance for the help, it is much appreciated.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: sudo apt-get install cakephp-scripts php5-mysql

2010-08-24 Thread cricket
On Tue, Aug 24, 2010 at 8:19 PM, Daniel Samani  wrote:
> So i do the following
>
> sudo apt-get install cakephp-scripts php5-mysql
>
> mysql (make databases and tables i want)
>
> sudo cake bake -app /var/www/weblog (and bake the app)
>
> Now when i visit 127.0.0.1/weblog i download a file instead of showing
> it
>
> Haven't I already installed php? Any ideas?

I presume that installing php5-mysql would also pull in the PHP libs
if they're not already installed but I can't say I've ever tried.
Perhaps you should begin with a *plain* PHP script, then move to Cake.



Better:


Name that info.php and see if it works.

Does this show the php mod?
ls /etc/apache2/mods-enabled/

If not,
sudo a2enmod php5
sudo /etc/init.d/apache2 reload

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Countries, States and Cities: Which relations i'm dealing with?

2010-08-24 Thread cricket
On Tue, Aug 24, 2010 at 7:57 PM, DerBjörn  wrote:
> Thanks j,
>
> for your example and your suggestions.
> I think I will go with the tinyint. What about the idea to use
> is_state_capital and is_capital? Wouldnt this solve the problem?

This looks like it's getting really complicated for nothing. These
tinyint columns seem like a bad hack. As I mentioned earlier, you can
do this simply with virtual models, NationalCapital and StateCapital.
Each would use classname City.


> Can a city be capital of a country and not of its state? I dont think
> so. Can it? cause then one tinyint with 1 as state capital and 2 as
> capital of country would be enough. and an unique key(state_id,
> is_capital)...


Of course it can. Ottawa is a good example. Toronto is the Ontario
provincial capital.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


sudo apt-get install cakephp-scripts php5-mysql

2010-08-24 Thread Daniel Samani
So i do the following

sudo apt-get install cakephp-scripts php5-mysql

mysql (make databases and tables i want)

sudo cake bake -app /var/www/weblog (and bake the app)

Now when i visit 127.0.0.1/weblog i download a file instead of showing
it

Haven't I already installed php? Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Countries, States and Cities: Which relations i'm dealing with?

2010-08-24 Thread DerBjörn
Thanks j,

for your example and your suggestions.
I think I will go with the tinyint. What about the idea to use
is_state_capital and is_capital? Wouldnt this solve the problem?
I am still thinking how to work in my database with an unique key to
get sure that duplicate capitals for one state or country are not
allowed.
The check in the model as you say is a good idea but i prefer to avoid
duplicates with both sides :)
Unique key with state_id and is_capital? For a country that doesnt has
states i could use instead a "fake state" named like the country if i
dont go with the region... Israel -> Isreal -> Tel Aviv.

Can a city be capital of a country and not of its state? I dont think
so. Can it? cause then one tinyint with 1 as state capital and 2 as
capital of country would be enough. and an unique key(state_id,
is_capital)...

Questions over questions :) ... to spin the wheel...

On 24 Aug., 13:44, "j.blotus"  wrote:
> I don't use capitals, but as has been said before, you could create a
> field oncities
>
> TINYINT(1) is_capital
>
> it would be a simple 0 for not capital, 1 for capital
>
> My model works well for USA.
> EX.
>
> North America (Zone) ->
> United States (Country) ->
> Florida (State) ->
> North Florida (Region) ->
> Tallahassee (City) and it could be capital since it is state capital
>
> For othercountriesStates/Regions become a bit difficult so you might
> have something like this:
> Middle East (Zone) ->
> Israel (Country) ->
> Tel Aviv (City) and is_capital = 1
>
> So in that case you may not have a state or region.
>
> The important thing in your city model is that region_id and state_id
> can be null, because somecountrieswont be set up that way.
> But allcitieswill have at least a zone and a country. You might not
> even use zone if you dont have a need for organizing it.
>
> As far as preventing duplicate capitals, you can create a validation
> rule in your City model that checks to see if a capital already
> exists, and prevent save if one does.
>
> Hope this helps get your wheels spinning a bit.
>
> On Aug 24, 8:40 am, DerBjörn  wrote:
>
> > Hi J.Blotus,
>
> > City belongsTo State, cause a state as manycities. Thats right.
> > First i had State/City hasOne City/State to realize a state capital,
> > but i have been told that hasOne doesn't work here and i have to use
> > belongsTo instead...
> > I always was with doubts about it, but i read this suggestion not only
> > in this group...
>
> > I am very interested in your region app. It does make sense of course,
> > but you are able to realize capitals with it? A city has to be able to
> > be a capital of a state or a country. How do you manage it? How look
> > your tables?
>
> > Thanks
>
> > On 23 Aug., 20:15, "j.blotus"  wrote:
>
> > > How does State belongTo City? Isn't it the other way around? Same with
> > > Country.
>
> > > On my region based apps I use the following
>
> > > Zone hasMany Country, State, Region, City
> > > Country hasMany  State, Region, City
> > > State hasMany Region, City
> > > Region hasMany City
>
> > > Country belongsTo Zone
> > > State belongsTo Zone, Country
> > > Region belongsTo Zone, Country, State
> > > City belongsTo Zone, Country, State, Region
>
> > > Zone is North America, South America, Asia, Etc
>
> > > On Aug 18, 5:17 pm, DerBjörn  wrote:
>
> > > > Thanks, Dan!
>
> > > > After I rebaked my models with following relations:
>
> > > > City belongsTo State
>
> > > > State belongsTo Country
> > > > State belongsTo City
> > > > State hasMany City
>
> > > > Country belongsTo City
> > > > Country hasMany State
>
> > > > and updated my views, finally i got a "result"...
> > > > Your advice with "containable" i haven't follow till now.
>
> > > > I still have one problem that maybe i am able to solve with cricket's
> > > > advice of using virtual models!?!
> > > > When i want to add p.e. a new country or a new state, their comboboxes
> > > > for capital city are empty, so i cannot choose its capital city. How
> > > > do I solve this problem?
> > > > Thanks a lot :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Intercept each request

2010-08-24 Thread cricket
On Tue, Aug 24, 2010 at 6:40 PM, sanedevil  wrote:
> hi all,
>
> Is there a way in cake to intercept every request, check if the
> request is from a  logged in user and then direct him/her accordingly?

That's precisely what the AuthComponent does.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cake Translate Behavior

2010-08-24 Thread cricket
On Tue, Aug 24, 2010 at 9:48 AM, sujandhakal  wrote:
> I'm implementing a cms with multilingual content. i wan to implement
> Translate behavior to the model. Actually I've implemented some of the
> code but its not what i want.
>
> This is my Post Model
>
>  class Post extends AppModel {
>        var $name = 'Post';
>        var $displayField = 'title';
>
>        var $actsAs = array('Translate'=>array(
>                'title','description'
>        ));
>
> }
> ?>
>
> I want to make a translate link at index view with (Edit , View,
> Delete ) link like
>  [ Edit | View | Delete | Translate (en | de | np) ]
> on clicking any of those translate link it will lead to a page where i
> can translate the model's content.Please could u make any suggestion.


routes.php:

Router::connect(
'/admin/posts/translate/:id/:lang',
array(
'controller' => 'posts',
'action' => 'translate',
'admin' => 1
),
'id' => '[0-9]+',
'lang' => '[a-z]{2}',
'pass' => array('id', 'lang')
);

posts_controller:

public function admin_translate($id, $lang)
{
if (empty($this->data))
{
$this->data = $this->Post->read(null, $id);
$this->set(compact($lang));
}
else
{
...
}
}


view:

echo $html->link(
'en',
array(
'controller' => 'posts',
'action' => 'translate',
'id' => $data['Post']['id'],
'lang' => 'en'
),
array('title' => 'translate to english')
);

You'll need to pass the id in whatever way you have it available. I've
used a view var, $data, in this case. Leave the admin stuff out if
this isn't supposed to be restricted.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Relationships

2010-08-24 Thread cricket
On Tue, Aug 24, 2010 at 2:31 PM, Philip Thompson  wrote:
> Hi all.
>
> Sorry for all these newb questions... trying to learn this stuff. Here's the 
> relationships and tables I have:
>
> Relationships:
> Hardware HABTM Configuration
> Configuration belongsTo ConfigurationType
>
> Tables:
> configurations
>    - configuration_type_id
> configurations_hardwares
>    - configuration_id
>    - hardware_id
> configuration_types
> hardwares
>
> When pulling the information for a specific Hardware record, I'm successfully 
> getting the Configurations associated with it, but I'm not getting the 
> information from the configuration_types table. How do I get info from this 
> other table?
>
>  $options['conditions'] = array('Hardware.id'=>$id);
> $this->Hardware->find('first', $options);
> ?>
>
> produces...
>
> Array
> (
>    [Hardware] => Array
>        (
>            [id] => 3
>            [hardware_type_id] => 2
>            [name] => w-irv-win7dev
>            [description] => Philip Thompson's Windows 7 machine
>            [location_id] => 1
>        )
>
>    [Configuration] => Array
>        (
>            [0] => Array
>                (
>                    [id] => 1
>                    [configuration_type_id] => 1
>                    [configuration] => Windows 7 Professional
>                    [description] =>
>                    [ConfigurationsHardware] => Array
>                        (
>                            [id] => 1
>                            [configuration_id] => 1
>                            [hardware_id] => 3
>                        )
>                )
>
>            [1] => Array
>                (
>                    [id] => 3
>                    [configuration_type_id] => 5
>                    [configuration] => Yes
>                    [description] =>
>                    [ConfigurationsHardware] => Array
>                        (
>                            [id] => 2
>                            [configuration_id] => 3
>                            [hardware_id] => 3
>                        )
>                )
>        )
> )
>
> I get the configuration_type_id result, but I want other fields from 
> configuration_type. Any help would be greatly appreciated on how to 
> accomplish this!
>

You need to increase the "recursive" value:

$options['recursive'] = 2;

I recommend you take a look at ContainableBehavior, though. It gives
one much more control (recursive == 2 can fetch too much data).

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakeNewb: Models joint where one has 2 Foreign Keys

2010-08-24 Thread jamie_chong
Anthony, Thanks a lot! That's what I needed and now I've got it all
figured out :)

On Aug 22, 10:52 am, Anthony  wrote:
> You'll probably want to use containable.
>
> Check out:http://book.cakephp.org/view/474/Containable -Specifically
> the section on deeper associations.
>
> On Aug 21, 12:41 am, jamie_chong  wrote:
>
> > This is my second day using/learning Cake so please bear with me :)
>
> > I'll try to keep things simple, but there is a lot of data here. I
> > didnt' want to leave anything out.
>
> > Let's say I have these database tables:
>
> > my_lists (id, name)
> > (1, "List One")
> > (2, "List Two")
>
> > items(id, name)
> > (1, "Item One")
> > (2, "Item Two")
> > (3, "Item Three")
> > (4, "Item Four")
>
> > items_my_lists(item_id, my_list_id)
> > (2, 1)
> > (3, 1)
> > (4, 1)
> > (3, 2)
> > (4, 2)
>
> > my_comments(id, my_list_id, item_id, message)
> > (1, 1, NULL, "Comment For List One")
> > (2, NULL, 4, "Comment For Item Four")
> > (3, 1, 4, "Comment for List One, Item Four")
> > (4, 2, 4, "Comment for List Two, Item Four")
>
> > My Models look like this:
>
> > class List extends AppModel
> > {
> >         public $name = "List";
> >         public $hasAndBelongsToMany = "Item";
> >         public $hasMany = "Comment";
>
> > }
>
> > class Item extends AppModel
> > {
> >         public $name = "Item";
> >         public $hasAndBelongsToMany = "List";
> >         public $hasMany = "Comment";
>
> > }
>
> > class Comment extends AppModel
> > {
> >         public $name = "Comment";
>
> > }
>
> > Notice my_comments has Two Foreign Keys (my_list_id, item_id). This is
> > so I can have comments specifically for
> > 1. my_lists (item_id is NULL)
> > 2. items (my_list_id is NULL)
> > 3. items in my_lists (both my_list_id and item_id are set)
>
> > Here is my problem. For each of the two queries (shown below), I only
> > want comments to be returned for Items if and only if they match the
> > item_id AND the list_id. Right now I'm getting Comments that belong to
> > other lists. Furthermore, I don't want comments for Items if either
> > list_id or item_id are NULL. And lastly, comments for MyList should
> > only appear if item_id is NULL.
>
> > Now when I run a find() search in my Controller, I get for "List One":
>
> > $this->MyList->find("first",array(
> >         "conditions"=>array("MyList.id"=>1),
> >         "recursive" => 2
> > ));
>
> > Array
> > (
> >     [MyList] => Array
> >     (
> >         [id] => 1
> >         [name] => List One
> >     )
>
> >     [MyComment] => Array
> >     (
> >         [0] => Array
> >         (
> >             [id] => 1
> >             [my_list_id] => 1
> >             [item_id] =>
> >             [message] => Comment List One
> >         )
>
> >         [1] => Array
> >         (
> >             [id] => 3
> >             [my_list_id] => 1
> >             [item_id] => 4
> >             [message] => Comment List One, Item Four
> >         )
>
> >     )
>
> >     [Item] => Array
> >     (
> >         [0] => Array
> >         (
> >             [id] => 2
> >             [name] => Item Two
> >             [MyComment] => Array
> >             (
> >             )
>
> >         )
>
> >         [1] => Array
> >         (
> >             [id] => 3
> >             [name] => Item Three
> >             [MyComment] => Array
> >             (
> >             )
>
> >         )
>
> >         [2] => Array
> >         (
> >             [id] => 4
> >             [name] => Item Four
> >             [MyComment] => Array
> >             (
> >                 [0] => Array
> >                 (
> >                     [id] => 2
> >                     [my_list_id] =>
> >                     [item_id] => 4
> >                     [message] => Comment Item Four
> >                 )
>
> >                 [1] => Array
> >                 (
> >                     [id] => 3
> >                     [my_list_id] => 1
> >                     [item_id] => 4
> >                     [message] => Comment List One, Item Four
> >                 )
>
> >                 [2] => Array
> >                 (
> >                     [id] => 4
> >                     [my_list_id] => 2
> >                     [item_id] => 4
> >                     [message] => Comment List Two, Item Four
> >                 )
>
> >             )
>
> >         )
>
> >     )
>
> > )
>
> > And this is what I get for List Two
> > $this->MyList->find("first",array(
> >         "conditions"=>array("MyList.id"=>2),
> >         "recursive" => 2
> > ));
>
> > Array
> > (
> >     [MyList] => Array
> >     (
> >         [id] => 2
> >         [name] => List Two
> >     )
>
> >     [MyComment] => Array
> >     (
> >         [0] => Array
> >         (
> >             [id] => 4
> >             [my_list_id] => 2
> >             [item_id] => 4
> >             [message] => Comment List Two, Item Four
> >         )
>
> >     )
>
> >     [Item] => Array
> >     (
> >         [0] => Array
> >         (
> >             [id] => 3
> >             [name]

Intercept each request

2010-08-24 Thread sanedevil
hi all,

Is there a way in cake to intercept every request, check if the
request is from a  logged in user and then direct him/her accordingly?

Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Full support for PHP 5.3

2010-08-24 Thread Miles J
I run my Cake 1.3 install on a PHP 5.3 machine. There's no reason you
cant benefit from the speed/improvements of 5.3.

The only difference is Cake is not using namespaces. Cake would
require a huge rewrite if namespaces were added.

On Aug 24, 2:05 pm, Graham Weldon  wrote:
> You can take advantage of PHP 5.3 features right now.
> CakePHP supports PHP 4+ at the moment and that includes the current 5.3 and 
> above.
>
> The fact that the core is not using 5.3 specific features does not restrict 
> users from using these features in userland code.
>
> CakePHP 2.0 is initially being targeted for PHP 5.2 and again, will allow use 
> of PHP 5.3 code for users if your install is on PHP 5.3.
>
> We are moving the core forward as PHP progresses, however we are beige wary 
> not to leave users behind that can't run PHP 5.3 yet, or are still making the 
> transition.
>
> Cheers
> Graham Weldon
> (AKA: predominant)
>
> On 25/08/2010, at 5:31 AM, Zippoxer  wrote:
>
> > I heard CakePHP 2.0 will support PHP 5.2 and up..
> > So it means it won't use the new features I mentioned :\
>
> > On Aug 24, 10:29 pm, "j.blotus"  wrote:
> >> in cakephp version 2
>
> >> version 1 will be the last to support php4
>
> >> On Aug 24, 2:13 pm, Zippoxer  wrote:
>
> >>> PHP 5.3 has lots of new features like namespaces, annonymous
> >>> functions... And performance is much better than old versions.
> >>> Can you see CakePHP supporting PHP 5.3 in the near future?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Full support for PHP 5.3

2010-08-24 Thread Graham Weldon
You can take advantage of PHP 5.3 features right now. 
CakePHP supports PHP 4+ at the moment and that includes the current 5.3 and 
above. 

The fact that the core is not using 5.3 specific features does not restrict 
users from using these features in userland code. 

CakePHP 2.0 is initially being targeted for PHP 5.2 and again, will allow use 
of PHP 5.3 code for users if your install is on PHP 5.3. 

We are moving the core forward as PHP progresses, however we are beige wary not 
to leave users behind that can't run PHP 5.3 yet, or are still making the 
transition. 

Cheers
Graham Weldon 
(AKA: predominant)

On 25/08/2010, at 5:31 AM, Zippoxer  wrote:

> I heard CakePHP 2.0 will support PHP 5.2 and up..
> So it means it won't use the new features I mentioned :\
> 
> On Aug 24, 10:29 pm, "j.blotus"  wrote:
>> in cakephp version 2
>> 
>> version 1 will be the last to support php4
>> 
>> On Aug 24, 2:13 pm, Zippoxer  wrote:
>> 
>> 
>> 
>>> PHP 5.3 has lots of new features like namespaces, annonymous
>>> functions... And performance is much better than old versions.
>>> Can you see CakePHP supporting PHP 5.3 in the near future?
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP 1.3 setup on Ubuntu

2010-08-24 Thread Marek Sebera
And once more,

some tuts say that, in .htaccess, must be var RewriteBase, to get it
work.
That's when your .htaccess files are present.


On 24 srp, 18:22, david  wrote:
> First, let me say I have CakePHP up and running perfectly on windows
> with a wampserver instance running, so I'm familiar with the process.
> I know how to get mod_rewrite setup, and set the permissions
> appropriately, etc.
>
> So, I just installed Ubuntu server 10.04 / Apache 2 / MySQL / PHP, and
> I'm now trying to get CakePHP setup. I've seen plenty of posts
> outlining getting setup on Ubuntu, because the debian arrangement of
> Apache config files can be confusing to those not familiar with it.
> I've used Debian for a long time, so I'm good on that front.
>
> Basically, my problem is the 404 error for cake.generic.css and
> cake.power.gif, which everyone says is caused by a mod_rewrite
> problem. I have tested mod_rewrite separately and it works fine, so I
> know it's running and working.
>
> I've tried the following in my sites-enabled (basically a snippet of
> what would be part of httpd.conf on most other systems):
>
>         DocumentRoot /var/www/cakephp
>         
>                 Options FollowSymLinks
>                 AllowOverride All
>                 allow from all
>         
>         
>                 Options Indexes FollowSymLinks MultiViews
>                 AllowOverride All
>                 Order allow,deny
>                 allow from all
>         
>
> I've changed the directories to /var/www; I've recursively changed the
> owner of /var/www to www-data and set permissions to 755, and
> recursively set 777 to app/tmp.
>
> I'm a bit stumped and have no idea why it's not working. Any thoughts?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP 1.3 setup on Ubuntu

2010-08-24 Thread Marek Sebera
Are files .htaccess placed in root,app and app/webroot ?


On 24 srp, 18:22, david  wrote:
> First, let me say I have CakePHP up and running perfectly on windows
> with a wampserver instance running, so I'm familiar with the process.
> I know how to get mod_rewrite setup, and set the permissions
> appropriately, etc.
>
> So, I just installed Ubuntu server 10.04 / Apache 2 / MySQL / PHP, and
> I'm now trying to get CakePHP setup. I've seen plenty of posts
> outlining getting setup on Ubuntu, because the debian arrangement of
> Apache config files can be confusing to those not familiar with it.
> I've used Debian for a long time, so I'm good on that front.
>
> Basically, my problem is the 404 error for cake.generic.css and
> cake.power.gif, which everyone says is caused by a mod_rewrite
> problem. I have tested mod_rewrite separately and it works fine, so I
> know it's running and working.
>
> I've tried the following in my sites-enabled (basically a snippet of
> what would be part of httpd.conf on most other systems):
>
>         DocumentRoot /var/www/cakephp
>         
>                 Options FollowSymLinks
>                 AllowOverride All
>                 allow from all
>         
>         
>                 Options Indexes FollowSymLinks MultiViews
>                 AllowOverride All
>                 Order allow,deny
>                 allow from all
>         
>
> I've changed the directories to /var/www; I've recursively changed the
> owner of /var/www to www-data and set permissions to 755, and
> recursively set 777 to app/tmp.
>
> I'm a bit stumped and have no idea why it's not working. Any thoughts?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Full support for PHP 5.3

2010-08-24 Thread j.blotus
you can always try lithium

On Aug 24, 3:31 pm, Zippoxer  wrote:
> I heard CakePHP 2.0 will support PHP 5.2 and up..
> So it means it won't use the new features I mentioned :\
>
> On Aug 24, 10:29 pm, "j.blotus"  wrote:
>
>
>
> > in cakephp version 2
>
> > version 1 will be the last to support php4
>
> > On Aug 24, 2:13 pm, Zippoxer  wrote:
>
> > > PHP 5.3 has lots of new features like namespaces, annonymous
> > > functions... And performance is much better than old versions.
> > > Can you see CakePHP supporting PHP 5.3 in the near future?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Lots of cakephp warnings in the log

2010-08-24 Thread Jeremy Burns | Class Outfit
I'd guess that model->query is your culprit. If it were me I'd want to find out 
what's awry because I'd need to know the impact and fix it.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 24 Aug 2010, at 20:49, Thunderstriker wrote:

> there are no errors poping up when debug set to 2 and everiting is
> working fine
> i am only using the model->find() and model->query() functions
> 
> On 24 aug, 21:26, "j.blotus"  wrote:
>> is there a reason you are running those ms sql functions directly
>> instead of using model->find() etc?
>> 
>> On Aug 24, 9:41 am, Thunderstriker  wrote:
>> 
>>> i get a lot of warnings in my logs like:
>>> 2010-08-24 09:34:01 Warning: Warning (2): mssql_num_rows(): supplied
>>> argument is not a valid MS SQL-result resource in [C:\xampp\htdocs\cake
>>> \libs\model\datasources\dbo\dbo_mssql.php, line 468]
>>> 2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
>>> supplied argument is not a valid MS SQL-result resource in [C:\xampp
>>> \htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]
>>> 2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
>>> supplied argument is not a valid MS SQL-result resource in [C:\xampp
>>> \htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]
>> 
>>> these warnings just overun my log files and make them almost useless.
>>> i looked up the lines and they used the @ sign to suppress these
>>> errors like:
>>> @mssql_free_result($this->results);
>> 
>>> and still the show up in my log is there anyway to really suppress
>>> them without changing the cake code?
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Lots of cakephp warnings in the log

2010-08-24 Thread Thunderstriker
there are no errors poping up when debug set to 2 and everiting is
working fine
i am only using the model->find() and model->query() functions

On 24 aug, 21:26, "j.blotus"  wrote:
> is there a reason you are running those ms sql functions directly
> instead of using model->find() etc?
>
> On Aug 24, 9:41 am, Thunderstriker  wrote:
>
> > i get a lot of warnings in my logs like:
> > 2010-08-24 09:34:01 Warning: Warning (2): mssql_num_rows(): supplied
> > argument is not a valid MS SQL-result resource in [C:\xampp\htdocs\cake
> > \libs\model\datasources\dbo\dbo_mssql.php, line 468]
> > 2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
> > supplied argument is not a valid MS SQL-result resource in [C:\xampp
> > \htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]
> > 2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
> > supplied argument is not a valid MS SQL-result resource in [C:\xampp
> > \htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]
>
> > these warnings just overun my log files and make them almost useless.
> > i looked up the lines and they used the @ sign to suppress these
> > errors like:
> > @mssql_free_result($this->results);
>
> > and still the show up in my log is there anyway to really suppress
> > them without changing the cake code?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problem loading intermediate model

2010-08-24 Thread Sam
rename questions_users.php to questions_user.php.

On Aug 24, 2:28 pm, "j.blotus"  wrote:
> please dump the contents of your model file, and the name of the file
> for us
>
> On Aug 24, 2:17 pm, Hugo M  wrote:
>
>
>
> > No, I don't get missing table error :S. Table exists (questions_users). You
> > can work with your model without creating a model file thanks to Cake
> > automagic. But if the file is created, Cake loads the model from the file.
> > Well... that is not working for me (with this model) :(
>
> > 2010/8/24 j.blotus 
>
> > > Do you get a missing table error?
>
> > > Often these errors can be caused by incorrect file naming or class
> > > naming.
>
> > > On Aug 24, 12:03 pm, Hugo M  wrote:
> > > > I have a model QuestionsUser that has some relationships (belongsTo 
> > > > user,
> > > > question and answer). The problem is that is not loading my
> > > questions_users
> > > > model and I haven't the relationships :S.
>
> > > > I put a die in questions_users.php and is not loading the file :S.
>
> > > > I'm doing a $uses = array(bla bla, 'QuestionsUser') in my
> > > users_controller.
> > > > I'm calling the find method in app_controller.
>
> > > > If you have any idea of why this is not working... I'm desperated :S
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.comFor
> > >  more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Full support for PHP 5.3

2010-08-24 Thread Zippoxer
I heard CakePHP 2.0 will support PHP 5.2 and up..
So it means it won't use the new features I mentioned :\

On Aug 24, 10:29 pm, "j.blotus"  wrote:
> in cakephp version 2
>
> version 1 will be the last to support php4
>
> On Aug 24, 2:13 pm, Zippoxer  wrote:
>
>
>
> > PHP 5.3 has lots of new features like namespaces, annonymous
> > functions... And performance is much better than old versions.
> > Can you see CakePHP supporting PHP 5.3 in the near future?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Full support for PHP 5.3

2010-08-24 Thread j.blotus
in cakephp version 2

version 1 will be the last to support php4

On Aug 24, 2:13 pm, Zippoxer  wrote:
> PHP 5.3 has lots of new features like namespaces, annonymous
> functions... And performance is much better than old versions.
> Can you see CakePHP supporting PHP 5.3 in the near future?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problem loading intermediate model

2010-08-24 Thread j.blotus
please dump the contents of your model file, and the name of the file
for us

On Aug 24, 2:17 pm, Hugo M  wrote:
> No, I don't get missing table error :S. Table exists (questions_users). You
> can work with your model without creating a model file thanks to Cake
> automagic. But if the file is created, Cake loads the model from the file.
> Well... that is not working for me (with this model) :(
>
> 2010/8/24 j.blotus 
>
>
>
> > Do you get a missing table error?
>
> > Often these errors can be caused by incorrect file naming or class
> > naming.
>
> > On Aug 24, 12:03 pm, Hugo M  wrote:
> > > I have a model QuestionsUser that has some relationships (belongsTo user,
> > > question and answer). The problem is that is not loading my
> > questions_users
> > > model and I haven't the relationships :S.
>
> > > I put a die in questions_users.php and is not loading the file :S.
>
> > > I'm doing a $uses = array(bla bla, 'QuestionsUser') in my
> > users_controller.
> > > I'm calling the find method in app_controller.
>
> > > If you have any idea of why this is not working... I'm desperated :S
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Lots of cakephp warnings in the log

2010-08-24 Thread j.blotus
is there a reason you are running those ms sql functions directly
instead of using model->find() etc?

On Aug 24, 9:41 am, Thunderstriker  wrote:
> i get a lot of warnings in my logs like:
> 2010-08-24 09:34:01 Warning: Warning (2): mssql_num_rows(): supplied
> argument is not a valid MS SQL-result resource in [C:\xampp\htdocs\cake
> \libs\model\datasources\dbo\dbo_mssql.php, line 468]
> 2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
> supplied argument is not a valid MS SQL-result resource in [C:\xampp
> \htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]
> 2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
> supplied argument is not a valid MS SQL-result resource in [C:\xampp
> \htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]
>
> these warnings just overun my log files and make them almost useless.
> i looked up the lines and they used the @ sign to suppress these
> errors like:
> @mssql_free_result($this->results);
>
> and still the show up in my log is there anyway to really suppress
> them without changing the cake code?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Lots of cakephp warnings in the log

2010-08-24 Thread Jeremy Burns | Class Outfit
Rather than trying to mask them, are you certain there isn't a genuine error 
going on somewhere? Does having debug set to 2 throw anything up?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 24 Aug 2010, at 14:41, Thunderstriker wrote:

> i get a lot of warnings in my logs like:
> 2010-08-24 09:34:01 Warning: Warning (2): mssql_num_rows(): supplied
> argument is not a valid MS SQL-result resource in [C:\xampp\htdocs\cake
> \libs\model\datasources\dbo\dbo_mssql.php, line 468]
> 2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
> supplied argument is not a valid MS SQL-result resource in [C:\xampp
> \htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]
> 2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
> supplied argument is not a valid MS SQL-result resource in [C:\xampp
> \htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]
> 
> these warnings just overun my log files and make them almost useless.
> i looked up the lines and they used the @ sign to suppress these
> errors like:
> @mssql_free_result($this->results);
> 
> and still the show up in my log is there anyway to really suppress
> them without changing the cake code?
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


CakePHP 1.3 setup on Ubuntu

2010-08-24 Thread david
First, let me say I have CakePHP up and running perfectly on windows
with a wampserver instance running, so I'm familiar with the process.
I know how to get mod_rewrite setup, and set the permissions
appropriately, etc.

So, I just installed Ubuntu server 10.04 / Apache 2 / MySQL / PHP, and
I'm now trying to get CakePHP setup. I've seen plenty of posts
outlining getting setup on Ubuntu, because the debian arrangement of
Apache config files can be confusing to those not familiar with it.
I've used Debian for a long time, so I'm good on that front.

Basically, my problem is the 404 error for cake.generic.css and
cake.power.gif, which everyone says is caused by a mod_rewrite
problem. I have tested mod_rewrite separately and it works fine, so I
know it's running and working.

I've tried the following in my sites-enabled (basically a snippet of
what would be part of httpd.conf on most other systems):


DocumentRoot /var/www/cakephp

Options FollowSymLinks
AllowOverride All
allow from all


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all



I've changed the directories to /var/www; I've recursively changed the
owner of /var/www to www-data and set permissions to 755, and
recursively set 777 to app/tmp.

I'm a bit stumped and have no idea why it's not working. Any thoughts?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Cake Translate Behavior

2010-08-24 Thread sujandhakal
I'm implementing a cms with multilingual content. i wan to implement
Translate behavior to the model. Actually I've implemented some of the
code but its not what i want.

This is my Post Model

array(
'title','description'
));

}
?>

I want to make a translate link at index view with (Edit , View,
Delete ) link like
 [ Edit | View | Delete | Translate (en | de | np) ]
on clicking any of those translate link it will lead to a page where i
can translate the model's content.Please could u make any suggestion.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Relationships

2010-08-24 Thread Philip Thompson
Hi all.

Sorry for all these newb questions... trying to learn this stuff. Here's the 
relationships and tables I have:

Relationships:
Hardware HABTM Configuration
Configuration belongsTo ConfigurationType

Tables:
configurations
- configuration_type_id
configurations_hardwares
- configuration_id
- hardware_id
configuration_types
hardwares

When pulling the information for a specific Hardware record, I'm successfully 
getting the Configurations associated with it, but I'm not getting the 
information from the configuration_types table. How do I get info from this 
other table?

$id);
$this->Hardware->find('first', $options);
?>

produces...

Array
(
[Hardware] => Array
(
[id] => 3
[hardware_type_id] => 2
[name] => w-irv-win7dev
[description] => Philip Thompson's Windows 7 machine
[location_id] => 1
)

[Configuration] => Array
(
[0] => Array
(
[id] => 1
[configuration_type_id] => 1
[configuration] => Windows 7 Professional
[description] => 
[ConfigurationsHardware] => Array
(
[id] => 1
[configuration_id] => 1
[hardware_id] => 3
)
)

[1] => Array
(
[id] => 3
[configuration_type_id] => 5
[configuration] => Yes
[description] => 
[ConfigurationsHardware] => Array
(
[id] => 2
[configuration_id] => 3
[hardware_id] => 3
)
)
)
)

I get the configuration_type_id result, but I want other fields from 
configuration_type. Any help would be greatly appreciated on how to accomplish 
this!

Thanks in advance,

~Philip

http://lonestarlightandsound.com/

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Lots of cakephp warnings in the log

2010-08-24 Thread Thunderstriker
i get a lot of warnings in my logs like:
2010-08-24 09:34:01 Warning: Warning (2): mssql_num_rows(): supplied
argument is not a valid MS SQL-result resource in [C:\xampp\htdocs\cake
\libs\model\datasources\dbo\dbo_mssql.php, line 468]
2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
supplied argument is not a valid MS SQL-result resource in [C:\xampp
\htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]
2010-08-24 09:34:01 Warning: Warning (2): mssql_free_result():
supplied argument is not a valid MS SQL-result resource in [C:\xampp
\htdocs\cake\libs\model\datasources\dbo\dbo_mssql.php, line 180]

these warnings just overun my log files and make them almost useless.
i looked up the lines and they used the @ sign to suppress these
errors like:
@mssql_free_result($this->results);

and still the show up in my log is there anyway to really suppress
them without changing the cake code?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problem loading intermediate model

2010-08-24 Thread Hugo M
No, I don't get missing table error :S. Table exists (questions_users). You
can work with your model without creating a model file thanks to Cake
automagic. But if the file is created, Cake loads the model from the file.
Well... that is not working for me (with this model) :(

2010/8/24 j.blotus 

> Do you get a missing table error?
>
> Often these errors can be caused by incorrect file naming or class
> naming.
>
> On Aug 24, 12:03 pm, Hugo M  wrote:
> > I have a model QuestionsUser that has some relationships (belongsTo user,
> > question and answer). The problem is that is not loading my
> questions_users
> > model and I haven't the relationships :S.
> >
> > I put a die in questions_users.php and is not loading the file :S.
> >
> > I'm doing a $uses = array(bla bla, 'QuestionsUser') in my
> users_controller.
> > I'm calling the find method in app_controller.
> >
> > If you have any idea of why this is not working... I'm desperated :S
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Full support for PHP 5.3

2010-08-24 Thread Zippoxer
PHP 5.3 has lots of new features like namespaces, annonymous
functions... And performance is much better than old versions.
Can you see CakePHP supporting PHP 5.3 in the near future?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Password field in 'Edit User' when using Auth

2010-08-24 Thread cricket
On Tue, Aug 24, 2010 at 12:18 PM, WhyNotSmile  wrote:
> I'm using the Auth component for my site, but having problems when it
> comes to editing a user.  I want it so that the user can go to the
> page 'Edit My Account', and see their current information, change
> whatever they want, and save it.
>
> The problem is with the password field.  If it is shown (with *s),
> it's the hashed version which is shown, so it's really long.  When the
> user saves the password, it gets hashed again. The same happens if
> it's a hidden field.

Auth does all this automatically. Have a look at the source.

> If it's not shown, and there's just a blank field, firstly the user
> may wonder why the field is blank, and type something in there, but
> more importantly, they will then save a blank password.

I would just leave it out altogether. You don't need to submit a value
for password when editing any other fields.

> Is there any way around this, or do I just have to have 'Change
> Password' on a different page, and on the Edit page use an update
> instead of a save (so that the password field can be left out
> altogether)?

That's what I do. Name your form elements "password_1" and
"password_2" so Auth will leave them alone. Check that they're
identical upon submission, then use savefield() to edit just the
password column (after hashing, of course).

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cannot retrieve relational data from bootstrapped models

2010-08-24 Thread j.blotus
do you have 2 seperate apps? why not just use admin prefix routing?

On Aug 24, 6:36 am, Steve  wrote:
> Hi all.  I am new to CakePHP and I am building a CMS with the
> following folder structure:
>
> /public_html/cake/
> /public_html/admin/
> /public_html/frontend/
> index.php
>
> I have setup the bootstrap.php file in the frontend to look for models
> in the admin app.  So models for user, content and comment are shared.
>
> In my frontend, i have setup a HomeController which I want to use to
> display results from the 'Contents' table:
>
> {{{
> class HomeController extends AppController {
>
>         var $name = 'Home';
>         var $uses = array(); // No Home model required
>
>         function index(){
>
>           $this->loadModel('Content'); // Best practise according to cookbook
>           $blogPosts = $this->Content->find('all');
>           $this->set('blogPosts', $blogPosts);
>
>         }
>
> }
> }}}
>
> When I debug $blogPosts in my view, it gives me everything in the
> 'Contents' table, no problem.  **But nothing from any related tables**
> - I want to display the author of the post as well, which is contained
> in the 'users' table.
>
> When I debug the output from find('all') in the admin app, relational
> data from the 'users' table is displayed properly.  **Why won't this
> work on my frontend?**  I have tried copying the models to the
> frontend app with no success.  I have tinkered with recursive values,
> tried loading the users model, using containable...no joy.
>
> The relationships in my models seem to be correct, as the data
> displays properly in the admin app.  And the frontend is clearly able
> to access my models as it does display **some** data from them...
>
> Is there anything anyone can see I'm doing wrong?  Or could there be
> some setting somewhere else in the application that is causing this?
> Please help!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Cookies

2010-08-24 Thread voocake
Hey,

i have a big problem with cookies.

i set

$this->Cookie->name = 'cookiename';
$this->Cookie->time = '9600';
$this->Cookie->path = '/';
$this->Cookie->domain = '.domain.com';
$this->Cookie->secure = false;
$this->Cookie->key = 'sdfsdfsd';

$this->Cookie->write('User.name','Mike');
$this->Cookie->write('User.role', 'tester');
$this->Cookie->write('User.income', '2');

debug($this->Cookie->read('User.role'));

in the before filter in the controller. Everything is fine.
But when i read the cookie in the same controller within an method i
don't get 'Mike' or 'tester'. Instead i get strange symbols like
"I� #3 ". everytime i hit F5- refresh, the symbols change. With the
cookieview addon for firefox i can see that the cookie value don't
change. It only happens when i encrypt the cookies!

Any idea? Please help me!

Thank you, greetings mike!


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Countries, States and Cities: Which relations i'm dealing with?

2010-08-24 Thread j.blotus
I don't use capitals, but as has been said before, you could create a
field on cities

TINYINT(1) is_capital

it would be a simple 0 for not capital, 1 for capital

My model works well for USA.
EX.

North America (Zone) ->
United States (Country) ->
Florida (State) ->
North Florida (Region) ->
Tallahassee (City) and it could be capital since it is state capital

For other countries States/Regions become a bit difficult so you might
have something like this:
Middle East (Zone) ->
Israel (Country) ->
Tel Aviv (City) and is_capital = 1

So in that case you may not have a state or region.

The important thing in your city model is that region_id and state_id
can be null, because some countries wont be set up that way.
But all cities will have at least a zone and a country. You might not
even use zone if you dont have a need for organizing it.

As far as preventing duplicate capitals, you can create a validation
rule in your City model that checks to see if a capital already
exists, and prevent save if one does.

Hope this helps get your wheels spinning a bit.

On Aug 24, 8:40 am, DerBjörn  wrote:
> Hi J.Blotus,
>
> City belongsTo State, cause a state as many cities. Thats right.
> First i had State/City hasOne City/State to realize a state capital,
> but i have been told that hasOne doesn't work here and i have to use
> belongsTo instead...
> I always was with doubts about it, but i read this suggestion not only
> in this group...
>
> I am very interested in your region app. It does make sense of course,
> but you are able to realize capitals with it? A city has to be able to
> be a capital of a state or a country. How do you manage it? How look
> your tables?
>
> Thanks
>
> On 23 Aug., 20:15, "j.blotus"  wrote:
>
>
>
> > How does State belongTo City? Isn't it the other way around? Same with
> > Country.
>
> > On my region based apps I use the following
>
> > Zone hasMany Country, State, Region, City
> > Country hasMany  State, Region, City
> > State hasMany Region, City
> > Region hasMany City
>
> > Country belongsTo Zone
> > State belongsTo Zone, Country
> > Region belongsTo Zone, Country, State
> > City belongsTo Zone, Country, State, Region
>
> > Zone is North America, South America, Asia, Etc
>
> > On Aug 18, 5:17 pm, DerBjörn  wrote:
>
> > > Thanks, Dan!
>
> > > After I rebaked my models with following relations:
>
> > > City belongsTo State
>
> > > State belongsTo Country
> > > State belongsTo City
> > > State hasMany City
>
> > > Country belongsTo City
> > > Country hasMany State
>
> > > and updated my views, finally i got a "result"...
> > > Your advice with "containable" i haven't follow till now.
>
> > > I still have one problem that maybe i am able to solve with cricket's
> > > advice of using virtual models!?!
> > > When i want to add p.e. a new country or a new state, their comboboxes
> > > for capital city are empty, so i cannot choose its capital city. How
> > > do I solve this problem?
> > > Thanks a lot :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problem loading intermediate model

2010-08-24 Thread j.blotus
Do you get a missing table error?

Often these errors can be caused by incorrect file naming or class
naming.

On Aug 24, 12:03 pm, Hugo M  wrote:
> I have a model QuestionsUser that has some relationships (belongsTo user,
> question and answer). The problem is that is not loading my questions_users
> model and I haven't the relationships :S.
>
> I put a die in questions_users.php and is not loading the file :S.
>
> I'm doing a $uses = array(bla bla, 'QuestionsUser') in my users_controller.
> I'm calling the find method in app_controller.
>
> If you have any idea of why this is not working... I'm desperated :S

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: image upload...ajax process only works once

2010-08-24 Thread Tomfox Wiranata
huh...it somehow works with
image('link_flyer_path_temp' . "?" .
rand());?>

but only if there is already a picture in that specific path that gets
overwrittenits so freakin weird.in case there is already a pic
and i upload a new one, it actually renders the new one...wtf?

maybe this whole think is related to mars or sthany idea?

On 24 Aug., 08:32, Tomfox Wiranata  wrote:
> wow thats a lot of useful information :)
>
> i will give everything a try  thank you sam.. in case i fail, i
> might come back here :)
>
> On 23 Aug., 19:15, Sam  wrote:
>
> > Add an alert statement into renderflyerpreview() to see if it is
> > executing when you upload a new picture. If it is executing, you may
> > be right about the caching issue. If so, add a random query string
> > onto the edge of the source of your image in the render_flyer element,
> > something like image('link_flyer_path_temp' . "?" .
> > rand());?>... this should defeat browser caching.
>
> > Also- I just noticed that you are calling refreshFlyer using setTimout
> > of 500ms... that may be your problem- you are only allowing .5 seconds
> > for the image to upload, so you may be calling the refreshFlyer
> > function before the image is actually uploaded. Look into using
> > callback functions with your javascript- they basically allow you to
> > call a function once something else has been completed.
>
> > Also- to speed the whole process up, why make two calls to the cake
> > app- one to upload the image and one to get the html of the image- why
> > not just have your processFlyer action render out the html you want
> > displayed? That should both speed up your app(less time making
> > requests to the server) and eliminate the need for setTimeout.
> > Additionaly, to make things even faster, just have the function return
> > the location of the new image and have jquery update the src of the
> > image already on the page.
>
> > On Aug 23, 8:01 am, Tomfox Wiranata  wrote:
>
> > > yes, it shows the picture...it works fine the first timebut if i
> > > repeat the process the new pic wont be rendered...
>
> > > i am using jquery.thx for the tip
>
> > > On 23 Aug., 04:13, Sam  wrote:
>
> > > > If you actually go the renderflyerpreview action does it show the
> > > > picture? Are you sure that your refreshflyer() function is actually
> > > > running when you reload an image?
>
> > > > Also, on a side not, are you using jQuery? If so, there is a more
> > > > elegant way to do some of this coding... For example, instead of using
> > > > onClick in:
> > > > "Hochladen > > > button>"
>
> > > > You could add an id to the button and use a jQuery selector to attach
> > > > an event handler- that way all your javascript is in one place.
> > > > e.g.(if the id was uploadSubmitButton)
>
> > > > $(document).ready(function(){
>
> > > > $('#uploadSubmitButton').click(function(){
> > > > //functionCaller code
>
> > > > });
> > > > });
>
> > > > On Aug 22, 12:15 pm, Tomfox Wiranata 
> > > > wrote:
>
> > > > > hi,
>
> > > > > i am having a weird problem. on a site, a user can upload a picture.
> > > > > when its uploaded the picture gets loaded in a div area as a preview.
> > > > > now that works fine. but if i do this whole thing again, maybe cause i
> > > > > want a different picture, the new picture is not loaded, although the
> > > > > uploading process worked. i checked on my HDD.
>
> > > > > this is what i do:
>
> > > > > i have a form for the file uploading in my view:
> > > > >  > > > > echo $form->create('Link',
> > > > > array('name'=>'uploadProfileImageForm','id'=>'uploadProfileImageForm','type
> > > > >  '=>'file'));
> > > > > echo $form->file('Link');
> > > > > ?>
> > > > >                                 
> > > > > Hochladen > > > > button>
> > > > >   > > > > echo $form->end();
> > > > > ?>
>
> > > > > now a JS function is called to acutally upload the pic, to show the
> > > > > ajax loading icon, and to call the function, that acutally renders the
> > > > > uploaded image in a specific div for a preview.
>
> > > > > function functionCaller(form)
> > > > > {
> > > > >         ajaxUpload(form,'processFlyer','flyer_css',' > > > > src=\'../img/icons/
> > > > > loader.gif\' width=\'16\' height=\'16\' border=\'0\' />','Fehler beim
> > > > > Upload');
> > > > >         setTimeout("refreshflyer()", 500);
> > > > >         //refreshdiv();
>
> > > > > }
>
> > > > > calling a controller function to render the pic from this JS function
>
> > > > > function refreshflyer(){
>
> > > > >         $('#flyer_preview').load('renderflyerpreview');
>
> > > > > }
>
> > > > > and that is the functin in my controller that gets the path to the
> > > > > image and renders it in a div in my view
>
> > > > >     function renderflyerpreview()
> > > > >     {
> > > > >         $this->set('link_flyer_path_temp', 
> > > > > ($this->Session->read('Link.flyer_path_temp')));
>
> > > > >         $this->render('render_flyer','ajax');
> > > > >     }
>
> > > > > as i said it work

Password field in 'Edit User' when using Auth

2010-08-24 Thread WhyNotSmile
I'm using the Auth component for my site, but having problems when it
comes to editing a user.  I want it so that the user can go to the
page 'Edit My Account', and see their current information, change
whatever they want, and save it.

The problem is with the password field.  If it is shown (with *s),
it's the hashed version which is shown, so it's really long.  When the
user saves the password, it gets hashed again. The same happens if
it's a hidden field.

If it's not shown, and there's just a blank field, firstly the user
may wonder why the field is blank, and type something in there, but
more importantly, they will then save a blank password.

Is there any way around this, or do I just have to have 'Change
Password' on a different page, and on the Edit page use an update
instead of a save (so that the password field can be left out
altogether)?

Thanks.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Problem loading intermediate model

2010-08-24 Thread Hugo M
I have a model QuestionsUser that has some relationships (belongsTo user,
question and answer). The problem is that is not loading my questions_users
model and I haven't the relationships :S.

I put a die in questions_users.php and is not loading the file :S.

I'm doing a $uses = array(bla bla, 'QuestionsUser') in my users_controller.
I'm calling the find method in app_controller.

If you have any idea of why this is not working... I'm desperated :S

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Autocomplete

2010-08-24 Thread Philip Thompson
On Aug 23, 2010, at 3:39 PM, Philip Thompson wrote:

> Hi all.
> 
> I'm using MooTools 1.2.4 and CakePHP 1.3. I'm attempting to get 
> Autocompleter.Ajax.Json() working, but I'm not seeing the result list. 
> Firebug is letting me know that the query is returning the correct results, 
> but still not seeing anything. From the Cake side of things, am I approaching 
> this the correct way?
> 
>  // /app/controllers/hardwares_controller.php
> class HardwaresController extends AppController {
>public function config () {
>$options = array(
>'conditions' => array(
>'ConfigurationType.name LIKE' => '%'.$_POST['q'].'%',
>),
>);
>$configType = $this->import('ConfigurationType', 'Model');
>$types = $configType->find('list', $options);
>$this->set('output', json_encode ($types));
>$this->render('/elements/ajax');
>}
> }
> 
> // /app/views/elements/ajax.ctp
> if (isset ($output)) {
>echo $output;
> }
> ?>
> 
> 
> new Autocompleter.Ajax.Json(document.id(input), url, {
>postVar: 'q',
>postData: {},
>ajaxOptions: {},
>minLength: 1,
>delay: 100,
>filterSubset: true,
>filterCase: false,
>relative: false,
>selectedMode: true,
>zIndex: 1,
>evalScripts: true,
>selectFirst: true
> });
> 
> 
> Again, the result is being returned, but the javascript seems to not be 
> picking up on it. Not sure if it's how I'm rendering the result or what? Any 
> thoughts would be appreciated!
> 
> http://clientcide.com/docs/3rdParty/Autocompleter.Remote
> http://www.clientcide.com/wiki/cnet-libraries/11-3rdparty/03-autocompleter.remote
> 
> Thanks in advance,
> ~Philip
> 
> http://lonestarlightandsound.com/

Figured out what the issue was. The autocomplete was working properly, however, 
the CSS was preventing the list from being shown in the correct spot (not below 
the input box). To fix it, I gave the surrounding div and ul a position of 
relative.

div.config div, 
div.config ul {
position: relative;
}

Thanks.

~Philip

http://lonestarlightandsound.com/

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: call CakePHP stored Procedure

2010-08-24 Thread Ma'moon
You can simply accomplish that by using the `query` method located in your
model, something like $this->Model->query('CALL sp_name()');
also CakePHP doesn't generate automated `Stored Procedures` but rather is
generated `SQL Queries` to perform DB interaction between system layers and
data storage engines 'of course IF you are using an SQL based storage
engine'.

On Tue, Aug 24, 2010 at 3:45 PM, Cruisine  wrote:

> is there anybody know how to call stored procedure in cake??
> i'm using cake 1.3 and have got so many efforts to call it in cake but
> seems not works otherwise got some error..
> i wish there were somebody known how to call stored procedure and
> implement it from model, controller and shows it data into the view..
> :-)
>  need ur help soon..tq
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Validation of Foreign Keys - Not Automatic ?

2010-08-24 Thread Sam
AFAIK, cake doesn't have this built in, however if you use InnoDB
mysql tables you can use Foreign Key Constraints, which should give
you what you want.
http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html

On Aug 23, 8:30 pm, rvandervort  wrote:
> Sorry that should read   "   'Player' => array(  'Player' =>
> 'Player'   "
>
> On Aug 23, 9:15 pm, rvandervort  wrote:
>
>
>
> > I'm not sure why, but expected models related by belongsTo and hasMany
> > to be "autovalidated".
>
> > e.g.
>
> > class Team extends AppModel  {
> >   var $hasMany = array(
> >          'Player' => array(  'Player' => 'Item' , 'foreignKey' =>
> > 'team_id'  )
> >  );
>
> > }
>
> > class Player extends AppModel {
> >   var $belongsTo = array(
> >           'Team' => array( 'className' => 'Team' , 'foreignKey' =>
> > 'team_id' )
> >  );
>
> > }
>
> > ---
> > I thought for sure that an invalid team_id would be automatically
> > validated, but this does not seem to be the case.
>
> > Question : Is there a built in rule that will validate the team_id
> > when I insert a new Player record ?  Or do I have to roll my own
> > solution to this ?
>
> > Thanks,
> > Roger

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Cannot retrieve relational data from bootstrapped models

2010-08-24 Thread Steve
Hi all.  I am new to CakePHP and I am building a CMS with the
following folder structure:

/public_html/cake/
/public_html/admin/
/public_html/frontend/
index.php

I have setup the bootstrap.php file in the frontend to look for models
in the admin app.  So models for user, content and comment are shared.

In my frontend, i have setup a HomeController which I want to use to
display results from the 'Contents' table:

{{{
class HomeController extends AppController {

var $name = 'Home';
var $uses = array(); // No Home model required

function index(){

  $this->loadModel('Content'); // Best practise according to cookbook
  $blogPosts = $this->Content->find('all');
  $this->set('blogPosts', $blogPosts);

}
}
}}}

When I debug $blogPosts in my view, it gives me everything in the
'Contents' table, no problem.  **But nothing from any related tables**
- I want to display the author of the post as well, which is contained
in the 'users' table.

When I debug the output from find('all') in the admin app, relational
data from the 'users' table is displayed properly.  **Why won't this
work on my frontend?**  I have tried copying the models to the
frontend app with no success.  I have tinkered with recursive values,
tried loading the users model, using containable...no joy.

The relationships in my models seem to be correct, as the data
displays properly in the admin app.  And the frontend is clearly able
to access my models as it does display **some** data from them...

Is there anything anyone can see I'm doing wrong?  Or could there be
some setting somewhere else in the application that is causing this?
Please help!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


CakePHP AMF

2010-08-24 Thread Fiuza
Good evening,

I'm trying to enable the AMF service through an application developed
with CakePHP 1.3. I tried to implement the solutions CPAmf, CakeAMFPHP
and Zamf, but no success. Does anyone have any suggestions?

Thanks,
Marcos Fiuza.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Landing Page Optimization

2010-08-24 Thread EMR
Hi Guys,

I am completely new to CakePHP and am looking to do some landing page
optimization (A/B Testing) using Google's Landing Page optimizer. I
know this is a complete amateur question but can anyone walk me
through how to set up the different landing pages such that google
will recognize them? Has anyone gone through using G Landing Page
Optimizer and can offer tips/point me in the right direction? Right
now I have a custom layout that I would like to keep for the site but
not use for my landing page.

Thanks in advance for the help, it is much appreciated.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


call CakePHP stored Procedure

2010-08-24 Thread Cruisine
is there anybody know how to call stored procedure in cake??
i'm using cake 1.3 and have got so many efforts to call it in cake but
seems not works otherwise got some error..
i wish there were somebody known how to call stored procedure and
implement it from model, controller and shows it data into the view..
:-)
need ur help soon..tq

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


call CakePHP stored Procedure

2010-08-24 Thread Cruisine
is there anybody know how to call stored procedure in cake??
i'm using cake 1.3 and have got so many efforts to call it in cake but
seems not works otherwise got some error..
i wish there were somebody known how to call stored procedure and
implement it from model, controller and shows it data into the view..
:-)
 need ur help soon..tq

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Countries, States and Cities: Which relations i'm dealing with?

2010-08-24 Thread DerBjörn
Hi J.Blotus,

City belongsTo State, cause a state as many cities. Thats right.
First i had State/City hasOne City/State to realize a state capital,
but i have been told that hasOne doesn't work here and i have to use
belongsTo instead...
I always was with doubts about it, but i read this suggestion not only
in this group...

I am very interested in your region app. It does make sense of course,
but you are able to realize capitals with it? A city has to be able to
be a capital of a state or a country. How do you manage it? How look
your tables?

Thanks

On 23 Aug., 20:15, "j.blotus"  wrote:
> How does State belongTo City? Isn't it the other way around? Same with
> Country.
>
> On my region based apps I use the following
>
> Zone hasMany Country, State, Region, City
> Country hasMany  State, Region, City
> State hasMany Region, City
> Region hasMany City
>
> Country belongsTo Zone
> State belongsTo Zone, Country
> Region belongsTo Zone, Country, State
> City belongsTo Zone, Country, State, Region
>
> Zone is North America, South America, Asia, Etc
>
> On Aug 18, 5:17 pm, DerBjörn  wrote:
>
> > Thanks, Dan!
>
> > After I rebaked my models with following relations:
>
> > City belongsTo State
>
> > State belongsTo Country
> > State belongsTo City
> > State hasMany City
>
> > Country belongsTo City
> > Country hasMany State
>
> > and updated my views, finally i got a "result"...
> > Your advice with "containable" i haven't follow till now.
>
> > I still have one problem that maybe i am able to solve with cricket's
> > advice of using virtual models!?!
> > When i want to add p.e. a new country or a new state, their comboboxes
> > for capital city are empty, so i cannot choose its capital city. How
> > do I solve this problem?
> > Thanks a lot :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: pdf generation problem

2010-08-24 Thread Miqdad Ali
Sorry

My Problem is Not that

I am getting Correct Output while echoing $htmlcontent

But After Commenting echo
in pdf it's not getting

please help...

Miqdad Ali




On Thu, Aug 19, 2010 at 9:30 PM, cricket  wrote:

> It looks like the problem is that the server is sending data to the browser
> before the PDF can be rendered. This is similar to the "headers already
> sent" error. This is probably due to you echoing the $htmlcontent. If you
> don't do that, do you still see the same error msg ("some data has already
> been output")? If so, check that none of your files have whitespace after
> the closing "?>" tag. That includes AppController, AppModel, routes, etc.
>
>
> On Thu, Aug 19, 2010 at 8:12 AM, Miqdad Ali wrote:
>
>> Hi friends
>>  I am Creating pdf using tcpdf class and its for a timetable . my
>> view is having 4000 lines of code.. it created by previous employee and he
>> passed away,and pdf is not getting but while i am echo $htmlcontent it's
>> showing correct out put but pdf not getting.
>> I am attaching two files
>>one is screen shot of echo $htmlcontent
>>one is pdf file
>>
>> please anybody help
>> today is the last date.
>>
>> I hope some one will help me
>>
>> 
>> Miqdad Ali
>>
>>
>>
>>  Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Dynamic Menu

2010-08-24 Thread _k10_
Not sure if this answers your query but have a look @
http://book.cakephp.org/view/1023/find-threaded


On Aug 23, 10:29 pm, nightshadex101  wrote:
> Hi All,
>
> I'm trying to build a menu system.
> I've already created a table in the database, a model (with tree
> behavior), and a controller.
>
> The idea is that the menu has 2 levels (it will probably get 3 levels
> later), and the following is showed:
>
> -All parent of 1st level pages (controllers)
> If I'm on a parent page (ie: a controller)
>     -All my children/2nd level pages (funcions in that controller)
> If I'm on a 2nd level page
>     -All the other children of my parent (all the other functions in
> that controller)
>
> What I'm not getting is how to call this function from an element (to
> later insert in the layout) so that I can pass the current page to the
> controller function.
>
> This is the db table:
>
> CREATE TABLE IF NOT EXISTS `menus` (
>   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
>   `parent_id` int(10) DEFAULT NULL,
>   `lft` int(11) DEFAULT NULL,
>   `rght` int(11) DEFAULT NULL,
>   `name` varchar(255) COLLATE latin1_general_cs DEFAULT '',
>   `location` varchar(255) COLLATE latin1_general_cs DEFAULT '',
>   `status` tinyint(1) NOT NULL,
>   `created` datetime DEFAULT NULL,
>   `modified` datetime DEFAULT NULL,
>   PRIMARY KEY (`id`)
>
> Model:
>
>  class Menu extends AppModel {
>         var $name = 'Menu';
>         var $actsAs = array('Tree');}
>
> ?>
>
> Controller:
>
>  class MenusController extends AppController {
>
>         var $name = 'Menus';
>
>         function getMenu($location = null) {
>                 if(substr($location,-1,1) == '/')
>                         $location = substr($location,0,strlen($location)-1);
>                 $locationId = $this->Menu->field('id', array('location' =>
> $location));
>                 $allParents = $this->Menu->find('all', array(
>                         'fields'         => array('Menu.id', 'Menu.name', 
> 'Menu.location'),
>                         'conditions' => array('Menu.parent_id' => null, 
> 'Menu.status'      =>
> 1)
>                 ));
>                 $myParent = $this->Menu->getparentnode($locationId);
>
>                 if ($myParent) {
>                         $secondLevel = 
> $this->Menu->children($myParent['Menu']['id'],
> true);
>                 } else {
>                         $secondLevel = $this->Menu->children($locationId, 
> true);
>                 }
>
>                 $secondLevelFiltered = array();
>                 $i = 0;
>                 foreach ($secondLevel as $children) {
>                         if ($children['Menu']['status'] == 1) {
>                                 $secondLevelFiltered[$i]['id'] = 
> $children['Menu']['id'];
>                                 $secondLevelFiltered[$i]['name'] = 
> $children['Menu']['name'];
>                                 $secondLevelFiltered[$i]['location'] = 
> $children['Menu']
> ['location'];
>                                 $i++;
>                         }
>                 }
>
>                 $menuTree = array();
>                 $i = 0;
>                 foreach ($allParents as $parent) {
>                         $menuTree[$i] = $parent['Menu'];
>                         if ($myParent) {
>                                 if ($myParent['Menu']['id'] == 
> $parent['Menu']['id']) {
>                                         $menuTree[$i]['children'] = 
> $secondLevelFiltered;
>                                 }
>                         } else {
>                                 if($locationId == $parent['Menu']['id']) {
>                                         $menuTree[$i]['children'] = 
> $secondLevelFiltered;
>                                 }
>                         }
>                         $i++;
>                 }
>                 return($menuTree);
>         }}
>
> ?>
>
> Could someone give me some orientation on how to procede from here?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Windows Authentication

2010-08-24 Thread Louie Miranda
Can LDAP be used?
http://bakery.cakephp.org/articles/view/ldap-models-in-cakephp

--
Louie Miranda
 - Email: lmira...@gmail.com
 - Web: http://www.louiemiranda.com



On Mon, Aug 23, 2010 at 9:39 PM, Ian Channing wrote:

> Has anyone been crazy enough to try getting the Microsoft sqlsvr
> drivers working with Windows Authentication?  I can't fully comprehend
> what will be the impact of using Windows Authentication since it will
> no longer be using the /app/core/database.php file.
>
> I've also cross posted this on stackoverflow in case anyone wonders
> the similarities:
> http://stackoverflow.com/questions/3548001/cakephp-sql-server-windows-authentication
>
> I'm not holding out much hope but any help would be great.  At least
> if anyone's had a proper shot at getting the latest sqlsrv drivers
> working.
>
> Thanks
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Bakery Registration/Login Not Working

2010-08-24 Thread Charles Blackwell
I authenticated my Bakery account and tried to log in, no dice. I
reset the password...still, no dice. What do I do now?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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