How to create lang-paginator?

2008-05-20 Thread [EMAIL PROTECTED]

When I use two (three) language, my Routes look like:

/:lang/:controller/:action/

But, How to setup helper paginator for creating url like this?

$paginator->next(__('next', true).' >>', array('url' => array($lang)),
null, array('class'=>'disabled'));?>

Made url like (for example):

/members/index/$lang...

But how make:

/lang/members/index...?

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



Re: Advanced routing and controller redirecting

2008-05-20 Thread Jonathan Snook

On Wed, May 21, 2008 at 12:49 AM, Travis <[EMAIL PROTECTED]> wrote:
>
> Yes, I would like to display the data differently depending on the
> attributes passed in.

Then set up three different routes for it, each pointing to its own action

Router::connect('/:controller/:year/:month/:day', array('action' => 'byday'));
Router::connect('/:controller/:year/:month', array('action' => 'bymonth'));
Router::connect('/:controller/:year', array('action' => 'byyear));

-Jonathan

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



Re: Advanced routing and controller redirecting

2008-05-20 Thread Travis

Yes, I would like to display the data differently depending on the
attributes passed in.

On May 20, 6:16 pm, "Jonathan Snook" <[EMAIL PROTECTED]> wrote:
> On Tue, May 20, 2008 at 7:07 PM, Travis <[EMAIL PROTECTED]> wrote:
>
> > I am trying to create a controller that acts similar to that of which
> > you find commonly on blogs.  I want the user to be able to type
> >http://www.example.com/2008/05/20/,http://www.example.com/2008/05/,
> > andhttp://www.example.com/2008/to be directed to an archive for the
> > current day, month, and year respectively.
>
> > How do I make it such that each different variation of the date gets
> > redirected to the appropriate view?  Thanks!
>
> Do you actually present this data differently? Because I'd do it like this:
>
> 
>     class PostsController extends AppController {
>        var $name = 'Posts';
>
>        function index() {
>            $year = $this->params['year'];
>            $month = $this->params['month'];
>            $day = $this->params['day'];
>
>            $conditions = "YEAR(published)=$year";
>
>            if (!empty($month)) {
>                       $conditions .= " AND MONTH(published)=$month";
>            }
>
>            if (!empty($day)) {
>                       $conditions .= " AND DAY(published)=$day";
>            }
>
>            $posts = $this->Post->findAll($conditions);
>            $this->set('posts', $posts);
>        }
>
>    }
> ?>
> 
>
> I think this simplifies your code and makes it easier to read. :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake Book

2008-05-20 Thread Action

In the sidenav under "Menu" you can click "All In One Page":

http://book.cakephp.org/complete/3/the-manual



On May 21, 12:12 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi everyone,
>
> I have been having terrible luck trying to find anything in the new
> book, I've been pulling my hair out while using it, does anyone have a
> copy of the tempdocs? I found them very useful and I could find all
> the information with a quick search in my browser, now I have to
> navigate through sections which don't really make sense to me at all
> and half of the section are empty, I realize it is not complete but
> its our only resource at the moment.
>
> If nobody has a copy, core developers please please please make
> tempdocs available again
>
> Thank you
>
> Sean
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Cake Book

2008-05-20 Thread [EMAIL PROTECTED]

Hi everyone,

I have been having terrible luck trying to find anything in the new
book, I've been pulling my hair out while using it, does anyone have a
copy of the tempdocs? I found them very useful and I could find all
the information with a quick search in my browser, now I have to
navigate through sections which don't really make sense to me at all
and half of the section are empty, I realize it is not complete but
its our only resource at the moment.

If nobody has a copy, core developers please please please make
tempdocs available again

Thank you

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



Re: HTML Helper webroot not correct

2008-05-20 Thread Joel Perras

Set a RewriteBase condition in your .htaccess files in app/.htaccess
and app/webroot/.htaccess.

On May 20, 7:49 pm, Tobes <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've just started playing with CakePHP & have found that, because I'm
> not using a domain name to access my site, but instead using a sub-
> folder, the HTML helper is using / as the webroot, rather than the sub-
> folder the site is in.
>
> Any advice on how to correct this welcomed.
>
> Thanks,
>
> T
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



mods

2008-05-20 Thread mark

I modified your dbo_informix.php file as follows:

function connect() {
$config = $this->config;
$connect = $config['connect'];
$this->connected = false;


$host = $config['database'] . '@' . $config['host'];
//modified by mark
$argHostname = $config['host'];
if ($argHostname) putenv("INFORMIXSERVER=$argHostname");
putenv("INFORMIXSERVER=".trim($argHostname));
//
if ($config['persistent'])
{
$this->connection = ifx_pconnect($host, $config['login'],
$config['password']);
}
else
{
$this->connection = $connect($host, $config['login'],
$config['password']);
}

$this->connected = ($this->connection !== false);
return $this->connected;
}

...

function describe(&$model, $clear = false)
{
//commented out by mark
 //   $this->model &= $model;
$cache = parent::describe($model, $clear);
if ($cache != null)
{
return $cache;
}

$fields = array();
...


I'm not sure if these will have any adverse effect.  Any comments?

Regards,
Mark

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



Re: Multiple rule Validation causes Redirect to fail.

2008-05-20 Thread Chris Hartjes

On Tue, May 20, 2008 at 10:10 PM, Mr-Yellow <[EMAIL PROTECTED]> wrote:
>
> Email component loads all your helpers in as part of it's rendering of
> the email view into a variable.
>
> This causes the helpers to be included along with any whitespace they
> may have.
>
> So deeply hidden whitespace issues with EmailComponent = Helpers with
> whitespace

It can also be whitespace issues in your templates, couldn't it?

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: Multiple rule Validation causes Redirect to fail.

2008-05-20 Thread Mr-Yellow

Email component loads all your helpers in as part of it's rendering of
the email view into a variable.

This causes the helpers to be included along with any whitespace they
may have.

So deeply hidden whitespace issues with EmailComponent = Helpers with
whitespace

-Ben

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



Cake PHP / Flash Question

2008-05-20 Thread Kyle Decot

I am building a desktop php application for a local business. They
need to be able to take photos of customers with a webcam and then
save the image to a corresponding entry. Does anyone know of a Flash
tutorial or open source program where a photo can be captured with the
webcam and then send the file to a php for resizing/saving? Thanks as
always.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple rule Validation causes Redirect to fail.

2008-05-20 Thread Mr-Yellow

https://trac.cakephp.org/ticket/4714

Whitespace coming from EmailComponent. Haven't found where yet.

-Ben

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



Re: Is migrations support planned for Cake?

2008-05-20 Thread Dardo Sordi Bogado

>  For example,
> you may want to provide a simple web based installation for you
> application. Well, with a few lines of code you could make that
> happen.

I'm already doing that (borrowed the code from the schema shell).

Schema rocks!

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



Re: Is migrations support planned for Cake?

2008-05-20 Thread Dardo Sordi Bogado

On Tue, May 20, 2008 at 5:41 PM, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote:
>
> It'd be great if schema arrays could include an "old_name" field, so
> that CakePHP could not only create fields and create tables, but
> rename them.
> Get my drift? If we could somehow tell Cake the history of a
> particular table or field, it seems like we could get the best of both
> worlds.

Yes, handling renames is a tricky business.

> >
>

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



Re: Is migrations support planned for Cake?

2008-05-20 Thread Dardo Sordi Bogado

>> To me there seem to be 3 possible orders: C-E-D,  C-D-E, E-C-D.
>
> Then in that edge case, you simply modify either migrations
> themselves, or the timestamp, so that the order is correct.

I don't think that two developers working in parallel can be
considered and edge case, and being that a common case in my workplace
is that we decided to switch to cake schema (after I stoped of pulling
my hair and got them working), since them we are a happy team.

> One of the best things about Migrations, is that they are fully
> incremental, and each one can be rolled back very easily.

I do agree, doing changes in a incremental (and atomic) way really
helps to do agile development.

> It's all sounding to me that this is all about preference. All I know
> is that the core team plan on reviewing Schema and Migrations after
> 1.2 is released, to see if there is an common ground. I certainly hope
> we can do something, as there is a lot of overlay between the two.

That would be great, there are a lot of place for improvement an
innovation in the field.

> But
> if Migrations is not used, then I will simply continue to use and
> develop it as  third party add-on for Cake.

Don't know what to say, but I get used to split emails in chunks :O

Cheers,
- Dardo Sordi.

> FYI: Migrations v4.0 Beta has just been released ->
> http://developingwithstyle.com/2008/05/20/cakephp-migrations-v40-beta/
> >
>

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



Re: open "real" url

2008-05-20 Thread lance_mountain

> When I try to open that url cake of course looks for a ststistics
> controller. How can I open the "real" url? Do I have to change
> the .htaccess?

This is one example of how you could set up the htaccess ignore rule:
http://bin.cakephp.org/saved/32472. In this example, /stats is the URL
to ignore.

You'll find lots of good examples and technical details in Apache's
Docs: http://httpd.apache.org/docs/2.2/rewrite/rewrite_intro.html.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is migrations support planned for Cake?

2008-05-20 Thread Gwoo

Ok, since I wrote CakeSchema, I suppose I could elaborate on some of
its uses. I think most people have understood what it was intended to
do, though I have not thoroughly read all of the previous messages.

The basic idea behind CakeSchema is to have a complete snapshot of
your application's data structure at a given point in time. With this
in mind it would probably be wise to add a timestamp option to go
along with the version number option. In any case, if you are using a
proper SCM you do not even need to use the snapshots. CakeSchema can
work for a variety of workflows and situations.

One possible workflow follows:
1) Design your database with DbDesigner or some other gui.
2) Export the sql for your preferred database server
3) Import the sql via your database GUI
4) Scaffold your application
5) make any desired adjustments
6) cake schema generate
7) use the before and after callbacks to populate some initial data
8) commit to svn

Voila. You have the first version of your application ready. Let other
developers use "cake schema run create" so they can start from the
same point.

But now I need to make some changes.
1) Open up your database GUI
2) Make all the needed changes
3) cake schema generate
4) commit to svn

Now all someone has to do is "cake schema run update" and they have
all the latest changes. If a new developer comes into the picture then
they can create. If you want to see the difference between two schemas
you can do a dry run through the console or diff the revisions.

There are many other possibilities. I have heard of people who
actually like creating the schema in php with their favorite text
editor. In addition, since each schema is a class that extends
CakeSchema and is loaded through Cake you have all the advantages of
the framework to do whatever your imagination may desire. For example,
you may want to provide a simple web based installation for you
application. Well, with a few lines of code you could make that
happen.

In general, I think CakeSchema covers many use cases and as always,
enhancement tickets are more than welcome.

Bake on.



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



Re: Is migrations support planned for Cake?

2008-05-20 Thread Dardo Sordi Bogado

> Well here's the deal...
>
> I played around with Schema a bit last night.

I'm really happy now :P

>  I have only a few
> issues with it in practice:

> 1.  It doesn't handle autoincrement correctly in the latest nightly
> build when you generate a schema from an existing table.

It's working for me in the rev 6990 in mysql.

> 2.  The downloadable 1.2 beta has major bugs in it like an incorrect
> refernce to the string tokenizer so newbies may not even be fully
> exploring Schema in the console!

Well, I hope stable is coming soon.

> Aside from that...
>
> You can basically use the schema tool as migrations.

In that case I think Joel's migrations are better, but I always talk
about my personal experience... YMMV

> You can create Schema.php and then create Schema_2.php and so on.
> You're then able to note version numbers you want to "migrate" to in
> the console.  So far as I can tell, it has a lot in common with the
> old way that migrations worked in Rails 2.0.
>
> Given that this is now how Schema works I think it may be worthwhile
> to investigate different ways to use Schema.

Sure, there are many ways of using a tool.

>  Dardo has one
> methodology that he's been evangelizing in this thread.

"A voice of one calling in the desert" comes now to my mind, :P

>  I wonder if
> we could get phpNut or someone on the core team more familiar with
> Schema's development to comment on the design decisions behind it
> given the functionality that hasn't been talked about on here.

That would be great.

>  I'll
> probably put together a little tutorial or something for my blog once
> I get everything all worked out on my own, but this was news to me!

Looking forward to see it.

Regards,
- Dardo Sordi.

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



Re: Advanced routing and controller redirecting

2008-05-20 Thread Jonathan Snook

On Tue, May 20, 2008 at 7:07 PM, Travis <[EMAIL PROTECTED]> wrote:
>
> I am trying to create a controller that acts similar to that of which
> you find commonly on blogs.  I want the user to be able to type
> http://www.example.com/2008/05/20/, http://www.example.com/2008/05/,
> and http://www.example.com/2008/ to be directed to an archive for the
> current day, month, and year respectively.
>
> How do I make it such that each different variation of the date gets
> redirected to the appropriate view?  Thanks!

Do you actually present this data differently? Because I'd do it like this:


params['year'];
   $month = $this->params['month'];
   $day = $this->params['day'];

   $conditions = "YEAR(published)=$year";

   if (!empty($month)) {
  $conditions .= " AND MONTH(published)=$month";
   }

   if (!empty($day)) {
  $conditions .= " AND DAY(published)=$day";
   }

   $posts = $this->Post->findAll($conditions);
   $this->set('posts', $posts);
   }

   }
?>


I think this simplifies your code and makes it easier to read. :)

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



HTML Helper webroot not correct

2008-05-20 Thread Tobes

Hi all,

I've just started playing with CakePHP & have found that, because I'm
not using a domain name to access my site, but instead using a sub-
folder, the HTML helper is using / as the webroot, rather than the sub-
folder the site is in.

Any advice on how to correct this welcomed.

Thanks,

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



Re: open "real" url

2008-05-20 Thread Jonathan Snook

Yes, you'll need to add an exception to your .htaccess file to ignore
that folder.

On Tue, May 20, 2008 at 5:53 PM, donnerbeil <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I have my web statistics in www.mydomain.com/statistics
>
> When I try to open that url cake of course looks for a ststistics
> controller. How can I open the "real" url? Do I have to change
> the .htaccess?
>
> Donnerbeil
>
> >
>

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



Re: Advanced routing and controller redirecting

2008-05-20 Thread 3lancer.eu

Hi,

> How do I make it such that each different variation of the date gets
> redirected to the appropriate view?  Thanks!

I'd personally go for 3 simple regexps, 1 for year, 1 for year/month,
1 for year/month/date...

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



Advanced routing and controller redirecting

2008-05-20 Thread Travis

I am trying to create a controller that acts similar to that of which
you find commonly on blogs.  I want the user to be able to type
http://www.example.com/2008/05/20/, http://www.example.com/2008/05/,
and http://www.example.com/2008/ to be directed to an archive for the
current day, month, and year respectively.  So far I have a Posts
controller with the following:


params['year'];
$month = $this->params['month'];
$day = $this->params['day'];

// How do I redirect to the appropriate view?
}

function p_year($year) {
$posts = $this->Post->findAll(
"YEAR(published)=$year"
);

$this->set('posts', $posts);
}

function p_year_month($year, $month) {
$posts = $this->Post->findAll(
"YEAR(published)=$year AND MONTH(published)=$month"
);

$this->set('posts', $posts);
}

function p_year_month_day($year, $month, $day) {
$posts = $this->Post->findAll(
"YEAR(published)=$year AND MONTH(published)=$month AND
DAY(published)=$day"
);

$this->set('posts', $posts);
}
}
?>


And I have my routing configuration set up as follows:


Router::connect('/:controller/:year/:month/:day', array(
'action' => 'index',
'month' => null,
'day' => null
), array(
'year' => '[12][0-9]{3}',
'month' => '(0[1-9]|1[012])',
'day' => '(0[1-9]|[12][0-9]|3[01])'
));


How do I make it such that each different variation of the date gets
redirected to the appropriate view?  Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



open "real" url

2008-05-20 Thread donnerbeil

Hi!

I have my web statistics in www.mydomain.com/statistics

When I try to open that url cake of course looks for a ststistics
controller. How can I open the "real" url? Do I have to change
the .htaccess?

Donnerbeil

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



Fatal error: Class 'Behavior' not found in console.php line 65

2008-05-20 Thread rob . dingwell

Does anyone have any idea what causes this.  I'm trying to run the
console and I keep getting this output.

Welcome to CakePHP v1.2.0.6311 beta Console
---

Fatal error: Class 'Behavior' not found in cake/console/
libs/console.php on line 65

Thanks.

Rob


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



Re: General purpose page / design issues

2008-05-20 Thread spub

In terms of adding small pieces of functionality I tend to use a
mixture of requestActions and renderElement.

For example in an ecommerce site I may use $categories = $this-
>requestAction('/categories/index'); to retrieve the categories and
display them on the index page.

Same would apply for forum entries.

I could use echo $this->renderElement('show_menu')  to render the menu
in the index page or into the layout itself.


On May 20, 10:19 pm, Matt Huggins <[EMAIL PROTECTED]> wrote:
> I've been using CakePHP for almost 2 years now, and I still don't know
> what the best way to do this is.  The way I do it is I end up creating
> an added action in one of my controllers, and I change the routing for
> the homepage to point there.  I'd really like to know of a better
> approach to this, as I haven't found any good real-world example.
>
> On May 20, 2:17 pm, W Marsh <[EMAIL PROTECTED]> wrote:
>
> > Hi.
>
> > If you look at most web sites you will see that their index pages are
> > generally a mish-mash of different functionality. For example, they
> > might give a summary of recent blog posts coupled with other
> > statistics, all relating from various models in the system.
>
> > How does this fit into the model-view-controller mentality?
> > Controllers and models tend to be focused on one specific piece of
> > functionality in the examples I've seen. There are no good examples of
> > real world usage.
>
> > I should point out this is a design/best practices question. I know
> > HOW to make an index/general purpose page work, but I would like to
> > hear some wisdom on how to do it in the CakePHP spirit.
>
> > Thanks.
>
> >   - Wayne

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



Re: Vendor issue: Duplicate class name

2008-05-20 Thread John David Anderson

On May 20, 2008, at 4:36 PM, Renan Gonçalves wrote:

> Why not Cake_*ClassName* convention? Like Zend.

BecauseZendHasReallyLongClassNames.

(imho)

-- John




> On Tue, May 20, 2008 at 3:51 PM, jonknee <[EMAIL PROTECTED]> wrote:
>
> On May 20, 3:36 am, Matt Huggins <[EMAIL PROTECTED]> wrote:
> > I'm trying to import a vendor class, but the class I'm importing in
> > turn references another 3rd party class named "cache". Since there  
> is
> > already a CakePHP class named "Cache", I get an error message  
> stating
> > "Fatal Error: Cannot redeclare class cache in [filename]".
> >
> > Does anyone have any clue how I can work around this? I don't want  
> to
> > rename the vendor class since I'll need to perform future upgrades  
> to
> > the class, not to mention that the class name is referenced  
> throughout
> > much of the 3rd party code. I have no idea where to go from here.
> > Please help!
>
> This is why namespaces are being introduced into PHP (originally as
> part of 6, but backported to 5.3)
>
> http://us2.php.net/manual/en/language.namespaces.php
>
> Unfortunately that's not going to help you now. You may be stuck
> renaming manually (well at least with a regex).
>
>
>
>
> -- 
> Renan Gonçalves - Software Engineer
> Cell Phone: +55 11 8633 6018
> MSN: [EMAIL PROTECTED]
> São Paulo - SP/Brazil
> >


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



Re: Vendor issue: Duplicate class name

2008-05-20 Thread Renan Gonçalves
Why not Cake_*ClassName* convention? Like Zend.

On Tue, May 20, 2008 at 3:51 PM, jonknee <[EMAIL PROTECTED]> wrote:

>
> On May 20, 3:36 am, Matt Huggins <[EMAIL PROTECTED]> wrote:
> > I'm trying to import a vendor class, but the class I'm importing in
> > turn references another 3rd party class named "cache". Since there is
> > already a CakePHP class named "Cache", I get an error message stating
> > "Fatal Error: Cannot redeclare class cache in [filename]".
> >
> > Does anyone have any clue how I can work around this? I don't want to
> > rename the vendor class since I'll need to perform future upgrades to
> > the class, not to mention that the class name is referenced throughout
> > much of the 3rd party code. I have no idea where to go from here.
> > Please help!
>
> This is why namespaces are being introduced into PHP (originally as
> part of 6, but backported to 5.3)
>
> http://us2.php.net/manual/en/language.namespaces.php
>
> Unfortunately that's not going to help you now. You may be stuck
> renaming manually (well at least with a regex).
> >
>


-- 
Renan Gonçalves - Software Engineer
Cell Phone: +55 11 8633 6018
MSN: [EMAIL PROTECTED]
São Paulo - SP/Brazil

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



Re: CakePHP Forum Software?

2008-05-20 Thread Matt Huggins

I tried.  There's one project that's intended to help integrate phpBB
with CakePHP, but it's outdated.  Then there are 2 forum projects from
last year that only had a couple updates and have no files available
for download.

On May 20, 5:21 pm, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> you might look in cakeforge.org
>
>
>
> On Tue, May 20, 2008 at 3:18 PM, Matt Huggins <[EMAIL PROTECTED]> wrote:
>
> > I've tried to get a few known forums (phpBB, SMF, etc.) to integrate
> > into my custom CakePHP CMS, but I'm having so much difficulty.  I was
> > trying to see if anyone has made a forum coded in CakePHP that I can
> > plug into my app, but of course a Google search for "cakephp forum"
> > results in forums discussing CakePHP.
>
> > With that said, I'm looking for one of two things, whichever someone
> > can help me with:
>
> > 1. Help me find some code that works for integrating common PHP
> > bulletin board software (such as phpBB) into CakePHP, or
>
> > 2. Point me to a CakePHP coded forum that I can plug into my
> > application.
>
> > Thanks!
>
> --
> --
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot
>
> http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/http://blog.samdevore.com/cakephp-pages/i-cant-bake/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP Forum Software?

2008-05-20 Thread Samuel DeVore

you might look in cakeforge.org


On Tue, May 20, 2008 at 3:18 PM, Matt Huggins <[EMAIL PROTECTED]> wrote:
>
> I've tried to get a few known forums (phpBB, SMF, etc.) to integrate
> into my custom CakePHP CMS, but I'm having so much difficulty.  I was
> trying to see if anyone has made a forum coded in CakePHP that I can
> plug into my app, but of course a Google search for "cakephp forum"
> results in forums discussing CakePHP.
>
> With that said, I'm looking for one of two things, whichever someone
> can help me with:
>
> 1. Help me find some code that works for integrating common PHP
> bulletin board software (such as phpBB) into CakePHP, or
>
> 2. Point me to a CakePHP coded forum that I can plug into my
> application.
>
> Thanks!
> >
>



-- 
-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

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



CakePHP Forum Software?

2008-05-20 Thread Matt Huggins

I've tried to get a few known forums (phpBB, SMF, etc.) to integrate
into my custom CakePHP CMS, but I'm having so much difficulty.  I was
trying to see if anyone has made a forum coded in CakePHP that I can
plug into my app, but of course a Google search for "cakephp forum"
results in forums discussing CakePHP.

With that said, I'm looking for one of two things, whichever someone
can help me with:

1. Help me find some code that works for integrating common PHP
bulletin board software (such as phpBB) into CakePHP, or

2. Point me to a CakePHP coded forum that I can plug into my
application.

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



A couple thoughts? Your suggestions?

2008-05-20 Thread rloaderro

Hello, I am a big fan of Cake. Recently I have been having to use
other MVC frameworks and came across a couple bits that I would love
to see duplicated in Cake (my framework of choice).

- Symfony function name caching

When Symfony is in development mode it compiles an index of every
function of every class that exists in it's folder hierarchy. That is
to say, by merely placing an external class (example.php) in one of
the folders Symfony knows to search in, you can use all the methods of
that class without having to "include" the class first. I think this
would be great for Cake to use in the case of Components, Helpers (esp
Helpers), etc. Meaning I could reference Helper function from my Views
without having to first include them in the Controller - Cake would
reference the function name index and create the instance of the
appropriate Helper class (if it doesn't exist already) all
automatically.

- Model-Glue 3 automagic controllers

Now we're getting far from the PHP path - but this great MVC framework
for Coldfusion features "automagic" controllers. That is, if the
application is running in development mode and you reference a
controller that doesn't exist, rather than get a 404 you get a page
offering you different options to create the missing controller. While
MG3 mostly deals with event creation / broadcast and XML config, Cake
could benefit from a GUI frontend to the Bake script. It is like
mating the functionality of a Wiki with a programming framework.

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



Re: General purpose page / design issues

2008-05-20 Thread Matt Huggins

I've been using CakePHP for almost 2 years now, and I still don't know
what the best way to do this is.  The way I do it is I end up creating
an added action in one of my controllers, and I change the routing for
the homepage to point there.  I'd really like to know of a better
approach to this, as I haven't found any good real-world example.

On May 20, 2:17 pm, W Marsh <[EMAIL PROTECTED]> wrote:
> Hi.
>
> If you look at most web sites you will see that their index pages are
> generally a mish-mash of different functionality. For example, they
> might give a summary of recent blog posts coupled with other
> statistics, all relating from various models in the system.
>
> How does this fit into the model-view-controller mentality?
> Controllers and models tend to be focused on one specific piece of
> functionality in the examples I've seen. There are no good examples of
> real world usage.
>
> I should point out this is a design/best practices question. I know
> HOW to make an index/general purpose page work, but I would like to
> hear some wisdom on how to do it in the CakePHP spirit.
>
> Thanks.
>
>   - Wayne
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is migrations support planned for Cake?

2008-05-20 Thread Aaron Shafovaloff

It'd be great if schema arrays could include an "old_name" field, so
that CakePHP could not only create fields and create tables, but
rename them. In other words, something like:

class BlogSchema extends CakeSchema {
public $posts = array(
'id' => array('type' => 'integer', 'null' => false, 'default'
=> NULL, 'key' => 'primary'),
'title' => array('type' => 'string', 'null' => false, 'length'
=> 100, 'old_name' => 'name'),
'content' => array('type' => 'text', 'null' => false,
'old_name' => 'body'),
'indexes' => array('PRIMARY' => array('column' => 'id',
'unique' => 1))
);
}

Get my drift? If we could somehow tell Cake the history of a
particular table or field, it seems like we could get the best of both
worlds.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is migrations support planned for Cake?

2008-05-20 Thread Keith

Well here's the deal...

I played around with Schema a bit last night.  I have only a few
issues with it in practice:

1.  It doesn't handle autoincrement correctly in the latest nightly
build when you generate a schema from an existing table.
2.  The downloadable 1.2 beta has major bugs in it like an incorrect
refernce to the string tokenizer so newbies may not even be fully
exploring Schema in the console!

Aside from that...

You can basically use the schema tool as migrations.

You can create Schema.php and then create Schema_2.php and so on.
You're then able to note version numbers you want to "migrate" to in
the console.  So far as I can tell, it has a lot in common with the
old way that migrations worked in Rails 2.0.

Given that this is now how Schema works I think it may be worthwhile
to investigate different ways to use Schema.  Dardo has one
methodology that he's been evangelizing in this thread.  I wonder if
we could get phpNut or someone on the core team more familiar with
Schema's development to comment on the design decisions behind it
given the functionality that hasn't been talked about on here.  I'll
probably put together a little tutorial or something for my blog once
I get everything all worked out on my own, but this was news to me!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Email Component sends email with empty body

2008-05-20 Thread Ketan Patel

Hi, for debug... it doesn't print now.. They changed the code for
debug, so now it is only put in the Session variable. So to print out
in the controller just for debugging to do this...

pr($this->Session->read('Message.email'));

Earlier in the code, they had the 'echo $fm' statement which is now
missing, don't know what was the reason to do so. But try the above
and it should work !!


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



General purpose page / design issues

2008-05-20 Thread W Marsh

Hi.

If you look at most web sites you will see that their index pages are
generally a mish-mash of different functionality. For example, they
might give a summary of recent blog posts coupled with other
statistics, all relating from various models in the system.

How does this fit into the model-view-controller mentality?
Controllers and models tend to be focused on one specific piece of
functionality in the examples I've seen. There are no good examples of
real world usage.

I should point out this is a design/best practices question. I know
HOW to make an index/general purpose page work, but I would like to
hear some wisdom on how to do it in the CakePHP spirit.

Thanks.

  - Wayne

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



Re: Email Component sends email with empty body

2008-05-20 Thread donnerbeil

Hi!

I couldn't get the delivery=debug working. But I now found out, that
if I set sendAs to 'html' or 'text' instead of 'both' the email is
received with a correct mail body. I finally found this ticket
https://trac.cakephp.org/ticket/1851 that describes something
similiar. But as I use a fresh nightly, that shouldn't be the case.

So the only solution for me is to send Emails in either html or text.

Maybe this thread and all the links help someone to solve similar
problems. If someone has the ultimate solution and can tell me, why
the delivery='debug' didn't work, that would be really great. I just
have to understand what's wrong.

Donnerbeil

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



oracle connection

2008-05-20 Thread Valerio

Hi, I'm a new cakephp developer... I'm trying to connect to an Oracle
db but it doesn't work. I use a native oracle driver and my connection
parameters into the database.php file are:

var $default = array('driver' => 'oracle',
   'connect' => 'oci_connect',
   'host' => 'localhost',
   'login' => 'Valerio',
   'password' => '031280',
   'database' => 'XE',
   'prefix' => '');

I have a tnsnames.ora entry:

XE =
  (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Valerio.INTARGET)(PORT = 1521))
(CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = XE)
)
  )

When I browse to the cakephp index of my project, it prints simply
"Your database configuration file is present."

Where is the problem?

Thanks

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



Re: Vendor issue: Duplicate class name

2008-05-20 Thread Matt Huggins

Ugh, I'm screwed if there's nothing I can do about this now. :/

On May 20, 1:51 pm, jonknee <[EMAIL PROTECTED]> wrote:
> On May 20, 3:36 am, Matt Huggins <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to import a vendor class, but the class I'm importing in
> > turn references another 3rd party class named "cache". Since there is
> > already a CakePHP class named "Cache", I get an error message stating
> > "Fatal Error: Cannot redeclare class cache in [filename]".
>
> > Does anyone have any clue how I can work around this? I don't want to
> > rename the vendor class since I'll need to perform future upgrades to
> > the class, not to mention that the class name is referenced throughout
> > much of the 3rd party code. I have no idea where to go from here.
> > Please help!
>
> This is why namespaces are being introduced into PHP (originally as
> part of 6, but backported to 5.3)
>
> http://us2.php.net/manual/en/language.namespaces.php
>
> Unfortunately that's not going to help you now. You may be stuck
> renaming manually (well at least with a regex).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Admin Routing Problem

2008-05-20 Thread Joel K.

Hello,

I'm using admin routing for a personal site that I'm building:
mrjoelkemp.com. Admin routing was working on the appropriate modules
(namely software and writing), however, oddly, it seems that over the
past week the routing has been failing on the writing module, but not
the software module. I'm sure that, in general, the code is similar
between both modules (with the module name discrepancy):

if($session->read('User.admin') == 1)
echo $html->link('New Article', '/admin/articles/add');


Here's the admin_add controller function for the writing (article)
module:

function admin_add()
{
 $this->checkAuthentication();

if (!empty($this->data['Article']))
{
   if($this->Article->save($this->data['Article']))
   {
$this->redirect('/articles/');
   }
}
}

And here's that checkAuthentication() function:

function checkAuthentication()
{
if (!$this->Session->check('User'))
{
  // Save intended URL in format '/controller/action/param'
  $this->Session->write('intended_url', substr($this->here,
strlen($this->base)));
  $this->redirect('/users/login');
}
}//end checkAuthentication()

If this is unrelated to code, and perhaps, has something to do with
session logs or tmp cache files, please let me know. I've cleared them
all, to no avail.

Thanks.

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



Re: Vendor issue: Duplicate class name

2008-05-20 Thread jonknee

On May 20, 3:36 am, Matt Huggins <[EMAIL PROTECTED]> wrote:
> I'm trying to import a vendor class, but the class I'm importing in
> turn references another 3rd party class named "cache". Since there is
> already a CakePHP class named "Cache", I get an error message stating
> "Fatal Error: Cannot redeclare class cache in [filename]".
>
> Does anyone have any clue how I can work around this? I don't want to
> rename the vendor class since I'll need to perform future upgrades to
> the class, not to mention that the class name is referenced throughout
> much of the 3rd party code. I have no idea where to go from here.
> Please help!

This is why namespaces are being introduced into PHP (originally as
part of 6, but backported to 5.3)

http://us2.php.net/manual/en/language.namespaces.php

Unfortunately that's not going to help you now. You may be stuck
renaming manually (well at least with a regex).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is migrations support planned for Cake?

2008-05-20 Thread joelmoss

> To me there seem to be 3 possible orders: C-E-D,  C-D-E, E-C-D.

Then in that edge case, you simply modify either migrations
themselves, or the timestamp, so that the order is correct.

One of the best things about Migrations, is that they are fully
incremental, and each one can be rolled back very easily.

It's all sounding to me that this is all about preference. All I know
is that the core team plan on reviewing Schema and Migrations after
1.2 is released, to see if there is an common ground. I certainly hope
we can do something, as there is a lot of overlay between the two. But
if Migrations is not used, then I will simply continue to use and
develop it as  third party add-on for Cake.

FYI: Migrations v4.0 Beta has just been released ->
http://developingwithstyle.com/2008/05/20/cakephp-migrations-v40-beta/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Distributed Cake

2008-05-20 Thread Mateo San Román

Great! I will check if this is waht I've  been looking for

Thank you, Gwoo!

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



Playing with Cake: how to hack into Cake's core within 20 lines codes

2008-05-20 Thread RainChen

Some times I want to add some methods or common attributes to all
Cake's objects. We know that most of the classes are extended from
class Object. But there are not something like AppObject as a AppModel
style API for us to extend objects. I dug deep into Cake's core
source. Finally I found Cake left a trap for us to hack into Cake's
core without hacking its source codes.

There are 3 steps:
1. open app/webroot/index.php
2. locate the line:
"if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {"
  and add followed codes before that line:

//hack by RainChen
//@ Thu May 15 23:53:55 CST 2008
//@ load extended class Object
if ($bootstrap = true) {
require CORE_PATH . 'cake' . DS . 'basics.php';
$TIME_START = getMicrotime();
require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php';
if(file_exists(APP.'object.php'))
{
// auto update CakeObject class file
if(!file_exists(APP.'cake_object.php') ||
filemtime(CAKE_CORE_INCLUDE_PATH.DS.LIBS.'object.php') >
filemtime(APP.'cake_object.php'))
{
file_put_contents(APP.'cake_object.php', 
str_replace('class Object
{', 'class CakeObject {',
file_get_contents(CAKE_CORE_INCLUDE_PATH.DS.LIBS.'object.php')));
}
require_once(APP.'cake_object.php');
require_once(APP.'object.php');
}
else
require LIBS . 'object.php';
require LIBS . 'inflector.php';
require LIBS . 'configure.php';
}
//hack end

3. save followed codes to app/object.php :


That's it !
It works even you update files in cake/*.

Any ways, this is just for fun or special purpose.(require Cake
version >= 1.2.0.6311 beta )

I used this trick to log objects that Cake used per request.For
example:

 Array
(
[1] => object
[2] => configure
[3] => cache
[4] => fileengine
[5] => file
[6] => folder
[7] => app
[8] => folder
[9] => folder
[10] => folder
[11] => folder
[12] => folder
[13] => folder
[14] => folder
[15] => folder
[16] => folder
[17] => dispatcher
[18] => router
[19] => inflector
[20] => folder
[21] => folder
[22] => pagescontroller
[23] => folder
[24] => appcomponent
[25] => security
[26] => sessioncomponent
[27] => requesthandlercomponent
[28] => authextcomponent
[29] => i18n
[30] => l10n
[31] => folder
[32] => appview
[33] => folder
[34] => folder
[35] => htmlhelper
[36] => formhelper
[37] => sessionhelper
)


PS: classes not extended from Object:
ShellDispatcher,CakeLog,Sanitize,JsHelperObject,XmlManager,TestManager

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



Re: Where do I find a cakephp developer in London?

2008-05-20 Thread John David Anderson


On May 20, 2008, at 11:23 AM, eagerterrier wrote:

>
> I work for a web design agency in NW London, UK.
>
> We have been searching for a cakephp developer for 6 months now with
> no joy. Even a sound php developer with limited MVC experience would
> be good. We have spent around £2k on recruitment agency fees all with
> no joy.

Maybe you need to pay the prospective developer more, rather than a  
recruitment agency. ;)

A good place to post is withcake.com, or here.

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



Where do I find a cakephp developer in London?

2008-05-20 Thread eagerterrier

I work for a web design agency in NW London, UK.

We have been searching for a cakephp developer for 6 months now with
no joy. Even a sound php developer with limited MVC experience would
be good. We have spent around £2k on recruitment agency fees all with
no joy.

Does anyone know a good place to stick adverts, or does anyone know of
someone who may be interested?


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



Re: Distributed Cake

2008-05-20 Thread Gwoo

http://c7y.phparch.com/c/entry/1/art,cakephp-rest
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



vendorPaths - How to use them in an appropriate way

2008-05-20 Thread schnumsel

Hi.

I am looking arround now for quite a while now (code and forums) but
couldn't find anything by now, so i'll make that post:

I am transfering many applications from cake 1.1 to cake 1.2. While
doing so, i thougth cleaning up would be  a nice thing. so i  figured
out a structure where i can keep the cake core clean (just checking it
out from svn) and adding two more libs (one companywide one
websitewide).
So in bootstrap.php of my application i add arrays for
controllerPaths, componentPaths etc.
Works like miracle!
Only for vendorPaths it does not. So I had a look in the Code an found
out the following:

vendor("TMXResourceBundle.php");

does not reflect vendorPaths!
Well, maybe it is not appropriate anymore i thought and so i tried to
figure out how App::import works.
Debugging arround a little bit i found out, that in
Configure::__loadBootstrap() all paths are considered except
vendorPaths.
So i wonder if this is a bug or if this is meant.
Anyhow changing that experimentally in the cake core did not succeed
me neither.

So my question is:
Has anybody succeeded to bind external vendors from outside core or
app-dir in a way conform with cake 1.2 philosophy?

Thanks a lot for answers.

Schnumsel

BTW: I used the latest cake 1.2 Version (rev. 6311)

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



Re: validation / FormHelper::error

2008-05-20 Thread Break

yes i know,

i tested that but the the error message still doesnt appear.
i really get headaches right now...

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



Distributed Cake

2008-05-20 Thread Mateo San Román

Hi,

I am currently working in a software system whose modules reside in
different servers. Is there a way that Cake could use actions from
remote controllers without breaking the neat syntax it has?

Every idea is welcome!
Best Regards,

Mateo

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



Re: Limiting Routes to specific Controllers

2008-05-20 Thread benjam

Both of those options seem like they would work perfectly.

I think I will implement the array version for my needs right now, and
look at the prefixing as a cleaner, more 'Cake' way in the future (I'm
on a deadline right now, and need something quick).

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



Re: validation / FormHelper::error

2008-05-20 Thread clrockwell

Without using $form->error, cake will default to displaying the error
unless you set 'error' => 'false' so you do not have to use $form-
>error.

You can then define the error message in your model:
var $validate = array(

  'firstname' => array(
'rule' => 'alphaNumeric',
'required' => true,
'allowEmpty' => false,
'message' => 'First name is required and only
alphanumeric characters are allowed'
  ),

  'lastname' => array(
'rule' => 'alphaNumeric',
'required' => true
  )

);
Alternatively, you can set 'error' => 'false' and return from your
controller an array of all errors, if any, using $this->Profile-
>invalidFields();

On May 20, 10:58 am, Break <[EMAIL PROTECTED]> wrote:
> Hey guys, i got a problem with the formhelper::error.
> I'm know tryin for 2 days to fix this problem:
> The validation in the code below works fine. if the field is empty the
> setFlash-Msg appears and the data isn't saved.
> But the error message doesnt appear.
>
> MODEL
> #
>
> class Profile extends AppModel {
> var $name = 'Profile';
> var $belongsTo = array(
>'User' => array (
>  'foreignKey' => 'id'
>)
>  );
> var $validate = array(
>
>   'firstname' => array(
> 'rule' => 'alphaNumeric',
> 'required' => true
>   ),
>
>   'lastname' => array(
> 'rule' => 'alphaNumeric',
> 'required' => true
>   )
>
> );
>   }
>
> CONTROLLER
> 
>
> class ProfilesController extends AppController {
> var $name = 'Profiles';
>
> function index() {
>   if(!empty($this->data)) {
> $this->Profile->id = $this->Session->read('id');
> if($this->Profile->save($this->data)) {
>   $this->Session->setFlash('Saved');
> } else {
>   $this->Session->setFlash('Error');
> }
>   }
>
>   $this->Profile->id = $this->Session->read('id');
>   $profile = $this->Profile->read();
>   $this->set('profile', $profile);
> }
>
> }
>
> VIEW
> ##
>
> create('Profile', array('action' => 'index'));?>
> input('firstname', array('value' => $profile['Profile']
> ['firstname'], 'size' => 50, 'maxlength' => 100, 'label' =>
> 'Firstname', 'class' => 'input', 'div' => false));?>
> error('firstname', 'Please fill in firstname');?>
> end();?>
>
> I hope you can help me.
> (sorry for mistakes my english is not the best)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Setting the meta description

2008-05-20 Thread Jared

Kyle,
Thanks that is what I ended up doing just wanted to make sure that was
the right way to do things.

On May 19, 6:41 pm, Kyle Decot <[EMAIL PROTECTED]> wrote:
> This is how I do it. In my layout I have:
>
>  content = ''$metaDescription" />"; } ?>
>
> then in my controller, I do:
>
> $md = "Mydescriptionhere...";
> $this->set("metaDescription",$md);
>
> I hope this helps
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with HABTM not getting related data

2008-05-20 Thread Joel Perras

If I understand correctly, you want to be able to find parts that
belong to a common model from your Model controller.

First, you should add in the 'with' parameter to your Parts model and
Model model (say that a couple times fast).  In your PartsModel:
'with'=> 'ModelsPart' and similarly in your ModelModel.  This will
tell Cake to bind the join models correctly so that you can retrieve
associated model data through simple find() calls instead of having to
dynamically bind and unbind models.

Now you should be able to run:
$this->Model->PartsModel->find('all',
array('conditions'=>array('PartsModel.model_id'=>4))

Also, if you live on the bleeding edge of the Cake nightlies, then you
might want to check out the 'Containable' behaviour.  It has zero
documentation as of this point, but the test cases give you a good
idea of what it's meant to do.

-Joel.

On May 20, 5:05 am, Reza Muhammad <[EMAIL PROTECTED]> wrote:
> Thanks for the link.
>
> I did modelize my HABTM table, now I have a "ModelsPart" model, and it  
> has a $belongsTo to Part and Model.
>
> Unfortunately, getting related parts when I'm using find() or  
> findAll() in ModelsController doesnt work, but I can get related  
> models from PartsController.
>
> Any more ideas?
>
> On May 20, 2008, at 3:27 PM, Matt Huggins wrote:
>
>
>
> > You need to modelize your HABTM table.  Hopefully this link will help
> > you out.
>
> >http://cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join...
>
> > On May 20, 3:04 am, Reza Muhammad <[EMAIL PROTECTED]> wrote:
> >> Hi guys.
>
> >> I just tried to setup a HABTM relationship between "Model" and
> >> "Parts".  In my "Model" model.   I already created tables called
> >> 'models', 'parts', and 'models_parts'.
>
> >> Here's what I have in my models:
>
> >> - model.php
>
> >> class Model extends AppModel {
>
> >>         var $name = 'Model';
> >>         var $useTable = 'models';
> >>         var $validate = array(
> >>                 'name' => array(
> >>                         'rule' => VALID_NOT_EMPTY,
> >>                         'required' => true,
> >>                         'message' => 'Model name must only contains  
> >> letters and numbers'
> >>                 )
> >>         );
> >>         //The Associations below have been created with all  
> >> possible keys,
> >> those that are not needed can be removed
> >>         var $hasAndBelongsToMany = array(
> >>                 'Part' => array('className' => 'Part',
> >>                         'joinTable' => 'models_parts',
> >>                         'foreignKey' => 'model_id',
> >>                         'associationForeignKey' => 'part_id',
> >>                         'unique' => true,
> >>                         'conditions' => '',
> >>                         'fields' => '',
> >>                         'order' => '',
> >>                         'limit' => '',
> >>                         'offset' => '',
> >>                         'finderQuery' => '',
> >>                         'deleteQuery' => '',
> >>                         'insertQuery' => ''
> >>                 )
> >>         );
>
> >> }
>
> >> - part.php
>
> >> class Part extends AppModel {
>
> >>         var $name = 'Part';
> >>         var $useTable = 'parts';
>
> >>         //The Associations below have been created with all  
> >> possible keys,
> >> those that are not needed can be removed
>
> >>         var $hasAndBelongsToMany = array(
> >>                         'Model' => array('className' => 'Model',
> >>                                                 'joinTable' =>  
> >> 'models_parts',
> >>                                                 'foreignKey' =>  
> >> 'part_id',
>
> >> 'associationForeignKey' => 'model_id',
> >>                                                 'unique' => true,
> >>                                                 'conditions' => '',
> >>                                                 'fields' => '',
> >>                                                 'order' => '',
> >>                                                 'limit' => '',
> >>                                                 'offset' => '',
> >>                                                 'finderQuery' => '',
> >>                                                 'deleteQuery' => '',
> >>                                                 'insertQuery' => ''
> >>                         )
> >>         );
>
> >> }
>
> >> Now, the problem is, When I run find() from Parts Controller, I can
> >> get the data from table models_parts (So, I can tell which parts
> >> belongs to which models).  However, I also want to be able to get  
> >> data
> >> from table models_parts when I run find() from Models Controller.
>
> >> I have set both of these controllers to use recursive = 2 ($this-
> >> >Part-
> >>  >recursive = 2, and $this->Model->recursive=2), yet it only works
> >> from Parts, not the model.
>
> >> Should I be creating a ModelPart model too?
>
> >> Please help me out, tha

Re: Issue with displaying image - trailing slash on url causes issue

2008-05-20 Thread clrockwell



On May 20, 10:43 am, grigri <[EMAIL PROTECTED]> wrote:
> I'd have thought this would work:
>
> 
>   #header_right { background: #FFF url( base/rotate/'.$imgBase.'/'.$session->read('sessionImg.'.$imgBase)); ?>) 0 0 
> no-repeat; }
>
> 

And you'd be correct, that works exactly as I want it to.  Thank you
much!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



validation / FormHelper::error

2008-05-20 Thread Break

Hey guys, i got a problem with the formhelper::error.
I'm know tryin for 2 days to fix this problem:
The validation in the code below works fine. if the field is empty the
setFlash-Msg appears and the data isn't saved.
But the error message doesnt appear.

MODEL
#

class Profile extends AppModel {
var $name = 'Profile';
var $belongsTo = array(
   'User' => array (
 'foreignKey' => 'id'
   )
 );
var $validate = array(

  'firstname' => array(
'rule' => 'alphaNumeric',
'required' => true
  ),

  'lastname' => array(
'rule' => 'alphaNumeric',
'required' => true
  )

);
  }

CONTROLLER


class ProfilesController extends AppController {
var $name = 'Profiles';

function index() {
  if(!empty($this->data)) {
$this->Profile->id = $this->Session->read('id');
if($this->Profile->save($this->data)) {
  $this->Session->setFlash('Saved');
} else {
  $this->Session->setFlash('Error');
}
  }

  $this->Profile->id = $this->Session->read('id');
  $profile = $this->Profile->read();
  $this->set('profile', $profile);
}

}

VIEW
##

create('Profile', array('action' => 'index'));?>
input('firstname', array('value' => $profile['Profile']
['firstname'], 'size' => 50, 'maxlength' => 100, 'label' =>
'Firstname', 'class' => 'input', 'div' => false));?>
error('firstname', 'Please fill in firstname');?>
end();?>


I hope you can help me.
(sorry for mistakes my english is not the best)

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



Re: SQL Error: 2014

2008-05-20 Thread Ma'moon
ok, now i got it done :-)
it turned out that calling consequent stored procedure using $model->query(
$queryStr ) is causing memory issues through the execution of the controller
accessing the target associated model, to solve this issue i have created a
method inside my user defined model, call it manageMysqlResult, from within
this method you call "mysqli_next_result" which in its turn prepares the
next result set from a previous call to mysqli_multi_query(), here is
exactly how i have constructed my model:

*class Video extends AppModel {
var $name   = 'Video';
var $useTable = 'videos';
function manageMysqlResult**() {
$db =& ConnectionManager::getDataSource(
$this->useDbConfig );
$lastResult = mysqli_next_result( $db->connec );
}
}

*and from within my controller i call it like this:

*// get most watched videos
$mostWatched = $this->Video->query('CALL SP_getMostViewedVideos(1,3)');
$this->Video->**manageMysqlResult**();
$this->set('mostWatched' , $mostWatched);

// get most rated videos
$mostRated = $this->Video->query('CALL SP_getMostRatedVideos(1,3)');
$this->Video->**manageMysqlResult**();
$this->set('mostRated' , $mostRated);

// get recent added videos
$resentAdded = $this->Video->query('CALL SP_getMostRecentVideos(1,3)');
$this->Video->**manageMysqlResult**();
$this->set('resentAdded' , $resentAdded);

*hopefully that will help someone someday passing through this if facing
any!
Thanks for all the help "AD7six" really much appreciated, i owe you the
hottest cup of coffee ever :-)

- soosa
*
*
On Tue, May 20, 2008 at 4:14 AM, Ma'moon <[EMAIL PROTECTED]> wrote:

> According to this link "
> http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html"; the sql
> result set should be freed from memory in order to execute consequent
> queries after each other, am not sure if this is a bug in CakePHP or not but
> it seems that the result set is not being freed from memory after executing
> the queries consequently.
> is there any way that i can call mysql_free_result from the controller in
> order to the following:
>
> $mostWatched = $this->Video->query('CALL SP_getMostViewedVideos(1,3)');
> *$this->Video->freeUserDefinedQueryResultSet();*
> $mostRated = $this->Video->query('CALL SP_getMostRatedVideos(1,3)');
> *$this->Video->freeUserDefinedQueryResultSet();*
> $resentAdded  = $this->Video->query('CALL SP_getMostRecentVideos(1,3)');
> *$this->Video->freeUserDefinedQueryResultSet();*
>
> though this should be done from the core but it doesn't seem to be working!
>
> i am using version 1.1.19.6305, i forgot to say so above and am sorry for
> that, anyone?
>
>
> On Mon, May 19, 2008 at 6:06 AM, Ma'moon <[EMAIL PROTECTED]> wrote:
>
>> Hello guys,
>> i have a problem where i am trying to execute the following queries in my
>> controller "consequently!":
>> $mostWatched = $this->Video->query('CALL SP_getMostViewedVideos(1,3)');
>> $mostRated = $this->Video->query('CALL SP_getMostRatedVideos(1,3)');
>> $resentAdded  = $this->Video->query('CALL SP_getMostRecentVideos(1,3)');
>> and it results to "*SQL Error: 2014: Commands out of sync; you can't run
>> this command now in cake/libs/model/datasources/dbo_source.php on line 440
>> *"
>>
>> i would really appreciate it if any one can tell me why this is happening
>> and how to solve it!
>>
>
>

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



Re: Finding popular activities

2008-05-20 Thread Dan Soendergaard

Thank you so much! I'm still not entirely sure about how it works, but
I'll be reading up on bindModel :)
I've taken a look at counterCache and yes, it looks much easier. I'll
consider using it instead.

Again - thanks!

On 20 Maj, 15:41, grigri <[EMAIL PROTECTED]> wrote:
> $this->Activity->bindModel(array(
>   'hasOne' => array(
>     'TotalUsers' => array(
>       'className' => 'User',
>       'fields' => 'COUNT(TotalUsers.id) AS num_users'
>     )
>   )
> );
> $popularActivities = $this->Activity->find('all', array(
>   'conditions' => '1=1 GROUP BY Activity.id HAVING num_users > 0',
>   'order' => 'num_users DESC',
>   'limit' => 10,
>   'recursive' => 0
> ));
>
> Will find the 10 most popular activites, most popular first.
> Activities with no users are not returned.
>
> Also, look into counterCache - it will make this much easier for you.
>
> On May 20, 2:26 pm, Dan Soendergaard <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > My app contains a User model and an Activity model. A User belongsTo
> > an Activity. The foreign key is activity_id.
> > Now, I want to make a list of popular activities where popularity is
> > measured by how many users are signed up for it. I'm not sure how to
> > do this. Can I use $this->Activity->find()? If yes, how do I tell it
> > that I want the count of users for each activity?
>
> > Thanks in advance :)
>
> > Sincerely,
> > Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Email Component sends email with empty body

2008-05-20 Thread donnerbeil

@Ketan

My new send function looks now like that:

function _sendNewUserMail($id) {
$User = $this->User->read(null,$id);
$this->Email->to = '[EMAIL PROTECTED]';
$this->Email->bcc = array('[EMAIL PROTECTED]');  //
note
  // this
could
be just a string too
$this->Email->subject = 'Welcome to our really cool
thing';
$this->Email->replyTo = '[EMAIL PROTECTED]';
$this->Email->from = '[EMAIL PROTECTED]';
$this->Email->template = 'activate'; // note no '.ctp'
//Send as 'html', 'text' or 'both' (default is 'text')
$this->Email->sendAs = 'both'; // because we like to send
pretty
mail
//Set view variables as normal
$this->set('User', $User);
//Do not pass any args to send()
$this->Email->delivery='debug';
$this->Email->send();
 }


The emails aren't send any more, but I don't get any debug output. In
core.php, the debug level is set to 2.
What am I doing wrong? When I remove $this->Email->delivery='debug';
the emails are sent again. Where is the debug output. Also looked in
the html-sourcecode, to  check if it's hidden somewhere. nope, it's
just not there.

Donnerbeil

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



Re: Issue with displaying image - trailing slash on url causes issue

2008-05-20 Thread grigri

I'd have thought this would work:


  #header_right { background: #FFF url(read('sessionImg.'.$imgBase)); ?
>) 0 0 no-repeat; }

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



Re: Email Component sends email with empty body

2008-05-20 Thread donnerbeil

Hi!

Here is my send function in users_controller.php
The $id is given from another function. I debug($id) and it's ok.


function _sendNewUserMail($id) {
$User = $this->User->read(null,$id);
$this->Email->to = '[EMAIL PROTECTED]';
$this->Email->bcc = array('[EMAIL PROTECTED]');  // note
  // this could
be just a string too
$this->Email->subject = 'Welcome to our really cool thing';
$this->Email->replyTo = '[EMAIL PROTECTED]';
$this->Email->from = '[EMAIL PROTECTED]';
$this->Email->template = 'activate'; // note no '.ctp'
//Send as 'html', 'text' or 'both' (default is 'text')
$this->Email->sendAs = 'both'; // because we like to send pretty
mail
//Set view variables as normal
$this->set('User', $User);
//Do not pass any args to send()
$this->Email->send();
 }

The app\views\elements\email\html\activate.ctp

Dear ,
    Thank you for your interest.

The app\views\elements\email\text\activate.ctp

Dear ,
   Thank you for your interest.

The app\views\layouts\email\html\default.ctp







The app\views\layouts\email\text\default.ctp




So my layout is default.ctp and my element/template is activate.ctp.
Is that a problem? Or do I have to specifically set the layout
somewhere?

I also found this yesterday:http://marcgrabanski.com/tags.php?
tag=CakePHP

This could be a problem, since my users_controller.php is encoded in
utf8 because of some special chars in $this->Session-setFlash();

Setting $this->Email->charset = 'iso-8859-15'; didn't help

I'm confused

Donnerbeil

Also my DB is utf8 encoded. And my subject is also changed to
something like, "=?UTF-8?B?V2VsY29tZ..."

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



Re: Limiting Routes to specific Controllers

2008-05-20 Thread Dardo Sordi Bogado

> How (if it's possible), can I limit the controllers allowed to go
> through the /training dir?  I only have four controllers that I want
> to have access to the /training dir, all other requests should show an
> error, or better yet, redirect to the proper controller directory.

I'm not sure but something like this may work:

$trainingControllers = array( 'Things', 'Stuff' );
foreach ( $trainingControllers as $controller ) {
 Router::connect("/training/$controller/:action/*",
array('controller'  => $controller, 'action' => 'index'));
}

HTH,
- Dardo Sordi.

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



Re: Problem calling user controler from app controler.

2008-05-20 Thread clrockwell

You can put the authentication in users_controller.php, make an
element in app/views/elements that has your login form.

Put the login form anywhere using $this->element().  When you call
your authentication, store the current url in a session and after
success, redirect to that URL.  Or use ajax and not worry about the
whole redirect thing.

I do not understand why you are doing this in app_controller.  When
someone logs in you store it in a session, your element can display
the login form or the user names based on an if(){}.



In your auth script, you can store the

On May 20, 9:45 am, Knud Soerensen <[EMAIL PROTECTED]> wrote:
> Filip Camerman wrote:
> > Hi,
> > The bit of code you pasted does give the impression that you have some
> > things mixed up. For an example of simple user login, read
> >http://book.cakephp.org/view/327/simple-user-authentication.
>
> The problem with the example is that it is to simple !
>
> First I don't like the idea that the user gets redirected to
> a login page, if he is not login.
>
> I wan't every page to display a login bar if the user is not logged in.
>
> Also I can't use the auth component because I use openid so
>  my user model don't have a password field.
>
> I seams to me that i would have to write my own auth component
> to archive what I want or is the another way ??
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Email Component sends email with empty body

2008-05-20 Thread Ketan Patel

There is a delivery option for debug in the EmailComponent.

$this->Email->delivery = 'debug'; //'smtp';

Use that for development and testing of the emails. With 'debug'
option, you will see your email content print out on the page itself
which helps in faster debugging. Once you are happy with output and
sorted out all issues, flip the delivery mode to whatever you wish.



On May 19, 9:54 pm, donnerbeil <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I'm using the latest nightly so this is probably not the 
> case:https://trac.cakephp.org/ticket/3820
>
> But I still receive empty emails. The strangest part is, that it
> depends on the email provider. I have an email account at my own
> domain. I check the mails with Thunderbird (IMAP) and it works. Then I
> have an Email account at freenet.de, a popular email provider in
> germany. When I check the freenet account with thunderbird(Pop3) I get
> an empty email body. When I check the freenet account via the
> webinterface, I can read the body but it's not formatted correctly. It
> shows the headers then.
>
> I followed exactly the instructions 
> here:http://manual.cakephp.org/view/269/sending-a-basic-message
>
> I assume, that it has maybe something to do with utf8 encoding.
> Because when I check the freenet mail with Thunderbird and manually
> set the encoding for the mail  to utf8 in Thunderbird, then I can at
> least read the email, but still only with all the headers in it.
>
> I'm trying to fix this for over a week now. My whole web app is
> working, but I need to send an email with an activation code for the
> new users. So please help me fix this last issue.
>
> Thanks a lot for any help.
>
> Donnerbeil
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem calling user controler from app controler.

2008-05-20 Thread Ketan Patel

You do not have the concepts clear based on your comments. However do
this.

Create an element that shows the 'users login' form (which should be
handled by only one controller, 'users' in this case) if the user is
not logged in. Then on view/layout just call this element and you will
have the login form showed to user. Understand the MVC concepts, the
rest will fall in place.

On May 20, 9:45 am, Knud Soerensen <[EMAIL PROTECTED]> wrote:
> Filip Camerman wrote:
> > Hi,
> > The bit of code you pasted does give the impression that you have some
> > things mixed up. For an example of simple user login, read
> >http://book.cakephp.org/view/327/simple-user-authentication.
>
> The problem with the example is that it is to simple !
>
> First I don't like the idea that the user gets redirected to
> a login page, if he is not login.
>
> I wan't every page to display a login bar if the user is not logged in.
>
> Also I can't use the auth component because I use openid so
>  my user model don't have a password field.
>
> I seams to me that i would have to write my own auth component
> to archive what I want or is the another way ??
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem calling user controler from app controler.

2008-05-20 Thread Knud Soerensen

Filip Camerman wrote:
> Hi,
> The bit of code you pasted does give the impression that you have some
> things mixed up. For an example of simple user login, read
> http://book.cakephp.org/view/327/simple-user-authentication .
>
>   
The problem with the example is that it is to simple !

First I don't like the idea that the user gets redirected to
a login page, if he is not login.

I wan't every page to display a login bar if the user is not logged in.

Also I can't use the auth component because I use openid so
 my user model don't have a password field.

I seams to me that i would have to write my own auth component
to archive what I want or is the another way ??
> >
>
>   


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



Re: Issue with displaying image - trailing slash on url causes issue

2008-05-20 Thread [EMAIL PROTECTED]

Thanks for the replies jonknee and 3lancer.eu,

The generated HTML is a style tag that is inserted into each page, so
this:
 

#header_right { background: #FFF url(base/
rotate//read('sessionImg.' . $imgBase);?>) 0 0 no-repeat; }



generates #header_right {background: #FFF url('../img/base/rotate/ex/
1_05.jpg') 0 0 no-repeat;} or
#header_right {background: #FFF url('img/base/rotate/ex/1_05.jpg') 0 0
no-repeat;},
all depending on the trailing slash.

I do not need a  tag, which is what $html->image() generates, I
just need a reference to the image.

Thanks all, I still do not have this worked out, so all suggesstion
are helpful

On May 19, 5:36 pm, "3lancer.eu" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > What does the generated HTML look like? Sounds like it's using a
> > relative path.
>
> Exactly, any reason for not using $html->image() for that?
>
> Piotr

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



Re: Finding popular activities

2008-05-20 Thread grigri

$this->Activity->bindModel(array(
  'hasOne' => array(
'TotalUsers' => array(
  'className' => 'User',
  'fields' => 'COUNT(TotalUsers.id) AS num_users'
)
  )
);
$popularActivities = $this->Activity->find('all', array(
  'conditions' => '1=1 GROUP BY Activity.id HAVING num_users > 0',
  'order' => 'num_users DESC',
  'limit' => 10,
  'recursive' => 0
));

Will find the 10 most popular activites, most popular first.
Activities with no users are not returned.

Also, look into counterCache - it will make this much easier for you.

On May 20, 2:26 pm, Dan Soendergaard <[EMAIL PROTECTED]> wrote:
> Hi,
>
> My app contains a User model and an Activity model. A User belongsTo
> an Activity. The foreign key is activity_id.
> Now, I want to make a list of popular activities where popularity is
> measured by how many users are signed up for it. I'm not sure how to
> do this. Can I use $this->Activity->find()? If yes, how do I tell it
> that I want the count of users for each activity?
>
> Thanks in advance :)
>
> Sincerely,
> Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Finding popular activities

2008-05-20 Thread Dan Soendergaard

Hi,

My app contains a User model and an Activity model. A User belongsTo
an Activity. The foreign key is activity_id.
Now, I want to make a list of popular activities where popularity is
measured by how many users are signed up for it. I'm not sure how to
do this. Can I use $this->Activity->find()? If yes, how do I tell it
that I want the count of users for each activity?

Thanks in advance :)

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



Re: Layout change in edit case(help me please)

2008-05-20 Thread djiize

you're welcome

I'll try to answer your questions, but I've got some warns before:
- in your view, the action of your form is wrong
'action' => '/add/index'
should be
'action' => '/users/add/'
- you changed your flash call in 'edit' action, but not in others

And now, to upload your image:
Your form is correct, what's miss is business logic in your
controller's edit action.
Be sure to work with DEBUG set to 2 (in app/config/core.php)
Check the value of $this->data:
function edit($id = null) {
  if (!empty($this->data)) {
pr($this->data);
  }
}
you'll see an array like this one:
array['User'] = array(
  'name' => '...',
  'address' => '...',
  '...' => '..',
  'image' => array(
'name' => 'original_name.ext', // the name of the file in your
computer
'type' => 'mime/type', // MIME type : image/jpeg, image/gif, ...
'size' => '123', // size in bytes
'tmp_name' => '/tmp/321654', // where is your file being uploaded
'error' => 0, // error code, 0 if upload OK
  )
)

you must copy the temp file in your server
$save_dir = 'a path on you server'; // maybe 'files' for '/app/webroot/
files' folder
move_uploaded_file($this->data['User']['image']['tmp_name'],
$save_dir . $this->data['User']['image']['name']);

I hope this is clear enough. If not, try to search on Google 'PHP
upload', it's PHP basics.
And after, when you'll know well enough PHP & CakePHP, you could try
'Upload behavior' in this group

On 20 mai, 12:48, vishal <[EMAIL PROTECTED]> wrote:
> Thanks you very much my friend...!!! I have done the changes & my
> problem is solved..!!!
>
> thanks you very much..
>
> friend can you help me in this matter also if you have few minutes for
> me..??
>
> I have problem in uploading the image..I want to display the image as
> well as store the image in database...
> I mean to say these are my files:
>
> add.ctp:
> Add User
>
>   echo $form->create('User', array('action' => '/add/
> index','enctype'=>'multipart/form-data'));
> echo  $form->input('name');
> echo $form->input('address', array('rows' => '3'));
> echo $form->input('phone');
> echo $form->input('mobile');
> echo $form->input('email');
> echo $form->input('city');
> echo $form->input('state');
> echo $form->input('image',array('type' => 'file'));
> echo $form->end('Save User');
> ?>
>
> This is my controller file:
>
>  class UsersController extends AppController {
>
>         var $name = 'Users';
>         var $layout='user';
>
>         var $paginate = array(
>         'limit' => 4,
>         'order' => array(
>             'User.name' => 'asc'
>         )
>     );
>
>         function index() {
>                 //$this->set('users', $this->User->find('all'));
>                 $data = $this->paginate('User');
>           $this->set(compact('data'));
>         }
>
>         function view($id) {
>                 $this->User->id = $id;
>                 $this->set('user', $this->User->read());
>
>         }
>
>         function delete($id) {
>         $this->User->del($id);
> $this->flash('The user with id: '.$id.' has been deleted.', 'http://
> 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
>
> }
>
>         function add() {
>                 if (!empty($this->data)) {
>
>                                 $this->flash('Your detail has been 
> saved.','http://192.168.0.60/
> vishal/cake_1.2.0.6311-beta/app/users/index');
>                         }
>
>                 }
>
>         function edit($id = null) {
>         $this->User->id = $id;
>         if (empty($this->data)) {
>                 $this->data = $this->User->read();
>         } else {
>                 if ($this->User->save($this->data['User'])) {
>                         $this->flash('Your detail has been updated.', 
> array('action' =>
> 'index'));
>                 }
>         }
>
> }
> }
>
> ?>
>
> the problem is that I want to store the image path in database field &
> I want to dispaly the image at front end...i.e where the images are go
> in which folder 
> the path is saved by using above code
> have you got my issue ??
>
> thanks,
> vishal
>
> On May 20, 2:42 pm, djiize <[EMAIL PROTECTED]> wrote:
>
> > it's due to Cake routing and URL rewriting
> > in some cases, prefer HTML helper instead your own HTML
>
> > in your layout, change
> >  > type="text/css" />
> > by
> > css('style') ?>
>
> > and change al
> > 
> > by
> > image('your_image.gif') ?>
>
> > And last, in your "flash" calls, don't repeat the host, path, etc...
> > just do:
> > $this->flash('Your detail has been updated.', '/users/index');
> > or better, as you already are in Users controller (and you'll get
> > others benefits, as reverse routing):
> > $this->flash('Your detail has been updated.', array('action' =>
> > 'index'));
>
> > On 20 mai, 10:33, vishal <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
> > >      Myself vishal facing a problem while editing.when i edit the
> > > layout changes. so anybody help me please..
> > > But in case of add it look well.
> > > This is the details o

Re: Help me please for flash(swf file) handling

2008-05-20 Thread Dardo Sordi Bogado

Hi,

just do as you would do if you were not using cake, but better if you
get the url for the file with:

$flashUrl =  $form->url('/files/main_flash4.swf');



Please, next time use the paste bin : http://bin.cakephp.org

On Tue, May 20, 2008 at 9:08 AM, vishal <[EMAIL PROTECTED]> wrote:
>
> Hi,
>   My swf file is located in /app/webroot/files/main_flash4.swf
>
> But I don't know the correct code how to display this flash on fron
> end i.e on layout page.
>
>
> my layout file is :
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
>
> css('style') ?>
>
> 
> 
>
> 
>
>
>
>
> align='right'>Home| Our Company| Sitemap|
> Projects
>
>
> align="center">>image('logo.gif') ?> 
>
> //**I want to display flash here in this
> 
>
> 
>
> $html->image('logo.gif') ?>
>
>
>
>
>
>
>
> cellspacing="3" border="0"
> align="center">
> $html->link('User', 'http://
> 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index'); ?> tr>
> $html->link('Messages',
> 'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
> index'); ?>
> $html->link('Account',
> 'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
> index'); ?>
>
>
>
>
>
>
>
>
>
>contactus| About us| privacy 
> policy
>
>
> 
> 
> 
>
>
>
> so please tell me few lines of code for showing swf file.
>
> Thanks in advance
> vishal
>
> >
>

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



Re: can anybody help me for paging

2008-05-20 Thread Dardo Sordi Bogado

Start here:

http://book.cakephp.org/view/164/pagination

And the next time you need to paste such a lng chunk of code,
pleas use the paste bin : http://bin.cakephp.org .

On Tue, May 20, 2008 at 9:57 AM, vishal <[EMAIL PROTECTED]> wrote:
>
> Hi,
>I am new on this community..can any body help me for paging.
>
> this is my file:
> Admin Panel
>
>
> link('Add User', 'http://
> 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/add'); ?>
>
>  align="center" border="0">
>
>
>  Name
>  
>  Address
>  
>  Phone
>  
>  Email
>  
>  Action
>  
>  
>
>
>
>
>
>
> $user['User']['name']; ?> td>
> $user['User']['address']; ?
>>
>
> $user['User']['phone']; ?
>>
> $user['User']['email']; ?
>>
>
>http://192.168.0.60/vishal/
> cake_1.2.0.6311-beta/app/users/delete/>">Delete
>link('Delete', 
> "'http://192.168.0.60/vishal/
> cake_1.2.0.6311-beta/users/{$user['User']['id']}", null, 'Are you
> sure?' )?> 
>link('Edit User', 
> "http://192.168.0.60/vishal/
> cake_1.2.0.6311-beta/app/users/edit/{$user['User']['id']}" )?>
>
>
>
>
> 
>
>
> this is my controller file:
>
>  class UsersController extends AppController {
>
>var $name = 'Users';
>var $layout='user';
>var $components = array('Upload');
>
>
>//*
>var $paginate = array(
>'limit' => 4,
>'order' => array(
>'User.name' => 'asc'
>)
>);
>//
>
>function index() {
>//$this->set('users', $this->User->find('all'));
>$data = $this->paginate('User');
>  $this->set(compact('data'));
>}
>
>function view($id) {
>$this->User->id = $id;
>$this->set('user', $this->User->read());
>
>}
>
>function delete($id) {
>$this->User->del($id);
> $this->flash('The user with id: '.$id.' has been deleted.', 'http://
> 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
> }
>
>function add() {
>if (!empty($this->data)) {
>if ($this->User->save($this->data)) {
>
>
>
>echo $this->data['User']['image'];
>
>$destination = 
> realpath('../../app/webroot/img/uploads/') . '/';
>
>// grab the file
>$file = $this->data['User']['image'];
>
>// upload the image using the upload component
>$result = $this->Upload->upload($file, $destination, null,
> array('type' => 'resizecrop', 'size' => array('400', '300'), 'output'
> => 'jpg'));
>
>if (!$result){
>$this->data['User']['image'] = $this->Upload->result;
>} else {
>// display error
>$errors = $this->Upload->errors;
>
>// piece together errors
>if(is_array($errors)){ $errors = implode(" />",$errors); }
>
>$this->Session->setFlash($errors);
>//$this->redirect('/images/upload');
>exit();
>}
>if ($this->User->save($this->data)) {
>$this->Session->setFlash('Image has been added.');
>//$this->redirect('/images/index');
>} else {
>$this->Session->setFlash('Please correct errors 
> below.');
>unlink($destination.$this->Upload->result);
>}
>
>
>
>$this->flash('Your detail has been 
> saved.','http://192.168.0.60/
> vishal/cake_1.2.0.6311-beta/app/users/index');
>}
>
>}
>}
>
>function edit($id = null) {
>$this->User->id = $id;
>if (empty($this->data)) {
>$this->data = $this->User->read();
>} else {
>if ($this->User->save($this->data['User'])) {
>$this->flash('Your detail has been updated.', 
> array('action' =>
> 'index'));
>}
>}
> }
>
> }
> ?>
>
> Please tell me the correct code for puuting paginf on my index page.
>
> thanks in advance everybody..if you have few minutes for me..
>
> vishu
> >
>

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

Re: Div inserted after $form->create

2008-05-20 Thread Dardo Sordi Bogado

This has been discussed here before, look for the thread.

If my memory is good, it was needed for validating as XHTML Strict and
solution was to edit the source code of the helper.


On Tue, May 20, 2008 at 2:13 AM, Brian Rojas <[EMAIL PROTECTED]> wrote:
>
> I use the $form->create method in 1.2 like so:
>
> create(null,array('url' => array('controller' =>
> 'pages', 'action' => 'contact'), 'id' => 'ContactMiniForm', 'default'
> => false, 'type' => 'post')) . "\n"; ?>
>
> and the outputted HTML includes a div set to 'display:none' :
>
>  onSubmit="event.returnValue = false; return false;"> style="display:none;"> value="POST" />
>
> does anyone know if there is a way to stop this from happening, i
> couldn't find anything about this in the api
>
> >
>

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



can anybody help me for paging

2008-05-20 Thread vishal

Hi,
I am new on this community..can any body help me for paging.

this is my file:
Admin Panel


link('Add User', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/add'); ?>




  Name
  
  Address
  
  Phone
  
  Email
  
  Action
  
  












http://192.168.0.60/vishal/
cake_1.2.0.6311-beta/app/users/delete/">Delete
link('Delete', 
"'http://192.168.0.60/vishal/
cake_1.2.0.6311-beta/users/{$user['User']['id']}", null, 'Are you
sure?' )?> 
link('Edit User', "http://192.168.0.60/vishal/
cake_1.2.0.6311-beta/app/users/edit/{$user['User']['id']}" )?>







this is my controller file:

 4,
'order' => array(
'User.name' => 'asc'
)
);
//

function index() {
//$this->set('users', $this->User->find('all'));
$data = $this->paginate('User');
  $this->set(compact('data'));
}

function view($id) {
$this->User->id = $id;
$this->set('user', $this->User->read());

}

function delete($id) {
$this->User->del($id);
$this->flash('The user with id: '.$id.' has been deleted.', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}

function add() {
if (!empty($this->data)) {
if ($this->User->save($this->data)) {



echo $this->data['User']['image'];

$destination = 
realpath('../../app/webroot/img/uploads/') . '/';

// grab the file
$file = $this->data['User']['image'];

// upload the image using the upload component
$result = $this->Upload->upload($file, $destination, null,
array('type' => 'resizecrop', 'size' => array('400', '300'), 'output'
=> 'jpg'));

if (!$result){
$this->data['User']['image'] = $this->Upload->result;
} else {
// display error
$errors = $this->Upload->errors;

// piece together errors
if(is_array($errors)){ $errors = implode("",$errors); }

$this->Session->setFlash($errors);
//$this->redirect('/images/upload');
exit();
}
if ($this->User->save($this->data)) {
$this->Session->setFlash('Image has been added.');
//$this->redirect('/images/index');
} else {
$this->Session->setFlash('Please correct errors 
below.');
unlink($destination.$this->Upload->result);
}



$this->flash('Your detail has been 
saved.','http://192.168.0.60/
vishal/cake_1.2.0.6311-beta/app/users/index');
}

}
}

function edit($id = null) {
$this->User->id = $id;
if (empty($this->data)) {
$this->data = $this->User->read();
} else {
if ($this->User->save($this->data['User'])) {
$this->flash('Your detail has been updated.', 
array('action' =>
'index'));
}
}
}

}
?>

Please tell me the correct code for puuting paginf on my index page.

thanks in advance everybody..if you have few minutes for me..

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



Re: Problem calling user controler from app controler.

2008-05-20 Thread Filip Camerman

Hi,
The bit of code you pasted does give the impression that you have some
things mixed up. For an example of simple user login, read
http://book.cakephp.org/view/327/simple-user-authentication .


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



Re: new error

2008-05-20 Thread Sliv (Tim MacAleese)

Looks like your tmp folder isn't writeable by your web server

On May 20, 3:12 am, Raistlin Majere <[EMAIL PROTECTED]> wrote:
> I am getting:
>
> Warning: file_put_contents(/home/emmettbr/public_html/CakePHP/
> opinionsofamateurs/tmp/cache/models/
> default_emmettbr_toreadandtowrite_list) [function.file-put-contents]:
> failed to open stream: Permission denied in /home/emmettbr/public_html/
> CakePHP/cake/basics.php on line 936
>
> Warning: file_put_contents(/home/emmettbr/public_html/CakePHP/
> opinionsofamateurs/tmp/cache/models/default_articles) [function.file-
> put-contents]: failed to open stream: Permission denied in /home/
> emmettbr/public_html/CakePHP/cake/basics.php on line 936
>
> Warning: file_put_contents(/home/emmettbr/public_html/CakePHP/
> opinionsofamateurs/tmp/cache/models/default_rates) [function.file-put-
> contents]: failed to open stream: Permission denied in /home/emmettbr/
> public_html/CakePHP/cake/basics.php on line 936
>
> What should I do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: file handling from cake

2008-05-20 Thread Sliv (Tim MacAleese)

Have a look at the File class:

http://api.cakephp.org/1.2/class_file.html

On May 20, 6:35 am, oana <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I would like to know iwhat would be the way to follow if i want to
> create a file from within a cakephp page.
>
> The situation is like this:  i have a view which shows an applet (this
> applet holds a graph which describes a conversation from an xml file;
> the applet loads the correct file from a parameter i pass when laoding
> the page : view/2 loads conversation with id=2).
>
> My question is: when i want to start a new conversation, what do i do
> to create an xml file for that conversation and the write into it? Do
> i have to use javascript for this?
>
> Sorry if this has been posted, but i didn't find many topics about
> working with files
>
> Oana
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: fieldset display:none inserted within $form->create

2008-05-20 Thread Sliv (Tim MacAleese)

You mean the fieldset?  That's by design.  There's no elegant override
afaik.

On May 20, 1:13 am, Brian Rojas <[EMAIL PROTECTED]> wrote:
> I use the $form->create method in 1.2 like so:
>
> create(null,array('url' => array('controller' =>
> 'pages', 'action' => 'contact'), 'id' => 'ContactMiniForm', 'default'
> => false, 'type' => 'post')) . "\n"; ?>
>
> and the outputted HTML includes a div set to 'display:none' :
>
>  onSubmit="event.returnValue = false; return false;"> style="display:none;"> value="POST" />
>
> does anyone know if there is a way to stop this from happening, i
> couldn't find anything about this in the api
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Help me please for flash(swf file) handling

2008-05-20 Thread vishal

Hi,
   My swf file is located in /app/webroot/files/main_flash4.swf

But I don't know the correct code how to display this flash on fron
end i.e on layout page.


my layout file is :
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>



css('style') ?>









Home| Our Company| Sitemap|
Projects


image('logo.gif') ?> 

//**I want to display flash here in this




image('logo.gif') ?>








link('User', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index'); ?>
link('Messages',
'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
index'); ?>
link('Account',
'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
index'); ?>









contactus| About us| privacy 
policy








so please tell me few lines of code for showing swf file.

Thanks in advance
vishal

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



Re: HABTM search entries help

2008-05-20 Thread oana

Thanks for the explanations, i am starting to get used to how cake
works. :)

And about the solution, i am so ashamed ...it was one line of code i
forgot to delete from the user login function.

This line  was doing an update in the users table, which affected the
join table too.

I haven't seen it because in the login function i was doing a
redirect, and the update query wasn't visible. Maybe this helps other
newbies ;)

Many thanks four your patience, David



On May 20, 11:26 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> On 20 May 2008, at 16:48, oana wrote:
>
> > $this->User->Conversation->findAll() works, but retieves all the
> > conversations, not just the ones for a certain user
>
> True. Even though it looks like you're working on a User's
> Conversations,
> $this->User->Conversation->findAll();
> and
> $this->Conversation->findAll();
> are identical.
>
> All you're doing is execute the method findAll() of the Conversation
> model. It doesn't matter wether you're doing it via $this-
>  >Conversation->findAll() or $this->A->Really->Long->Way->Around-
>  >Conversation->findAll(). The Conversation model doesn't care/know
> how it's called. So yes, $this->User->Conversation->findAll() will
> find ALL conversations, not just a specific users' ones.
>
> I know it's counter-intuitive and I wish Cake would be improved in
> this regard.
> Maybe in 2.0?
>
> Now why does it work the way it works? By convention Cake will
> automatically (try to) include the "User" model in your
> "UserController", giving you the possibility to access $this->User.
> The Conversation model is not automatically included, though you could
> include it manually and then also get access to $this->Conversation.
> The User model though happens to be linked to the Conversation model
> through associations, so from the User model you can always access the
> Conversation model. So in this case to use the Conversation model you
> "go through" the User model.
>
> Anyway, to find the conversations of a specific user, you do a find()
> on the User model: $this->User->find($conditions);
> This will give you the user record AND records of all associated
> models, including Conversations.
>
> > $this->User->ConversationsUser->findAllByUserId($userId) deletes the
> > entries in the ConversationsUser table.
>
> I don't know why it deletes entries, but you shouldn't have a
> ConversationsUser model in the first place! That should just be a
> table that helps you link Users to Conversations, but it should never
> be accessed directly.
>
> > On May 19, 4:26 pm, oana <[EMAIL PROTECTED]> wrote:
> >> I wrote almost everything again, because it was getting too messy,
> >> and
> >> now it works. (though the changes i've made don't concern any logic
> >> that may delete entries)
>
> >> Thank you very much for helping.
>
> >> On May 19, 11:09 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
> >> wrote:
>
> >>> Well, nothing's being deleted in those queries, only SELECTed.
> >>> Of the top of my head I'd say there are two possibilities:
>
> >>> 1) Some really weird problem with your database engine that causes
> >>> it
> >>> to forget selected data. *
> >>> 2) There's some logic in your application that deletes entries which
> >>> is accidentally triggered.
> >>> *unlikely
>
> >>> What you usually do to select related model data is just this:
> >>> - You define your two models very simply, as 
> >>> inhttp://book.cakephp.org/view/66/models#introduction-67
> >>> - You set up associations between your two models as 
> >>> inhttp://book.cakephp.org/view/66/models#associations-78
> >>> - In your controller you do something like $this->User->find(),
> >>> which
> >>> returns an array like:
>
> >>> Array
> >>> (
> >>> [User] => Array
> >>> (
> >>> ...
> >>> )
> >>> [Conversation] => Array
> >>> (
> >>> ...
> >>> )
> >>> )
>
> >>> If you want to search for a specific entry in "Conversation" you'd
> >>> do
> >>> something like this:
> >>> $this->User->Conversation->find(array('topic' => 'How to bake
> >>> cookies'));
>
> >>> If your code is anymore complicated than that you're probably not
> >>> doing it right.
> >>> If you paste some more of your code (relevant controller actions,
> >>> model definitions etc.) into the bin (http://bin.cakephp.org/) we
> >>> might be able to tell where the problem is.
>
> >>> On 19 May 2008, at 16:35, oana wrote:
>
>  These are the queries related concerning users, conversations,
>  and the
>  join table.
>
>  If it isn't too much trouble, maybe you can point me to a complete
>  piece of code  for the users cotroller, to select a certain user's
>  conversations. Because i have tried several, and i think this is my
>  problem.
>
>  Thanks for helping,
>  Oana
>
>  SELECT `Conversation`.`id`, `Conversation`.`availability`,
>  `Conversation`.`created`, `Conversation`.`modified`,
>  `Conversation`.`description`, `Co

Re: Is migrations support planned for Cake?

2008-05-20 Thread Dardo Sordi Bogado

> He addresses the answer in that post.  You don't label the migration
> sequentially.  You label it based on UTC timestamp as the race
> condition where 2 developers generate a migration at exactly the same
> moment is highly unlikely.  Rails 2.1 is going that way (http://
> railscasts.com/episodes/107).

If you are talking about a parallel development environment, a change
made forward in time doesn't necessarily should be ordered after
others that happened before it but based on the same revision.

  C --- D
/   \
A---B--E---*--- Should migration E be between C and D ? Can we
say that based on the timestamp?

You'll see, some times order matters.

To me there seem to be 3 possible orders: C-E-D,  C-D-E, E-C-D.

- Dardo Sordi.


> - Keith
> >
>

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



Re: Layout change in edit case(help me please)

2008-05-20 Thread vishal

Thanks you very much my friend...!!! I have done the changes & my
problem is solved..!!!

thanks you very much..

friend can you help me in this matter also if you have few minutes for
me..??

I have problem in uploading the image..I want to display the image as
well as store the image in database...
I mean to say these are my files:

add.ctp:
Add User


create('User', array('action' => '/add/
index','enctype'=>'multipart/form-data'));
echo  $form->input('name');
echo $form->input('address', array('rows' => '3'));
echo $form->input('phone');
echo $form->input('mobile');
echo $form->input('email');
echo $form->input('city');
echo $form->input('state');
echo $form->input('image',array('type' => 'file'));
echo $form->end('Save User');
?>



This is my controller file:

 4,
'order' => array(
'User.name' => 'asc'
)
);


function index() {
//$this->set('users', $this->User->find('all'));
$data = $this->paginate('User');
  $this->set(compact('data'));
}

function view($id) {
$this->User->id = $id;
$this->set('user', $this->User->read());

}

function delete($id) {
$this->User->del($id);
$this->flash('The user with id: '.$id.' has been deleted.', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}

function add() {
if (!empty($this->data)) {


$this->flash('Your detail has been 
saved.','http://192.168.0.60/
vishal/cake_1.2.0.6311-beta/app/users/index');
}

}


function edit($id = null) {
$this->User->id = $id;
if (empty($this->data)) {
$this->data = $this->User->read();
} else {
if ($this->User->save($this->data['User'])) {
$this->flash('Your detail has been updated.', 
array('action' =>
'index'));
}
}
}

}
?>


the problem is that I want to store the image path in database field &
I want to dispaly the image at front end...i.e where the images are go
in which folder 
the path is saved by using above code
have you got my issue ??

thanks,
vishal


On May 20, 2:42 pm, djiize <[EMAIL PROTECTED]> wrote:
> it's due to Cake routing and URL rewriting
> in some cases, prefer HTML helper instead your own HTML
>
> in your layout, change
>  type="text/css" />
> by
> css('style') ?>
>
> and change al
> 
> by
> image('your_image.gif') ?>
>
> And last, in your "flash" calls, don't repeat the host, path, etc...
> just do:
> $this->flash('Your detail has been updated.', '/users/index');
> or better, as you already are in Users controller (and you'll get
> others benefits, as reverse routing):
> $this->flash('Your detail has been updated.', array('action' =>
> 'index'));
>
> On 20 mai, 10:33, vishal <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >  Myself vishal facing a problem while editing.when i edit the
> > layout changes. so anybody help me please..
> > But in case of add it look well.
> > This is the details of the file:
>
> > Layout file:
>
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > 
> >  > type="text/css" />
>
> > 
> > 
>
> > 
> > 
> > 
> > 
> > 
> >  > align='right'>Home| Our Company| Sitemap|
> > Projects
> > 
> > 
> >  > align="center">
> >  > align="center">
> >  > SRC="../../app/webroot/img/logo.gif"  > > td>
> > 
> > 
>
> > 
> > 
> > 
> > 
> >  > cellspacing="3" border="0"
> > align="center">
> >  > $html->link('User', 'http://
> > 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index'); ?> > tr>
> >  > $html->link('Messages',
> > 'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
> > index'); ?>
> >  > $html->link('Account',
> > 'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
> > index'); ?>
> > 
> > 
> > 
> > 
>
> > 
> > 
> > 
> > 
> > contactus| About us| 
> > privacy policy
> > 
> > 
> > 
> > 
> > 
>
> > This is my controller page:
>
> >  > class UsersController extends AppControll

file handling from cake

2008-05-20 Thread oana

Hello everyone,

I would like to know iwhat would be the way to follow if i want to
create a file from within a cakephp page.

The situation is like this:  i have a view which shows an applet (this
applet holds a graph which describes a conversation from an xml file;
the applet loads the correct file from a parameter i pass when laoding
the page : view/2 loads conversation with id=2).

My question is: when i want to start a new conversation, what do i do
to create an xml file for that conversation and the write into it? Do
i have to use javascript for this?

Sorry if this has been posted, but i didn't find many topics about
working with files

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



Re: Layout change in edit case(help me please)

2008-05-20 Thread djiize

it's due to Cake routing and URL rewriting
in some cases, prefer HTML helper instead your own HTML

in your layout, change

by
css('style') ?>

and change al

by
image('your_image.gif') ?>

And last, in your "flash" calls, don't repeat the host, path, etc...
just do:
$this->flash('Your detail has been updated.', '/users/index');
or better, as you already are in Users controller (and you'll get
others benefits, as reverse routing):
$this->flash('Your detail has been updated.', array('action' =>
'index'));

On 20 mai, 10:33, vishal <[EMAIL PROTECTED]> wrote:
> Hi,
>      Myself vishal facing a problem while editing.when i edit the
> layout changes. so anybody help me please..
> But in case of add it look well.
> This is the details of the file:
>
> Layout file:
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
>  type="text/css" />
>
> 
> 
>
> 
>         
>                         
>                                 
>                                         
>                                                  align='right'>Home| Our Company| Sitemap|
> Projects
>                                         
>                                         
>                                                  align="center">
>                                                  align="center">
>                                                  SRC="../../app/webroot/img/logo.gif"  > td>
>                                         
>                                 
>
>                         
>         
>         
>                 
>                                  cellspacing="3" border="0"
> align="center">
>                                          $html->link('User', 'http://
> 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index'); ?> tr>
>                                          $html->link('Messages',
> 'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
> index'); ?>
>                                          $html->link('Account',
> 'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
> index'); ?>
>                                 
>                 
>                 
>                                 
>
>                 
>         
>         
>                         
>                                 contactus| About us| 
> privacy policy
>                         
>         
> 
> 
> 
>
> This is my controller page:
>
>  class UsersController extends AppController {
>
>         var $name = 'Users';
>         var $layout='user';
>
>         var $paginate = array(
>         'limit' => 4,
>         'order' => array(
>             'User.name' => 'asc'
>         )
>     );
>
>         function index() {
>                 //$this->set('users', $this->User->find('all'));
>                 $data = $this->paginate('User');
>           $this->set(compact('data'));
>         }
>
>         function delete($id) {
>         $this->User->del($id);
> $this->flash('The user with id: '.$id.' has been deleted.', 'http://
> 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
>
> }
>
>         function add() {
>                 if (!empty($this->data)) {
>                         if ($this->User->save($this->data)) {
>                                 $this->flash('Your detail has been 
> saved.','http://192.168.0.60/
> vishal/cake_1.2.0.6311-beta/app/users/index');
>                         }
>
>                 }
>         }
>
>         function edit($id = null) {
>         $this->User->id = $id;
>         if (empty($this->data)) {
>                 $this->data = $this->User->read();
>         } else {
>                 if ($this->User->save($this->data['User'])) {
>                         $this->flash('Your detail has been 
> updated.','http://192.168.0.60/
> vishal/cake_1.2.0.6311-beta/app/users/index');
>                 }
>         }
>
> }
> }
>
> ?>
>
> & this is my edit.ctp view file:
> Edit User
>
>  echo $form->create('User', array('action' => 'edit'));
> echo  $form->input('name');
> echo $form->input('address', array('rows' => '3'));
> echo $form->input('phone');
> echo $form->input('mobile');
> echo $form->input('email');
> echo $form->input('city');
> echo $form->input('state');
> echo $form->input('image',array('type' => 'file'));
> echo $form->end('Save User');
> ?>
>
> I am using the same layout in case of add & edit...but in case of edit
> it looks differentt without images that i use in layout file...so plz
> help me as soon as possible...
> I m waiting for the reply..!!!
>
> vishal
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Making Paginator first sort direction DESC

2008-05-20 Thread Tim W

In the end my solution was to copy the paginator helper class to my
application helpers directory, then in the sort method swap every
instance of "asc" and "desc". It's not a great solution, but it works.
I'd love to hear about better solutions to get the initial sort
direction to be desc instead of asc.

On May 8, 12:35 am, Tim W <[EMAIL PROTECTED]> wrote:
> Thanks Marcin.
>
> I don't think i've been entirely clear. I can easily set the sort
> order programmatically, but when the user first clicks on a link to
> sort a column it automatically sorts ASC. I'd like to change that
> behavior to default first to DESC. I can do it by hacking around with
> the cake source, or doing it myself, I just wondered if there was a
> way built in, since it'd probably be a pretty common thing to try to
> do. If not i'll add it and see if I can work out how to submit a
> change request.
>
> Cheers
>
> Tim
>
> On May 7, 10:33 pm, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
>
> > 'order' => 'Model.column DESC'
>
> > On Wed, May 7, 2008 at 11:26 AM,TimW<[EMAIL PROTECTED]> wrote:
>
> > >  Thanks for the suggestion, but unfortunately it didn't work for me.
>
> > >  SQL Error: 1054: Unknown column 'DESC' in 'order clause'
>
> > >  I'll spend some time to work this out at some point, i'll post when I
> > >  do, unless someone's worked it out already and can tell me.
>
> > >  Thanks
>
> > >  Tim
>
> > >  On May 7, 8:11 pm, "Andras Kende" <[EMAIL PROTECTED]> wrote:
> > >  > Hello,
>
> > >  > try this in your controller:
>
> > >  > var $paginate = array('limit' => 100, 'page' => 1, 'order' => 'DESC');
>
> > >  > Andras Kende
>
> > >  >http://www.kende.com
>
> > >  > -Original Message-
> > >  > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
>
> > >  > OfTimW
> > >  > Sent: Tuesday, May 06, 2008 9:26 AM
> > >  > To: CakePHP
> > >  > Subject: Making Paginator first sort direction DESC
>
> > >  > Hi all,
>
> > >  > Paginator's great, like the rest of Cake, but there's one little thing
> > >  > I haven't been able to work out. By default when you click on a column
> > >  > to sort it will sort ASC (ascending), but i'd like the first sort to
> > >  > be DESC (descending). The options suggest this might be possible, but
> > >  > I haven't worked it out. Does anyone know if this is possible?
>
> > >  > Thanks
>
> > >  >TIm
>
> > --
> > Marcin Domanskihttp://kabturek.info
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Re: Problem with HABTM not getting related data

2008-05-20 Thread Reza Muhammad

Thanks for the link.

I did modelize my HABTM table, now I have a "ModelsPart" model, and it  
has a $belongsTo to Part and Model.

Unfortunately, getting related parts when I'm using find() or  
findAll() in ModelsController doesnt work, but I can get related  
models from PartsController.

Any more ideas?

On May 20, 2008, at 3:27 PM, Matt Huggins wrote:

>
> You need to modelize your HABTM table.  Hopefully this link will help
> you out.
>
> http://cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1
>
>
> On May 20, 3:04 am, Reza Muhammad <[EMAIL PROTECTED]> wrote:
>> Hi guys.
>>
>> I just tried to setup a HABTM relationship between "Model" and
>> "Parts".  In my "Model" model.   I already created tables called
>> 'models', 'parts', and 'models_parts'.
>>
>> Here's what I have in my models:
>>
>> - model.php
>>
>> class Model extends AppModel {
>>
>> var $name = 'Model';
>> var $useTable = 'models';
>> var $validate = array(
>> 'name' => array(
>> 'rule' => VALID_NOT_EMPTY,
>> 'required' => true,
>> 'message' => 'Model name must only contains  
>> letters and numbers'
>> )
>> );
>> //The Associations below have been created with all  
>> possible keys,
>> those that are not needed can be removed
>> var $hasAndBelongsToMany = array(
>> 'Part' => array('className' => 'Part',
>> 'joinTable' => 'models_parts',
>> 'foreignKey' => 'model_id',
>> 'associationForeignKey' => 'part_id',
>> 'unique' => true,
>> 'conditions' => '',
>> 'fields' => '',
>> 'order' => '',
>> 'limit' => '',
>> 'offset' => '',
>> 'finderQuery' => '',
>> 'deleteQuery' => '',
>> 'insertQuery' => ''
>> )
>> );
>>
>> }
>>
>> - part.php
>>
>> class Part extends AppModel {
>>
>> var $name = 'Part';
>> var $useTable = 'parts';
>>
>> //The Associations below have been created with all  
>> possible keys,
>> those that are not needed can be removed
>>
>> var $hasAndBelongsToMany = array(
>> 'Model' => array('className' => 'Model',
>> 'joinTable' =>  
>> 'models_parts',
>> 'foreignKey' =>  
>> 'part_id',
>>  
>> 'associationForeignKey' => 'model_id',
>> 'unique' => true,
>> 'conditions' => '',
>> 'fields' => '',
>> 'order' => '',
>> 'limit' => '',
>> 'offset' => '',
>> 'finderQuery' => '',
>> 'deleteQuery' => '',
>> 'insertQuery' => ''
>> )
>> );
>>
>> }
>>
>> Now, the problem is, When I run find() from Parts Controller, I can
>> get the data from table models_parts (So, I can tell which parts
>> belongs to which models).  However, I also want to be able to get  
>> data
>> from table models_parts when I run find() from Models Controller.
>>
>> I have set both of these controllers to use recursive = 2 ($this- 
>> >Part-
>>  >recursive = 2, and $this->Model->recursive=2), yet it only works
>> from Parts, not the model.
>>
>> Should I be creating a ModelPart model too?
>>
>> Please help me out, thank you :)
> >


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



Layout change in edit case(help me please)

2008-05-20 Thread vishal

Hi,
 Myself vishal facing a problem while editing.when i edit the
layout changes. so anybody help me please..
But in case of add it look well.
This is the details of the file:

Layout file:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>












Home| Our Company| Sitemap|
Projects













link('User', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index'); ?>
link('Messages',
'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
index'); ?>
link('Account',
'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
index'); ?>









contactus| About us| privacy 
policy







This is my controller page:


 4,
'order' => array(
'User.name' => 'asc'
)
);


function index() {
//$this->set('users', $this->User->find('all'));
$data = $this->paginate('User');
  $this->set(compact('data'));
}



function delete($id) {
$this->User->del($id);
$this->flash('The user with id: '.$id.' has been deleted.', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}

function add() {
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->flash('Your detail has been 
saved.','http://192.168.0.60/
vishal/cake_1.2.0.6311-beta/app/users/index');
}

}
}

function edit($id = null) {
$this->User->id = $id;
if (empty($this->data)) {
$this->data = $this->User->read();
} else {
if ($this->User->save($this->data['User'])) {
$this->flash('Your detail has been 
updated.','http://192.168.0.60/
vishal/cake_1.2.0.6311-beta/app/users/index');
}
}
}

}
?>



& this is my edit.ctp view file:
Edit User


create('User', array('action' => 'edit'));
echo  $form->input('name');
echo $form->input('address', array('rows' => '3'));
echo $form->input('phone');
echo $form->input('mobile');
echo $form->input('email');
echo $form->input('city');
echo $form->input('state');
echo $form->input('image',array('type' => 'file'));
echo $form->end('Save User');
?>


I am using the same layout in case of add & edit...but in case of edit
it looks differentt without images that i use in layout file...so plz
help me as soon as possible...
I m waiting for the reply..!!!

vishal


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



Re: Problem with HABTM not getting related data

2008-05-20 Thread Matt Huggins

You need to modelize your HABTM table.  Hopefully this link will help
you out.

http://cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1


On May 20, 3:04 am, Reza Muhammad <[EMAIL PROTECTED]> wrote:
> Hi guys.
>
> I just tried to setup a HABTM relationship between "Model" and  
> "Parts".  In my "Model" model.   I already created tables called  
> 'models', 'parts', and 'models_parts'.
>
> Here's what I have in my models:
>
> - model.php
>
> class Model extends AppModel {
>
>         var $name = 'Model';
>         var $useTable = 'models';
>         var $validate = array(
>                 'name' => array(
>                         'rule' => VALID_NOT_EMPTY,
>                         'required' => true,
>                         'message' => 'Model name must only contains letters 
> and numbers'
>                 )
>         );
>         //The Associations below have been created with all possible keys,  
> those that are not needed can be removed
>         var $hasAndBelongsToMany = array(
>                 'Part' => array('className' => 'Part',
>                         'joinTable' => 'models_parts',
>                         'foreignKey' => 'model_id',
>                         'associationForeignKey' => 'part_id',
>                         'unique' => true,
>                         'conditions' => '',
>                         'fields' => '',
>                         'order' => '',
>                         'limit' => '',
>                         'offset' => '',
>                         'finderQuery' => '',
>                         'deleteQuery' => '',
>                         'insertQuery' => ''
>                 )
>         );
>
> }
>
> - part.php
>
> class Part extends AppModel {
>
>         var $name = 'Part';
>         var $useTable = 'parts';
>
>         //The Associations below have been created with all possible keys,  
> those that are not needed can be removed
>
>         var $hasAndBelongsToMany = array(
>                         'Model' => array('className' => 'Model',
>                                                 'joinTable' => 'models_parts',
>                                                 'foreignKey' => 'part_id',
>                                                 'associationForeignKey' => 
> 'model_id',
>                                                 'unique' => true,
>                                                 'conditions' => '',
>                                                 'fields' => '',
>                                                 'order' => '',
>                                                 'limit' => '',
>                                                 'offset' => '',
>                                                 'finderQuery' => '',
>                                                 'deleteQuery' => '',
>                                                 'insertQuery' => ''
>                         )
>         );
>
> }
>
> Now, the problem is, When I run find() from Parts Controller, I can  
> get the data from table models_parts (So, I can tell which parts  
> belongs to which models).  However, I also want to be able to get data  
> from table models_parts when I run find() from Models Controller.
>
> I have set both of these controllers to use recursive = 2 ($this->Part-
>  >recursive = 2, and $this->Model->recursive=2), yet it only works  
> from Parts, not the model.
>
> Should I be creating a ModelPart model too?
>
> Please help me out, thank you :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM search entries help

2008-05-20 Thread David C. Zentgraf

On 20 May 2008, at 16:48, oana wrote:

> $this->User->Conversation->findAll() works, but retieves all the
> conversations, not just the ones for a certain user

True. Even though it looks like you're working on a User's  
Conversations,
$this->User->Conversation->findAll();
and
$this->Conversation->findAll();
are identical.

All you're doing is execute the method findAll() of the Conversation  
model. It doesn't matter wether you're doing it via $this- 
 >Conversation->findAll() or $this->A->Really->Long->Way->Around- 
 >Conversation->findAll(). The Conversation model doesn't care/know  
how it's called. So yes, $this->User->Conversation->findAll() will  
find ALL conversations, not just a specific users' ones.

I know it's counter-intuitive and I wish Cake would be improved in  
this regard.
Maybe in 2.0?

Now why does it work the way it works? By convention Cake will  
automatically (try to) include the "User" model in your  
"UserController", giving you the possibility to access $this->User.  
The Conversation model is not automatically included, though you could  
include it manually and then also get access to $this->Conversation.  
The User model though happens to be linked to the Conversation model  
through associations, so from the User model you can always access the  
Conversation model. So in this case to use the Conversation model you  
"go through" the User model.

Anyway, to find the conversations of a specific user, you do a find()  
on the User model: $this->User->find($conditions);
This will give you the user record AND records of all associated  
models, including Conversations.

> $this->User->ConversationsUser->findAllByUserId($userId) deletes the
> entries in the ConversationsUser table.

I don't know why it deletes entries, but you shouldn't have a  
ConversationsUser model in the first place! That should just be a  
table that helps you link Users to Conversations, but it should never  
be accessed directly.

> On May 19, 4:26 pm, oana <[EMAIL PROTECTED]> wrote:
>> I wrote almost everything again, because it was getting too messy,  
>> and
>> now it works. (though the changes i've made don't concern any logic
>> that may delete entries)
>>
>> Thank you very much for helping.
>>
>> On May 19, 11:09 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
>> wrote:
>>
>>> Well, nothing's being deleted in those queries, only SELECTed.
>>> Of the top of my head I'd say there are two possibilities:
>>
>>> 1) Some really weird problem with your database engine that causes  
>>> it
>>> to forget selected data. *
>>> 2) There's some logic in your application that deletes entries which
>>> is accidentally triggered.
>>> *unlikely
>>
>>> What you usually do to select related model data is just this:
>>> - You define your two models very simply, as 
>>> inhttp://book.cakephp.org/view/66/models#introduction-67
>>> - You set up associations between your two models as 
>>> inhttp://book.cakephp.org/view/66/models#associations-78
>>> - In your controller you do something like $this->User->find(),  
>>> which
>>> returns an array like:
>>
>>> Array
>>> (
>>> [User] => Array
>>> (
>>> ...
>>> )
>>> [Conversation] => Array
>>> (
>>> ...
>>> )
>>> )
>>
>>> If you want to search for a specific entry in "Conversation" you'd  
>>> do
>>> something like this:
>>> $this->User->Conversation->find(array('topic' => 'How to bake
>>> cookies'));
>>
>>> If your code is anymore complicated than that you're probably not
>>> doing it right.
>>> If you paste some more of your code (relevant controller actions,
>>> model definitions etc.) into the bin (http://bin.cakephp.org/) we
>>> might be able to tell where the problem is.
>>
>>> On 19 May 2008, at 16:35, oana wrote:
>>
 These are the queries related concerning users, conversations,  
 and the
 join table.
>>
 If it isn't too much trouble, maybe you can point me to a complete
 piece of code  for the users cotroller, to select a certain user's
 conversations. Because i have tried several, and i think this is my
 problem.
>>
 Thanks for helping,
 Oana
>>
 SELECT `Conversation`.`id`, `Conversation`.`availability`,
 `Conversation`.`created`, `Conversation`.`modified`,
 `Conversation`.`description`, `Conversation`.`title`,
 `Conversation`.`postscount`, `Conversation`.`ideascount`,
 `ConversationsUser`.`conversation_id`,  
 `ConversationsUser`.`user_id`
 FROM `conversations` AS `Conversation` JOIN `conversations_users`  
 AS
 `ConversationsUser` ON (`ConversationsUser`.`user_id` IN (1) AND
 `ConversationsUser`.`conversation_id` = `Conversation`.`id`)
>>
 SELECT COUNT(*) AS `count` FROM `conversations_users` AS
 `ConversationsUser` LEFT JOIN `conversations` AS `Conversation` ON
 (`ConversationsUser`.`conversation_id` = `Conversation`.`id`) LEFT
 JOIN `users` AS `User` ON (`ConversationsUser`.`user_id` =
 `User`.`id`) 

Re: SQL Error: 2014

2008-05-20 Thread Ma'moon
According to this link "
http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html"; the sql
result set should be freed from memory in order to execute consequent
queries after each other, am not sure if this is a bug in CakePHP or not but
it seems that the result set is not being freed from memory after executing
the queries consequently.
is there any way that i can call mysql_free_result from the controller in
order to the following:

$mostWatched = $this->Video->query('CALL SP_getMostViewedVideos(1,3)');
*$this->Video->freeUserDefinedQueryResultSet();*
$mostRated = $this->Video->query('CALL SP_getMostRatedVideos(1,3)');
*$this->Video->freeUserDefinedQueryResultSet();*
$resentAdded  = $this->Video->query('CALL SP_getMostRecentVideos(1,3)');
*$this->Video->freeUserDefinedQueryResultSet();*

though this should be done from the core but it doesn't seem to be working!

i am using version 1.1.19.6305, i forgot to say so above and am sorry for
that, anyone?

On Mon, May 19, 2008 at 6:06 AM, Ma'moon <[EMAIL PROTECTED]> wrote:

> Hello guys,
> i have a problem where i am trying to execute the following queries in my
> controller "consequently!":
> $mostWatched = $this->Video->query('CALL SP_getMostViewedVideos(1,3)');
> $mostRated = $this->Video->query('CALL SP_getMostRatedVideos(1,3)');
> $resentAdded  = $this->Video->query('CALL SP_getMostRecentVideos(1,3)');
> and it results to "*SQL Error: 2014: Commands out of sync; you can't run
> this command now in cake/libs/model/datasources/dbo_source.php on line 440
> *"
>
> i would really appreciate it if any one can tell me why this is happening
> and how to solve it!
>

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



View this page "CakePHP Unofficial Resources"

2008-05-20 Thread Matt Huggins

Added a link to Facebook application development with CakePHP

Click on 
http://groups.google.com/group/cake-php/web/cakephp-unofficial-resources
- or copy & paste it into your browser's address bar if that doesn't
work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Problem with HABTM not getting related data

2008-05-20 Thread Reza Muhammad

Hi guys.

I just tried to setup a HABTM relationship between "Model" and  
"Parts".  In my "Model" model.   I already created tables called  
'models', 'parts', and 'models_parts'.

Here's what I have in my models:

- model.php

class Model extends AppModel {

var $name = 'Model';
var $useTable = 'models';
var $validate = array(
'name' => array(
'rule' => VALID_NOT_EMPTY,
'required' => true,
'message' => 'Model name must only contains letters and 
numbers'
)
);
//The Associations below have been created with all possible keys,  
those that are not needed can be removed
var $hasAndBelongsToMany = array(
'Part' => array('className' => 'Part',
'joinTable' => 'models_parts',
'foreignKey' => 'model_id',
'associationForeignKey' => 'part_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);
}

- part.php

class Part extends AppModel {

var $name = 'Part';
var $useTable = 'parts';

//The Associations below have been created with all possible keys,  
those that are not needed can be removed

var $hasAndBelongsToMany = array(
'Model' => array('className' => 'Model',
'joinTable' => 'models_parts',
'foreignKey' => 'part_id',
'associationForeignKey' => 
'model_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);

}

Now, the problem is, When I run find() from Parts Controller, I can  
get the data from table models_parts (So, I can tell which parts  
belongs to which models).  However, I also want to be able to get data  
from table models_parts when I run find() from Models Controller.

I have set both of these controllers to use recursive = 2 ($this->Part- 
 >recursive = 2, and $this->Model->recursive=2), yet it only works  
from Parts, not the model.

Should I be creating a ModelPart model too?

Please help me out, thank you :)

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



Re: Problem calling user controler from app controler.

2008-05-20 Thread Knud Soerensen

Ketan Patel wrote:
> Looks like you don't know what you are trying to do here. Read the
> manual. As you don't have a clue what a model and controller is. In
> your code, you are importing the User model and then calling the
> action of the users controller. On top of that, this is not the way to
> do whatever you are trying to do.
>   
I trying to let the user login from every page.

So, would you suggest that i move the user model into the app model ?


> On May 19, 6:16 pm, Knud Soerensen <[EMAIL PROTECTED]> wrote:
>   
>> In app_controler.php i have
>>
>> class appControler extends Controler
>> {
>>
>> function beforeFilter()
>> {
>> App::Import('Model','User');
>> $this->User=&new User();
>> $this->User->login();
>>
>> }
>> }
>>
>> But I get 2 simmilar looking warnings:
>> warning (2): pg_query() [function.pg-query] Query failed: ERROR: syntax
>> error at or near "login"
>> LINE 1: login
>>
>> and
>>
>> warning (512): SQL Error: ERROR: syntax error at or near "login"
>> LINE 1:  login
>>
>> What am i doing wrong ??
>> 
> >
>
>   


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



Re: HABTM search entries help

2008-05-20 Thread oana

Ignore that, i didn't do enought testing before posting this. The
problem is still there, but i have more info.

In my users controller:

$this->User->Conversation->findAll() works, but retieves all the
conversations, not just the ones for a certain user

$this->User->ConversationsUser->findAllByUserId($userId) deletes the
entries in the ConversationsUser table.

And whenever i try to use this table in this way, entries are deleted.

I know it sounds stupid, but i really can't figure it out.Is there no
way i can retrieve the conversations for a certain user, by passing
that user id as an argument from the users controller? (or even from
the conversations controller)

Oana

On May 19, 4:26 pm, oana <[EMAIL PROTECTED]> wrote:
> I wrote almost everything again, because it was getting too messy, and
> now it works. (though the changes i've made don't concern any logic
> that may delete entries)
>
> Thank you very much for helping.
>
> On May 19, 11:09 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
> wrote:
>
> > Well, nothing's being deleted in those queries, only SELECTed.
> > Of the top of my head I'd say there are two possibilities:
>
> > 1) Some really weird problem with your database engine that causes it
> > to forget selected data. *
> > 2) There's some logic in your application that deletes entries which
> > is accidentally triggered.
> > *unlikely
>
> > What you usually do to select related model data is just this:
> > - You define your two models very simply, as 
> > inhttp://book.cakephp.org/view/66/models#introduction-67
> > - You set up associations between your two models as 
> > inhttp://book.cakephp.org/view/66/models#associations-78
> > - In your controller you do something like $this->User->find(), which
> > returns an array like:
>
> > Array
> > (
> >  [User] => Array
> >  (
> >  ...
> >  )
> >  [Conversation] => Array
> >  (
> >  ...
> >  )
> > )
>
> > If you want to search for a specific entry in "Conversation" you'd do
> > something like this:
> > $this->User->Conversation->find(array('topic' => 'How to bake
> > cookies'));
>
> > If your code is anymore complicated than that you're probably not
> > doing it right.
> > If you paste some more of your code (relevant controller actions,
> > model definitions etc.) into the bin (http://bin.cakephp.org/) we
> > might be able to tell where the problem is.
>
> > On 19 May 2008, at 16:35, oana wrote:
>
> > > These are the queries related concerning users, conversations, and the
> > > join table.
>
> > > If it isn't too much trouble, maybe you can point me to a complete
> > > piece of code  for the users cotroller, to select a certain user's
> > > conversations. Because i have tried several, and i think this is my
> > > problem.
>
> > > Thanks for helping,
> > > Oana
>
> > > SELECT `Conversation`.`id`, `Conversation`.`availability`,
> > > `Conversation`.`created`, `Conversation`.`modified`,
> > > `Conversation`.`description`, `Conversation`.`title`,
> > > `Conversation`.`postscount`, `Conversation`.`ideascount`,
> > > `ConversationsUser`.`conversation_id`, `ConversationsUser`.`user_id`
> > > FROM `conversations` AS `Conversation` JOIN `conversations_users` AS
> > > `ConversationsUser` ON (`ConversationsUser`.`user_id` IN (1) AND
> > > `ConversationsUser`.`conversation_id` = `Conversation`.`id`)
>
> > > SELECT COUNT(*) AS `count` FROM `conversations_users` AS
> > > `ConversationsUser` LEFT JOIN `conversations` AS `Conversation` ON
> > > (`ConversationsUser`.`conversation_id` = `Conversation`.`id`) LEFT
> > > JOIN `users` AS `User` ON (`ConversationsUser`.`user_id` =
> > > `User`.`id`) WHERE `User`.`id` = 1
>
> > > SELECT `ConversationsUser`.`conversation_id`,
> > > `ConversationsUser`.`user_id`, `Conversation`.`id`,
> > > `Conversation`.`availability`, `Conversation`.`created`,
> > > `Conversation`.`modified`, `Conversation`.`description`,
> > > `Conversation`.`title`, `Conversation`.`postscount`,
> > > `Conversation`.`ideascount`, `User`.`id`, `User`.`username`,
> > > `User`.`email`, `User`.`password`, `User`.`group`,
> > > `User`.`first_name`, `User`.`last_name` FROM `conversations_users` AS
> > > `ConversationsUser` LEFT JOIN `conversations` AS `Conversation` ON
> > > (`ConversationsUser`.`conversation_id` = `Conversation`.`id`) LEFT
> > > JOIN `users` AS `User` ON (`ConversationsUser`.`user_id` =
> > > `User`.`id`) WHERE `User`.`id` = 1 LIMIT 20
>
> > > On May 18, 11:53 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
> > > wrote:
> > >> Can you post the SQL queries generated by Cake?
> > >> Sounds really weird.
>
> > >> On 18 May 2008, at 16:04, oana wrote:
>
> > >>> Hi Keith,
>
> > >>> Your summary is very accurate, that is exactly what's happening.
>
> > >>> This is how i select the conversations for an user, in the user
> > >>> controller:
>
> > >>> $this->set('conversations',$this->paginate('ConversationsUser',
> > >>> array('User.id' => $userId)));
>
> > >>> Thank you f

Re: Validating only specific fields within a model?

2008-05-20 Thread Matt Huggins

Thanks jonknee, I didn't even consider the 'on' key in my validation
rules.  I'll have to go back to this and see if that solution works
better than the modification I made to app_model.php that I posted
above. :)

On May 19, 10:40 pm, jonknee <[EMAIL PROTECTED]> wrote:
> > Does anyone have any insight on how to go about validating specific
> > fields in a model for special circumstances like this?  Thanks!
>
> We had a discussion that got into this topic recently:
>
> http://groups.google.com/group/cake-php/browse_thread/thread/dc119a9b...
>
> There are a few ways to go, the easiest in your case is probably using
> the 'on' key in your validation rules. You could also fetch the user's
> data, modify it with the new password and then attempt to save the
> whole thing back.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validating only specific fields within a model?

2008-05-20 Thread Matt Huggins

Yes, that's basically what is happening.  Even when using saveField
(with the validate parameter set to true), which only saves a single
field of a model, the entire model is validated based upon whatever
field names are specified in the model's $validate variable.

On May 19, 10:39 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> I haven't come across any problems with the validations yet...
> Are you saying that it attempts to validate fields which aren't  
> present in your input data and fails on them?
>
> On 20 May 2008, at 12:34, Matt Huggins wrote:
>
>
>
> > I originally thought the same thing as you David.  It seems
> > instinctive that only the fields being saved should be validated.
> > However, looking into the model.php file of the core shows that ALL
> > fields are in fact being validated, even if only one or several fields
> > are being updated.
>
> > Specifically, the following if-condition stands out within the save()
> > function.  Note how it doesn't validate some fields; instead it
> > validates all fields.  This is confirmed by verifying the
> > functionality of the validates() function as well, which in turn calls
> > invalidFields() without specifying specific fields for validation.
>
> > if ($options['validate'] && !$this->validates()) {
> >    $this->whitelist = $_whitelist;
> >    return false;
> > }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How display & stored images

2008-05-20 Thread vishal

Hi,
  Myself vishal facing a problem while uploading the
image.Actually the image path stored in the database.I want to dispaly
that uploaded image on front.

This is my code :
add.ctp file
Add User
create('User', array('action' => '');
echo  $form->input('name');
echo $form->input('address', array('rows' => '3'));
echo $form->input('phone');
echo $form->input('mobile');
echo $form->input('email');
echo $form->input('city');
echo $form->input('state');
echo $form->input('image',array('type' => 'file'));
echo $form->end('Save User');
?>

This stored the image path in the image field of database.
But where this image stored in the folder & in which directory.So
please help me as soon as possible.

I also want to make thumb of the image while uploading. send me the
complete code of image uploading & how I show the images on
frontend.
This is my controller page:

 4,
'order' => array(
'User.name' => 'asc'
)
);


function index() {
//$this->set('users', $this->User->find('all'));
$data = $this->paginate('User');
  $this->set(compact('data'));
}

function view($id) {
$this->User->id = $id;
$this->set('user', $this->User->read());

}

function delete($id) {
$this->User->del($id);
$this->flash('The user with id: '.$id.' has been deleted.', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}

function add() {
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->flash('Your detail has been 
saved.','http://192.168.0.60/
vishal/cake_1.2.0.6311-beta/app/users/index');
}

}
}

function edit($id = null) {
$this->User->id = $id;
if (empty($this->data)) {
$this->data = $this->User->read();
} else {
if ($this->User->save($this->data['User'])) {
$this->flash('Your detail has been 
updated.','http://192.168.0.60/
vishal/cake_1.2.0.6311-beta/app/users/index');
}
}
}

}
?>

Please tell me where i am wrong & in which folder images go. so that i
will display on front with its thumb.

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



Vendor issue: Duplicate class name

2008-05-20 Thread Matt Huggins

I'm trying to import a vendor class, but the class I'm importing in
turn references another 3rd party class named "cache". Since there is
already a CakePHP class named "Cache", I get an error message stating
"Fatal Error: Cannot redeclare class cache in [filename]".

Does anyone have any clue how I can work around this? I don't want to
rename the vendor class since I'll need to perform future upgrades to
the class, not to mention that the class name is referenced throughout
much of the 3rd party code. I have no idea where to go from here.
Please help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Div inserted after $form->create

2008-05-20 Thread Brian Rojas

I use the $form->create method in 1.2 like so:

create(null,array('url' => array('controller' =>
'pages', 'action' => 'contact'), 'id' => 'ContactMiniForm', 'default'
=> false, 'type' => 'post')) . "\n"; ?>

and the outputted HTML includes a div set to 'display:none' :



does anyone know if there is a way to stop this from happening, i
couldn't find anything about this in the api

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



new error

2008-05-20 Thread Raistlin Majere

I am getting:

Warning: file_put_contents(/home/emmettbr/public_html/CakePHP/
opinionsofamateurs/tmp/cache/models/
default_emmettbr_toreadandtowrite_list) [function.file-put-contents]:
failed to open stream: Permission denied in /home/emmettbr/public_html/
CakePHP/cake/basics.php on line 936

Warning: file_put_contents(/home/emmettbr/public_html/CakePHP/
opinionsofamateurs/tmp/cache/models/default_articles) [function.file-
put-contents]: failed to open stream: Permission denied in /home/
emmettbr/public_html/CakePHP/cake/basics.php on line 936

Warning: file_put_contents(/home/emmettbr/public_html/CakePHP/
opinionsofamateurs/tmp/cache/models/default_rates) [function.file-put-
contents]: failed to open stream: Permission denied in /home/emmettbr/
public_html/CakePHP/cake/basics.php on line 936

What should I do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



  1   2   >