Validate $html->radio how to ?

2007-07-13 Thread salahuddin pasha (salahuddin66)
hello there,

I am trying to validate radio (where I did not set any default value)

Gender:
radio('Bloodbank/gender',array('Male','Female')) ?>
tagErrorMsg('Bloodbank/gender', 'gender is
required') ?>


in model

var $validate = array(  
'gender' => VALID_NUMBER, 
.
)

i also tried with VALID_NOT_EMPTY

But is seems that I dont get tagErrorMsg, when none is selected.


-- 
--salahuddin66

salahuddin66.blogspot.com
salahuddin66.deviantart.com



signature.asc
Description: This is a digitally signed message part


Re: bug either in expects function or recursive -- not sure where

2007-07-13 Thread Grant Cox

Expects has a second parameter, which is whether the associations are
returned to normal after the next query using them.  Set this to
false, as your deep recursive causes a number of findAll calls to be
made.


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



Re: Cache Elements for Different Users

2007-07-13 Thread Humble Groups
Awesome. I was looking for a way to do that. Thanks for the input.

On 7/5/07, Ketan Patel <[EMAIL PROTECTED]> wrote:
>
>
> Found a way to do it using cake without modifying the core libs. This
> is a workaround, but does the job.
>
> $this->element('tagCloud', array('cache'=>'+1 day', 'plugin'=>
> $userId));
>
> so this would create the file 'element_$userId_tagCloud' in the cache
> folder for views.
>
> Now to delete it,
>
> $this->clearCache('element_$userId_tagCloud', 'views', '');
>
> I am faking plugin to be the userid, but this works and does my job.
> Hopefully, this might help someone else.
>
> Cheers,
>
> Ketan ;-)
>
>
> Chris Hartjes wrote:
> > On 7/5/07, Ketan Patel <[EMAIL PROTECTED]> wrote:
> > >
> > > Can some one pls shed some light here.
> >
> > I don't think Cake can help you out there.  What you might have to do
> > is code your element in such a way that it does the caching itself
> > based on a unique ID.  You might consider a small file-based caching
> > system.  Not easy, but what you're asking for isn't easy.
> >
> > --
> > Chris Hartjes
> > Senior Developer
> > Cake Development Corporation
> >
> > My motto for 2007:  "Just build it, damnit!"
> >
> > @TheBallpark - http://www.littlehart.net/attheballpark
> > @TheKeyboard - http://www.littlehart.net/atthekeyboard
>
>
> >
>

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



Re: Using renderElement with Smarty

2007-07-13 Thread Humble Groups
You should use like this

{$view->renderElement()} or {$view->element()}

renderElement is a method in View Class, if you access $this in smarty
template it will be pointing to Smarty object.



On 7/13/07, poncjusz <[EMAIL PROTECTED]> wrote:
>
>
> Does anyone know how to use method renderElement in smarty templates?
> I'm using SmartyView described in Bakery (http://bakery.cakephp.org/
> articles/view/how-to-use-smarty-with-cake-smartyview) but when I try
> to call: {php} $this->renderElement('element'); {/php} I get Fatal
> error: Call to undefined method Smarty::renderElement() :/
>
> thanks in advance for help
> tomek
>
>
> >
>

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



Re: Cache Elements for Different Users

2007-07-13 Thread Ketan Patel

Well, technically when you cache something, you are creating a cache
file which is a static html file. So if you have 1,000 users then it
would create 1,000 separate cache files. This would not slow down if
you have enough space on machine, as you would read in one file only
per user. It is advisable to cache elements only if you are gaining
significant savings in SQL queries and computational time. If you have
single SQL query, then probably its not the best idea to cache element
as it would not add much overhead. Its all about performance
optimization.

I have written a cake article for caching elements individually for
each user but it is pending approval. The url is
http://bakery.cakephp.org/articles/view/cache-elements-individually-for-each-user

Hope I answered your questions,

Ketan


On Jul 13, 3:37 pm, inVINCable <[EMAIL PROTECTED]> wrote:
> Ketan Patel,
> I am attempting to do the exact same thing and am running into
> trouble. How exactly are you setting the $userid variable? What I have
> done is in my view, set it up like this, $session->read('User.id), so
> the user id is set there, and then something like $this->element('tagCloud', 
> array('cache'=>'+1 day', 'user_id'=>$userid)...
>
> would that work for setting up a cached element for each user? And
> have you noticed if having possibly thousands of cached elements, one
> for each user, has caused a noticable slowdown? Please reply because I
> am contemplating on doing the same thing you have suggested. Thank
> you.
> On Jul 5, 8:45 am, Ketan Patel <[EMAIL PROTECTED]> wrote:
>
> > Thanks Rajesh, to get me going in right direction.Ketan
>
> > R. Rajesh Jeba Anbiah wrote:
>
> > > On Jul 5, 6:03 pm,KetanPatel<[EMAIL PROTECTED]> wrote:
> > > > Currently I do
>
> > > > element('tagCloud', array('cache'=>'+1 day')); ?>
>
> > > > Element 'tagCloud' :
> > > > requestAction('controller'=>'tag',
> > > > 'action'=>'generateTagCloud'); ?>
>
> > > > What I would want to do is to have a cached element individual to each
> > > > user? So it could be like 'tagCloud_user1', 'tagCloud_user2',... & so
> > > > on. but I could n't find anything in the code that really does that?
> > >
>
> > >What about passing params?
>
> > >   $this->element('tagCloud', array('cache'=>'+1 day', 'user_id'=>10)
>
> > > --
> > >   
> > > Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/


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



Re: PHP 4 = Dead

2007-07-13 Thread CraZyLeGs

Yep.

On 13 juil, 22:07, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
> >  PHP 4 = Dead
>
> We'll talk in 2 years again when PHP4 is still holding the major market
> share.
>
> -- Felix
> --
> My Blog:http://www.thinkingphp.org
> My Business:http://www.fg-webdesign.de
>
> Mech7 wrote:
> > Well allmost in december it is no longer supported.
>
> >http://php.net/
>
> > Today it is exactly three years ago since PHP 5 has been released. In
> > those three years it has seen many improvements over PHP 4. PHP 5 is
> > fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will
> > be discontinued.
>
> > The PHP development team hereby announces that support for PHP 4 will
> > continue until the end of this year only. After 2007-12-31 there will
> > be no more releases of PHP 4.4. We will continue to make critical
> > security fixes available on a case-by-case basis until 2008-08-08.
> > Please use the rest of this year to make your application suitable to
> > run on PHP 5.


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



Nested Lists

2007-07-13 Thread ablock

I have the following structure articles that have a topic and an
author and I would like to display this in a nested list with the
following structure:
Topic
   --Author
 --article
 --article
...
  ...
...
Just using MySQL I would do this using a group_by's and group_concat's
and have the query itself return a PHP array, JSON or Xml

Is there a good way to "bake" this?

Thanks


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



Re: Redirect after authentification?

2007-07-13 Thread Vincent Fleuranceau

On 13 juil, 23:51, kionae <[EMAIL PROTECTED]> wrote:

> I just store it in a session variable.  Any function that requires a
> user to be logged in gets a line fo code like:
>
> $this->Session->write('redirect', '/forums/index');
> $this->checkSession();
> $this->Session->delete('redirect');
>

Thank you Kionae for your answer, it helped me a lot figure out how to
modify the checkSession() function,
(so that I don't end up with duplicate code everywhere).

For those who are interested, here is the modified version:
(the code goes in app/app_controller.php, see the original tutorial
for details)

Session->check('User'))
{
// Save the requested URL for the final redirection
$this->Session->write('redirect', $this->params['url']
['url']);

// Force the user to login
$this->redirect('/users/login');
exit();
}
}
}
?>

(NOTA: it took me some time to realize that params['url'] is an ARRAY
and the actual URL is stored in params['url']['url'])


And in users_controller.php I've changed:

$this->redirect('/posts');

(NOTA : the original code mentions $this->redirect('/clients); if I
remember well but you have to replace 'clients' by 'posts'
if you want to use the auth tutorial combined with the blog tutorial)

into:

$newUrl = $this->Session->read('redirect');
$this->Session->delete('redirect');
$this->redirect($newUrl);

Of course, feel free to correct me if this is a bad way of doing it.

Cheers,

-- Vincent


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



Re: Advanced config problem

2007-07-13 Thread CakeSpork

Hey,

I had been struggling with this this week, though my errors lay
somewhere else for the majority of the time.
You seems to have some weird setup here, though it might very well be
me. dirname($X) gives the directory name of $X, so
(dirname(DS."work".DS."agroec".DS."trunk") doesn't do what you wish, I
believe.

The ugly way that might work:
define('ROOT', 'C:\work\agroec\trunk');
define('APP_DIR', 'app');
define('CAKE_CORE_INCLUDE_PATH', 'c:\cakephp';)

If this does work, (and I might have made errors, but you get the
general principle right?), then consider how you get from __FILE__
(the location of index.php) to these directories, and use dirname()
and DS to get a relative path to the folders.

Good luck with it.


On 13 jul, 20:42, Cacho <[EMAIL PROTECTED]> wrote:
> Hi all
>
> I'm new to CakePHP and decided to make an "advanced" install following
> manual instructions because I've all my projects in a folder where I
> keep it with subversion so, core cake has nothing to do there.
>
> Well, I decided to keep cake install in c:\cakephp.
>
> My project is in C:\work\agroec\trunk where I placed the default app
> folder that comes with cakephp so the structure is:
>
> ─app
>  └───webroot
>  ├───css
>  ├───files
>  ├───img
>  └───js
>
> Following instructions I did in app/webroot/index.php
>
> ---
> if (!defined('ROOT')) {
> define('ROOT',
> dirname(dirname(dirname(DS."work".DS."agroec".DS."trunk";
> }
> if (!defined('APP_DIR')) {
> define('APP_DIR', basename(dirname(dirname("webroot";
> }
>
> if (!defined('CAKE_CORE_INCLUDE_PATH')) {
> define('CAKE_CORE_INCLUDE_PATH', DS."cakephp");
> }
> -
>
> Everything ok for me but when I try to get my page I see (yes, I've
> activated show errors by now).
>
> -
> Warning: require(config\core.php) [function.require]: failed to open
> stream: No such file or directory in C:\cakephp\cake\bootstrap.php on
> line 34
>
> Fatal error: require() [function.require]: Failed opening required
> 'config\core.php' (include_path='\cakephp;\\.\;.;C:\php5\pear') in C:
> \cakephp\cake\bootstrap.php on line 34
>
> ---
>
> Apparently, cakePHP is not getting the path of my app correctly.
>
> How could I solve it ?
>
> Thanks in advance
>
> C


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



Re: PHP 4 = Dead

2007-07-13 Thread Felix Geisendörfer
>  PHP 4 = Dead
We'll talk in 2 years again when PHP4 is still holding the major market 
share.

-- Felix
--
My Blog: http://www.thinkingphp.org
My Business: http://www.fg-webdesign.de


Mech7 wrote:
> Well allmost in december it is no longer supported.
>
> http://php.net/
>
> Today it is exactly three years ago since PHP 5 has been released. In
> those three years it has seen many improvements over PHP 4. PHP 5 is
> fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will
> be discontinued.
>
> The PHP development team hereby announces that support for PHP 4 will
> continue until the end of this year only. After 2007-12-31 there will
> be no more releases of PHP 4.4. We will continue to make critical
> security fixes available on a case-by-case basis until 2008-08-08.
> Please use the rest of this year to make your application suitable to
> run on PHP 5.
>
>
> >
>
>   

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



Re: Different layout for admin route?

2007-07-13 Thread Travis Cline

On Jul 12, 6:07 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
> I would use a beforeFilter and test for $this->params['admin'];
>
> function beforeFilter(){
>   if (isset($this->params['admin'])) {
> $this->layout = 'admin_layout_name';
>   }
>
> }
>
> Geoff
> --http://lemoncake.wordpress.com

Yeah, that's cleaner.


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



Re: Redirect after authentification?

2007-07-13 Thread kionae

I just store it in a session variable.  Any function that requires a
user to be logged in gets a line fo code like:

$this->Session->write('redirect', '/forums/index');
$this->checkSession();
$this->Session->delete('redirect');

This results in the user either getting redirected to the login page
via the checkSession() function if they're not logged in, or the
'redirect' session getting deleted if they're already logged in
(because if that's the case, we don't need to redirect them).  If the
user isn't logged in, they go to the login form, and enter their
username/password.

At that point (we've now moved to the login() function), if they
manage to log in correctly, I do something like this:

if(session_is_registered('redirect')) {
$redirect = $this->Session->read('redirect');
$this->Session->delete('redirect');
$this->redirect($redirect);
}

... which sends them back to whichever page redirected them to the
login page.  Probably not the prettiest method, but it works.




On Jul 13, 1:39 pm, Vincent Fleuranceau <[EMAIL PROTECTED]>
wrote:
> Hi all,
>
> I'm new to CakePHP (and MVC in general). And so far I'm very happy
> wiht it.
>
> I've just followed the blog tutorial and I've combined it with the
> simple authentification example from the manual. It works well so far,
> but...
>
> I would like to know if there is a (simple) way to redirect the user
> to the requested page (instead of a default hard-coded URL). I hope
> you see what I mean.
>
> The original code reads:
>
>  class AppController extends Controller
> {
> function checkSession()
> {
> // If the session info hasn't been set...
> if (!$this->Session->check('User'))
> {
> // Force the user to login
> $this->redirect('/users/login');
> exit();
> }
> }}
>
> ?>
>
> Any idea how I can "store" the URL of the requested page and pass it
> to the redirect() method?
>
> Thanks in advance,
>
> -- Vincent


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



Caching Several Elements On A Home Page Based Upon The User...

2007-07-13 Thread inVINCable

Hey guys, I have set up my home page with 4 elements (this uses four
request actions as well) and I have been reading the groups, and the
tutorial on the bakery about how elements should be cached to prevent
less strain on the server. The problem with my cached elements are,
that they are generated dynamically, and by that, I mean that each
user is shown a tag cloud based upon his company. Now I already have
all the backend logic sorted about about how to do this, the only
problem I have run into is how to cache them so they can be re-used
without having to run through this code everytime a user logs in the
with company_id of 5. So, after looking around a bit, it looks like I
can pass the variable to be loaded based upon a company id, like so,
by passing it a
plugin$this-
>element('tagCloud', array('cache'=>'+1 day', 'plugin'=>
$company_id)); This way  I can save the element
dynamically so a  tag cloud can be created for every company, then to
call on the element, i will use something like this,
$usercompanyid = $session->read('User.comapny_id') echo $this-
>element('$usercompanyid.getstories');  Will this create problems for
my app, having creating thousands of cached elements? I really would
like to use cache to cache these various elements on the home page so
everytime a user with the company _id of that element logs in ,  the
data can just be loaded from the cache. Will I suffer a performance
hit when caching this many  elements? Would I be better off not
caching at all? Thanks for any advice on the matter.


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



Undefined variable: paginator

2007-07-13 Thread Contrid

Hi there,

I'm getting the error :

Undefined variable: paginator

I have an element. Inside this element, I use requestAction(); to call
upon a Controller action. This action checks if it was requested by
check for $this -> params['requested']. If it was requested, it simply
returns the data. Problem is...inside my element, I use the
PaginatorHelper. Now...I'm getting this error.

Any ideas how I can solve this?
Your help will be greatly appreciated.
I've googled around, but cannot find anything.


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



PHP 4 = Dead

2007-07-13 Thread Mech7

Well allmost in december it is no longer supported.

http://php.net/

Today it is exactly three years ago since PHP 5 has been released. In
those three years it has seen many improvements over PHP 4. PHP 5 is
fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will
be discontinued.

The PHP development team hereby announces that support for PHP 4 will
continue until the end of this year only. After 2007-12-31 there will
be no more releases of PHP 4.4. We will continue to make critical
security fixes available on a case-by-case basis until 2008-08-08.
Please use the rest of this year to make your application suitable to
run on PHP 5.


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



Re: Cache Elements for Different Users

2007-07-13 Thread inVINCable

Ketan Patel,
I am attempting to do the exact same thing and am running into
trouble. How exactly are you setting the $userid variable? What I have
done is in my view, set it up like this, $session->read('User.id), so
the user id is set there, and then something like $this-
>element('tagCloud', array('cache'=>'+1 day', 'user_id'=>$userid)...
would that work for setting up a cached element for each user? And
have you noticed if having possibly thousands of cached elements, one
for each user, has caused a noticable slowdown? Please reply because I
am contemplating on doing the same thing you have suggested. Thank
you.
On Jul 5, 8:45 am, Ketan Patel <[EMAIL PROTECTED]> wrote:
> Thanks Rajesh, to get me going in right direction.Ketan
>
> R. Rajesh Jeba Anbiah wrote:
>
> > On Jul 5, 6:03 pm,KetanPatel<[EMAIL PROTECTED]> wrote:
> > > Currently I do
>
> > > element('tagCloud', array('cache'=>'+1 day')); ?>
>
> > > Element 'tagCloud' :
> > > requestAction('controller'=>'tag',
> > > 'action'=>'generateTagCloud'); ?>
>
> > > What I would want to do is to have a cached element individual to each
> > > user? So it could be like 'tagCloud_user1', 'tagCloud_user2',... & so
> > > on. but I could n't find anything in the code that really does that?
> >
>
> >What about passing params?
>
> >   $this->element('tagCloud', array('cache'=>'+1 day', 'user_id'=>10)
>
> > --
> >   
> > Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/


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



Re: Bakery Article : How to use ACL in 1.2.x

2007-07-13 Thread cakeFreak

Great Article!

I was just wondering whether instead of building the aros for every
single user, it is possible to build  the aros (and then acos) for
user groups instead.

You get the usergroup from the Auth->user session data, ACL checks if
the group of that user is allowed a specific ACo and so on!

If you Ketan could provide a bit of advice... it would be much
appreciated!

Dan


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



Re: Bakery Article : How to use ACL in 1.2.x

2007-07-13 Thread francky06l

Thanks a lot. I have also implemented the Auth component and have to
enhance it somehow.
Maybe I am not very "bright", I understand the concept of "record"
access, however it seems that a lot of application uses ACL on
Controller/action.

Thanks anyway, ACL is a bit tuff to learn, but I am sure the benefit
is great.
Thanks

On Jul 13, 8:10 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
> francky06l wrote:
> > Great articles, really good timing since I am investigating the ACL in
> > 1.2.
>
> > I have seen in the db_acl.php a AcoAction object, but no idea to use
> > it. I want to use ACL to control the access to controller/action,
> > however the "actions" defined in the acos_aros table does not fit all
> > the needs.
> > I could create a ACO for an action that has the controller ACO has
> > parent, and then use it in allow / deny order.
>
> > But what would be the best way to authorize all actions for a
> > controller, and deny only few for some Aro's  (minimizing the numbers
> > of Aco ?) ?
>
> > Thanks
>
> > On Jul 13, 4:16 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
>
> The case you are talking would suit some conditions which are not
> record specific. Like say in general index action of posts controller.
> You would create an Aco for Index action and check if the access is
> allowed or not. Take a look at Auth Component and take some concepts
> from there, like $actionMap and see if you could use Auth component or
> create one on your own.
>
> Map the actions to the CRUD actions and then depending on that you
> give the access. My article deals with record level access control
> which in turn can be applied to controller actions. Because each
> controller some way does interact with the records.


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



Advanced config problem

2007-07-13 Thread Cacho


Hi all

I'm new to CakePHP and decided to make an "advanced" install following
manual instructions because I've all my projects in a folder where I
keep it with subversion so, core cake has nothing to do there.

Well, I decided to keep cake install in c:\cakephp.

My project is in C:\work\agroec\trunk where I placed the default app
folder that comes with cakephp so the structure is:

─app
 └───webroot
 ├───css
 ├───files
 ├───img
 └───js


Following instructions I did in app/webroot/index.php

---
if (!defined('ROOT')) {
define('ROOT',
dirname(dirname(dirname(DS."work".DS."agroec".DS."trunk";
}
if (!defined('APP_DIR')) {
define('APP_DIR', basename(dirname(dirname("webroot";
}

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', DS."cakephp");
}
-

Everything ok for me but when I try to get my page I see (yes, I've
activated show errors by now).

-
Warning: require(config\core.php) [function.require]: failed to open
stream: No such file or directory in C:\cakephp\cake\bootstrap.php on
line 34

Fatal error: require() [function.require]: Failed opening required
'config\core.php' (include_path='\cakephp;\\.\;.;C:\php5\pear') in C:
\cakephp\cake\bootstrap.php on line 34

---

Apparently, cakePHP is not getting the path of my app correctly.

How could I solve it ?

Thanks in advance

C


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



Redirect after authentification?

2007-07-13 Thread Vincent Fleuranceau

Hi all,

I'm new to CakePHP (and MVC in general). And so far I'm very happy
wiht it.

I've just followed the blog tutorial and I've combined it with the
simple authentification example from the manual. It works well so far,
but...

I would like to know if there is a (simple) way to redirect the user
to the requested page (instead of a default hard-coded URL). I hope
you see what I mean.

The original code reads:

Session->check('User'))
{
// Force the user to login
$this->redirect('/users/login');
exit();
}
}
}
?>

Any idea how I can "store" the URL of the requested page and pass it
to the redirect() method?

Thanks in advance,

-- Vincent


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



Re: deleting records using a checkboxes

2007-07-13 Thread Ketan Patel


hashkash wrote:
> Hi,
> The user selects multiple checkboxes and hits the delete button to
> delete.
> Thats where i get stuck.
> Just to check if i can get the values of the checkboxes i did this.
> My checkbox name is the user id itself.
> function delete()
> {
>   $j=1;
>   //print_r(($this->params['form']['check']['3']));
>   $ids=$this->User->findall('','User.id','','','',0);
>   foreach($ids as $lastid)
>$last=$lastid['User']['id'];
>   print_r($last);
>   while($j<=$last)
>   {
>if($this->params['form']['check'][$j] == "on")
> {
>  echo "hi";
> }
>$j++;
>   }
> }
> It works but i get
> Notice: Undefined offset: 2,
> Notice: Undefined offset: 4, etc.
> I get that notice for checkboxes that i dint select.
> Anyway out of this?
> THanks!
> Kashyap

Do it other way around. You find records for the checkboxes that are
selected. Obviously, you do not want to do anything with the records
that are not selected?? So looked up the users based on the checkboxes
that are selected and you will not get those warnings.

FYI, there is a function isset() in php that lets you check if an
array element is set or not. You need to learn php before you use the
framework. Otherwise such small problems will cause a lot of
frustations for you.

My 2 cents,
Ketan ;-)
www.eClassifieds4U.com - Free Classifieds with Photos


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



Re: Bakery Article : How to use ACL in 1.2.x

2007-07-13 Thread Ketan Patel


francky06l wrote:
> Great articles, really good timing since I am investigating the ACL in
> 1.2.
>
> I have seen in the db_acl.php a AcoAction object, but no idea to use
> it. I want to use ACL to control the access to controller/action,
> however the "actions" defined in the acos_aros table does not fit all
> the needs.
> I could create a ACO for an action that has the controller ACO has
> parent, and then use it in allow / deny order.
>
> But what would be the best way to authorize all actions for a
> controller, and deny only few for some Aro's  (minimizing the numbers
> of Aco ?) ?
>
> Thanks
>
> On Jul 13, 4:16 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:

The case you are talking would suit some conditions which are not
record specific. Like say in general index action of posts controller.
You would create an Aco for Index action and check if the access is
allowed or not. Take a look at Auth Component and take some concepts
from there, like $actionMap and see if you could use Auth component or
create one on your own.

Map the actions to the CRUD actions and then depending on that you
give the access. My article deals with record level access control
which in turn can be applied to controller actions. Because each
controller some way does interact with the records.


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



HTTP_ACCEPT_LANGUAGE and Locale Question

2007-07-13 Thread wilson

Hiya,

It seems from reading about translations in the forum, that we're to
use the browser's HTTP_ACCEPT_LANGUAGE variable to switch between
translations stored in the /app/locale/language/.  Correct?

This makes sense, but why is the default language in the locale
directory 'eng' rather than 'en-us' or 'en-gb' (or any other).

Is there another variable set to 'eng' somewhere?

Thanks!
Wilson


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



Re: Problem with afterFind in model - ~Undefined index ...

2007-07-13 Thread Chris Hartjes

On 7/13/07, oleonav <[EMAIL PROTECTED]> wrote:
>
> Why this is I don't know, does somebody have any clues?

Did you try doing a debug($results) to see what is actually in that
array?  PHP is quite truthful when it tells you that an index for an
array does not exist.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



Re: uploading *.mp3 files 1.2

2007-07-13 Thread Tane Piper

Have you checked your php.ini file?  You need to make sure that the
Max file size for uploads is high enough for your files.  The default
is 2mb, so your mp3s are probably bigger than this.  There is actually
no error checking for this, so it may create a db entry even if the
file does not upload due to being to big.


On 7/13/07, aerosmith <[EMAIL PROTECTED]> wrote:
>
> I've tried this ... bet take a look at the mime types that I added.
>
> 'audio/mp3' , 'audio/mpeg', 'audio/x-mpeg', 'audio/mp3', 'audio/x-
> mp3', 'audio/mpeg3', 'audio/x-mpeg3', 'audio/mpg', 'audio/x-mpg',
> 'audio/x-mpegaudio'
>
> and in the extension I added
> '.mp3'
>
> Is there something wrong with the mime types?
>
>
>
> On Jul 13, 7:06 pm, "Pablo Viojo" <[EMAIL PROTECTED]> wrote:
> > Try setting allowed_mime and allowed_ext options
> >
> > --
> > Pablo Viojo
> > [EMAIL PROTECTED]://pviojo.net
> >
> > On 7/13/07, aerosmith <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > I'm working on a project that enables users to upload articles with
> > > photos and mp3 files. I used the upload behavior to upload the images
> > > and create thumbnails ... it worked fine. but it seems that this
> > > behavior supports only jpg, gif, and png files.
> >
> > > can someone help me please.
>
>
> >
>


-- 
Tane Piper
http://digitalspaghetti.tooum.net

This email is: [ ] blogable [ x ] ask first [ ] private

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



Using renderElement with Smarty

2007-07-13 Thread poncjusz

Does anyone know how to use method renderElement in smarty templates?
I'm using SmartyView described in Bakery (http://bakery.cakephp.org/
articles/view/how-to-use-smarty-with-cake-smartyview) but when I try
to call: {php} $this->renderElement('element'); {/php} I get Fatal
error: Call to undefined method Smarty::renderElement() :/

thanks in advance for help
tomek


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



Problem with afterFind in model - ~Undefined index ...

2007-07-13 Thread oleonav

Following examples in the group I added a afterFind function in my
Contacts model like this:


function afterFind($result){
$result = parent::afterFind($result);
foreach($result as $key => $val) {
$result[$key]['Contact']['fullname'] = str_replace('  ',' ',
$val['Contact']['firstname'] . ' ' . $val['Contact']['lastname']);
}
return $result;
}


This adds a new field with the name 'fullname'. This work's in fine,
only problem is the following notice:

Notice (8): Undefined index:  Contact [APP/models/contact.php, line
28]

Why this is I don't know, does somebody have any clues?

Thanks!


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



Re: uploading *.mp3 files 1.2

2007-07-13 Thread Pablo Viojo
Try debugging the upload process, echo and print_r are very good friends ;)

Regards,
Pablo

On 7/13/07, aerosmith <[EMAIL PROTECTED]> wrote:
>
>
> I've tried this ... bet take a look at the mime types that I added.
>
> 'audio/mp3' , 'audio/mpeg', 'audio/x-mpeg', 'audio/mp3', 'audio/x-
> mp3', 'audio/mpeg3', 'audio/x-mpeg3', 'audio/mpg', 'audio/x-mpg',
> 'audio/x-mpegaudio'
>
> and in the extension I added
> '.mp3'
>
> Is there something wrong with the mime types?
>
>
>
> On Jul 13, 7:06 pm, "Pablo Viojo" <[EMAIL PROTECTED]> wrote:
> > Try setting allowed_mime and allowed_ext options
> >
> > --
> > Pablo Viojo
> > [EMAIL PROTECTED]://pviojo.net
> >
> > On 7/13/07, aerosmith <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > I'm working on a project that enables users to upload articles with
> > > photos and mp3 files. I used the upload behavior to upload the images
> > > and create thumbnails ... it worked fine. but it seems that this
> > > behavior supports only jpg, gif, and png files.
> >
> > > can someone help me please.
>
>
> >
>


-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net

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



Re: uploading *.mp3 files 1.2

2007-07-13 Thread aerosmith

I've tried this ... bet take a look at the mime types that I added.

'audio/mp3' , 'audio/mpeg', 'audio/x-mpeg', 'audio/mp3', 'audio/x-
mp3', 'audio/mpeg3', 'audio/x-mpeg3', 'audio/mpg', 'audio/x-mpg',
'audio/x-mpegaudio'

and in the extension I added
'.mp3'

Is there something wrong with the mime types?



On Jul 13, 7:06 pm, "Pablo Viojo" <[EMAIL PROTECTED]> wrote:
> Try setting allowed_mime and allowed_ext options
>
> --
> Pablo Viojo
> [EMAIL PROTECTED]://pviojo.net
>
> On 7/13/07, aerosmith <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm working on a project that enables users to upload articles with
> > photos and mp3 files. I used the upload behavior to upload the images
> > and create thumbnails ... it worked fine. but it seems that this
> > behavior supports only jpg, gif, and png files.
>
> > can someone help me please.


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



Re: php Warnings running locally

2007-07-13 Thread francky06l

Check if the tmp directory exists at the location "D:\INSTANTRAILS\",
maybe create it.

On Jul 13, 2:58 pm, RVince <[EMAIL PROTECTED]> wrote:
> I'm running Cake on my local machine (wherein php has been insrtalled
> with, cough, InstantRails) except I have amended the php.ini to be:
>
> error_reporting  =  E_ALL & ~E_NOTICE
>
> Yet, when I hit the index.php page that is packaged with Cake (which I
> have just installed) I get following Warnings, below. Anyonecan tell
> me what I might have set wrong here? -R. Vince
>
> Warning: session_start(): open(D:\INSTAN~1\\tmp\
> \sess_cb0d495a31ac0066e6658da26e51694f, O_RDWR) failed: No such file
> or directory (2) in d:\instantrails\www\cake\libs\session.php on line
> 154
>
> Warning: session_start(): Cannot send session cookie - headers already
> sent by (output started at d:\instantrails\www\cake\libs\session.php:
> 154) in d:\instantrails\www\cake\libs\session.php on line 154
>
> Warning: session_start(): Cannot send session cache limiter - headers
> already sent (output started at d:\instantrails\www\cake\libs
> \session.php:154) in d:\instantrails\www\cake\libs\session.php on line
> 154
>
> Warning: Cannot modify header information - headers already sent by
> (output started at d:\instantrails\www\cake\libs\session.php:154) in d:
> \instantrails\www\cake\libs\session.php on line 155


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



Re: uploading *.mp3 files 1.2

2007-07-13 Thread Pablo Viojo
Try setting allowed_mime and allowed_ext options

-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net

On 7/13/07, aerosmith <[EMAIL PROTECTED]> wrote:
>
>
> I'm working on a project that enables users to upload articles with
> photos and mp3 files. I used the upload behavior to upload the images
> and create thumbnails ... it worked fine. but it seems that this
> behavior supports only jpg, gif, and png files.
>
> can someone help me please.
>
>
> >
>

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



uploading *.mp3 files 1.2

2007-07-13 Thread aerosmith

I'm working on a project that enables users to upload articles with
photos and mp3 files. I used the upload behavior to upload the images
and create thumbnails ... it worked fine. but it seems that this
behavior supports only jpg, gif, and png files.

can someone help me please.


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



How to update a form field using Ajax

2007-07-13 Thread [EMAIL PROTECTED]

Hello guys,

I'm new to AJAX so I'd like you to tell me how can I achieve the
following using Cake's Ajax helper:

I have a search box which returns me a list of coincidences, I have
managed to return this list using ajax helper and beside the
coincidence entry a radio button in order to select the value.

What I need now is to update a text field value according to the radio
button selected and I'm wondering how I can do it, should I user an
onClick event with Ajax.updater, or can I use an observeField? I'm
also confused in how it works since i have only used observerField to
update a div an not a form field.

Any suggestion is welcome, thanks in advance ...


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



Re: soap server

2007-07-13 Thread francky06l

The Rossoft blog

http://rossoft.wordpress.com/2006/02/17/web-services-in-cakephp-complex-types/

On Jul 13, 4:16 pm, pigeon <[EMAIL PROTECTED]> wrote:
> thanks, i did try google cache but i couldnt retrieve the last file :(


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



Re: Bakery Article : How to use ACL in 1.2.x

2007-07-13 Thread francky06l

Great articles, really good timing since I am investigating the ACL in
1.2.

I have seen in the db_acl.php a AcoAction object, but no idea to use
it. I want to use ACL to control the access to controller/action,
however the "actions" defined in the acos_aros table does not fit all
the needs.
I could create a ACO for an action that has the controller ACO has
parent, and then use it in allow / deny order.

But what would be the best way to authorize all actions for a
controller, and deny only few for some Aro's  (minimizing the numbers
of Aco ?) ?

Thanks

On Jul 13, 4:16 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
> Hello All,
>
> I have written an article in Bakery on how to use Acl. The url 
> ishttp://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x
>
> I don't know whom to contact for getting the article published. But if
> some one senior could have a look and let me know the feedback, that
> would be great. The contents of the article are as below:
>
> How to use ACL with Cake PHP 1.2.x?
>
> By Ketan aka "ketan"
> This tutorial will brief you on how to use Acl in CakePHP 1.2.x
> versions. I had tough time figuring this out. But with help of Gwoo,
> AD7Six & others, and doing debugging and reading code, here comes the
> tutorial.
> This tutorial assumes you know basic concept of ACL and what it is
> suppossed to be used for? If not then please 
> readhttp://manual.cakephp.org/chapter/acl
>
> You can setup the databases needed for ACL through console command
> Download code cake acl initdb
>
> Now we would setup some higher level aros and acos for initial setup.
> You could do it through console. But I prefered to do it through
> controller, nothing special, just did it that way!
>
> Think of Aros (could be Users, service, etc) as the one who is
> requesting access to Acos (could be controller, actions or services).
> But in this example, we will limit Aros as the users and Acos as the
> controllers. We will setup the following Aros (users):
>
>1. Admin
>2. |-->User::1
>3. User
>4. Guest
>
> You could add more depending on your requirements, but we will stick
> to basic requirements for now. Admin, User & Guest are higher level
> group and the actual users will belong to one of these groups. 'User::
> 1' is an alias for User with user id 1. We define that user with user
> id 1 is a child of Admin and will inherit all admin previledges. Doing
> this is not essential, but you will have to define at least one user
> to be Admin, so why not do it here. Change the id to the userid
> representing the admin user on your system.
>
> We will setup the following Acos (controllers):
>
>1. User
>2. Post
>
> This would add two acos 'User' and 'Post'. But now you think if Acos
> is controller then why not have 'Posts' instead of 'Post'? Good
> question. This is because usually a controller's action can be divided
> into four types of action 'create', 'read', 'update' or 'delete' which
> are performed on a single or group of records belonging to a model.
> Hence, in this approach we going at record level Access Control. We
> want to make sure whether the current Aro (a User) has access to do
> 'C', 'R', 'U' or 'D' action on the Aco ( a record for eg. A post). If
> yes, then let him do the action otherwise don't. Now the code, that
> shows you the manual way to create aros and acos as discussed above.
>
> Controller Class:
> Download code  class InitAclController extends AppController
> {
>   var $name = 'InitAcl';
>   var $component = array('Acl');
>
>   function setupAcl()
>   {
> $aro = new aro();
>
> $aro->create();
> $aro->save(
>   'model'=>'User',
>   'foreign_key'=>null,
>   'parent_id'=>null,
>   'alias'=>'Admin');
>
> $aro->create();
> $aro->save(
>   'model'=>'User',
>   'foreign_key'=>null,
>   'parent_id'=>null,
>   'alias'=>'User');
>
> $aro->create();
> $aro->save(
>   'model'=>'User',
>   'foreign_key'=>null,
>   'parent_id'=>null,
>   'alias'=>'Guest');
>
> $parent = $aro->findByAlias('Admin');
> $parentId = $parent['Aro']['id'];
>
> $aro->create();
> $aro->save(
>   'model'=>'User',
>   'foreign_key'=>1,
>   'parent_id'=>$parentId,
>   'alias'=>'User::1');
>
> $aco = new Aco();
> $aco->create();
> $aco->save(
>'model'=>'User',
>'foreign_key'=>null,
>'parent_id'=>null,
>'alias'=>'User');
>
> $aco->create();
> $aco->save(
>'model'=>'Post',
>'foreign_key'=>null,
>'parent_id'=>null,
>'alias'=>'Post');
>}
>// Give admin full control over acos 'User' & 'Post'
>$this->Acl->allow('Admin', 'User', '*');
>$this->Acl->allow('Admin', 'Post', '*');
>
>// Give the user group only create & read access for 'Post'
>$this->Acl->allow('User', 'Post', array('create', 'read'));
>
>// Give the Guests only create access for 'User'
>$this->Acl->allow('Guest', 'User', 'creat

bug either in expects function or recursive -- not sure where

2007-07-13 Thread bingo

hi bakers,

I think I found a bug in model.php. I have table structure as follows
blogs -- HABTM -- authors

I am trying to build a tree starting from a blog. The tree should look
like this
 Blog (Starting point)
  |--Author
  |-- Blog
   |--Author
   |--Author

  |--Blog
   |--Author
   |--Author

To do this.. I am using following code in my controller

$this->Blog->expects('Author');
$this->Blog->Author->expects('Article');
$this->Blog->Author->Blog->expects('Author');
$this->Blog->recursive = 3;
$result = $this->Blog->findById(200);

I am correct result for the first set of query..but after that CakePHP
disregard the associations and fetches data for all the
associations..so the final result that I get looks like this

 Blog (Starting point)
  |--Author
  |-- Blog
   |--Author1
   |--Author2

  |--Blog   (association is disregarded from here...as you can
I don't want user information but is still fetched)
   |--Author1
   |--Author2
   |--User1
   |--User2

I am suspecting there is some problem with the function read in
model.php..it has only two arguments whereas everywhere else in
model.php read function is called by passing three arguments.. ($db-
>read($this, $queryData, $recursive);

looking forward for some insight;

Ritesh


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



Re: cakephp 1.2 ACL problem

2007-07-13 Thread Pillow

On 13 Lip, 16:11, Ketan Patel <[EMAIL PROTECTED]> wrote:
> I have written an article on 'How to use Acl in 1.2x' which is pending
> approval on bakery. I don't know if you could access it, though the
> url ishttp://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x
>
> Let me know if it helps you.
>
> Ketan

I can't access it now. I hope it will be approved soon :)


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



Re: About {n}

2007-07-13 Thread Feris Thia

On 7/13/07, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
> Friday is the one day of the week where I try to be not grumpy... ;)

You shouldn't then .. ;)

Regards,

Feris

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



Re: Being cached ?

2007-07-13 Thread Feris Thia

On 7/13/07, kionae <[EMAIL PROTECTED]> wrote:
>
> 
>
> I suppose it's worth a shot, if you really think it's something on the
> client side.

I currently using Opera most of the time. I do download and try
Firefox and the view seems ok for edit operation. It did refresh even
without autocomplete="off". Hm then it has to do with Opera then.

I still suspect that some HTTP headers that need to be sent but don't
know which ones :)

Regards,

Feris

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



Re: Being cached ?

2007-07-13 Thread kionae

Well, that eliminates the the easy fixes, then.  Hmm...

The only time I ever had something like that happen with my code was
with a password field that FireFox was autofilling with a stored
password.  I fixed it by setting the autocomplete attribute to off in
my form tag, e.g.:



I suppose it's worth a shot, if you really think it's something on the
client side.





On Jul 13, 9:27 am, "Feris Thia" <[EMAIL PROTECTED]> wrote:
> On 7/13/07, kionae <[EMAIL PROTECTED]> wrote:
>
>
>
> > Nothing in particular jumps out at me in the code... have you checked
> > to make sure that the form data is being stored in $this->data
> > properly when you submit?  No extra or missing arrays within arrays?
>
> Hi kionae,
>
> No.. everything is okay. I try it again, and it seems to be on client
> side problem. As everytime I click edit and refresh the page, it
> returns the current value. Hm, what should I do to make sure the
> client (browser) always fetch the current value  as I click the edit
> link.
>
> Thanks,
>
> Feris


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



Re: About {n}

2007-07-13 Thread Chris Hartjes

On 7/13/07, Feris Thia <[EMAIL PROTECTED]> wrote:
>
>
> It is very HELPFUL !!
>
> Thank you Chris for the detail explanation !
>

Friday is the one day of the week where I try to be not grumpy... ;)

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



Re: About {n}

2007-07-13 Thread Feris Thia

On 7/13/07, Chris Hartjes <[EMAIL PROTECTED]> wrote:.
>
> Hope that helps.
>

It is very HELPFUL !!

Thank you Chris for the detail explanation !

wow... doing 2 days intensive learning cakephp and now getting more
and more enthusiast with it. Thanks also to the great community it has
!

Hope you all don't mind for my frequent askings - of course after
reading through the manual ^_^

Regards,

Feris

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



Re: ordering items

2007-07-13 Thread Joel Stein

Yeah, I'll have to check out TreeBehavior.  I'm sure it's great and
all, but to just totally ditch a contributed article without any
notification to the author?  Kinda lame, imho.  I even made a bunch of
updates to it, including adding scope, but now I'm hesitant to share
it.  I suppose I'll take a look at TreeBehavior and see what all the
fuss is about.  :)

On Jul 10, 12:01 pm, AD7six <[EMAIL PROTECTED]> wrote:
> I know no more than you but it overlaps significantly (almost
> completely infact) with the functionality in the tree behavior.
>
> hth,
>
> AD


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



Re: Being cached ?

2007-07-13 Thread Feris Thia

On 7/13/07, kionae <[EMAIL PROTECTED]> wrote:
>
> Nothing in particular jumps out at me in the code... have you checked
> to make sure that the form data is being stored in $this->data
> properly when you submit?  No extra or missing arrays within arrays?
>

Hi kionae,

No.. everything is okay. I try it again, and it seems to be on client
side problem. As everytime I click edit and refresh the page, it
returns the current value. Hm, what should I do to make sure the
client (browser) always fetch the current value  as I click the edit
link.

Thanks,

Feris

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



Re: About {n}

2007-07-13 Thread Chris Hartjes

It's a notation used by the Set class.  Here's an explanation for you,
taken from the comments for this post over at "ThinkingPHP and
beyond":

http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/

"{n} indicates that any numerical key will be matched and looped
through. Sample:

$a = array('User' => array(0 => array('name' => 'Jim'), 1=>
array('name' => 'Bob')));
$b = Set::extract($a, 'User.{n}.name');

is the same as:

$b = array('Jim', 'Bob');"

So, if you have, say, a result set from a findAll() call that contains
associated data from model A, B anc C you can pull out just the info
that you want by doing the following:

$foo = Set::extract('{n}.A.bar');

That will populate $foo with an array containing all the A.bar values
from your result set.  Set::extract is a very powerful tool for
dealing with nested arrays, replacing several levels of foreaches with
one nice call.

Hope that helps.

On 7/13/07, Feris Thia <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> What is {n}.Model.field used for ? I find it in generatelist function.
>
> Regards,
>
> Feris
>
> >
>


-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



Re: Being cached ?

2007-07-13 Thread kionae

Nothing in particular jumps out at me in the code... have you checked
to make sure that the form data is being stored in $this->data
properly when you submit?  No extra or missing arrays within arrays?



On Jul 13, 3:05 am, "Feris Thia" <[EMAIL PROTECTED]> wrote:
> On 7/13/07, majna <[EMAIL PROTECTED]> wrote:
>
>
>
> > Must be something else. Paste controller code.
>
> Hi Majna,
>
> This is my code
>
> ==
>  class ProductsController extends AppController {
>
> var $name = 'Products';
> var $helpers = array('Html', 'Form' );
>
> function index() {
> $this->Product->recursive = 0;
> $this->set('products', $this->Product->findAll());
> }
>
> function view($id = null) {
> if (!$id) {
> $this->Session->setFlash('Invalid id for Product.');
> $this->redirect('/products/index');
> }
> $this->set('product', $this->Product->read(null, $id));
> }
>
> function add() {
> if (empty($this->data)) {
> $this->set('users', 
> $this->Product->User->generateList());
> $this->render();
> } else {
> $this->cleanUpFields();
> if ($this->Product->save($this->data)) {
> $this->Session->setFlash('The Product has 
> been saved');
> $this->redirect('/products/index');
> } else {
> $this->Session->setFlash('Please correct 
> errors below.');
> $this->set('users', 
> $this->Product->User->generateList());
> }
> }
> }
>
> function edit($id = null) {
> if (empty($this->data)) {
> if (!$id) {
> $this->Session->setFlash('Invalid id for 
> Product');
> $this->redirect('/products/index');
> }
> $this->data = $this->Product->read(null, $id);
> $this->set('users', 
> $this->Product->User->generateList());
> } else {
> $this->cleanUpFields();
> if ($this->Product->save($this->data)) {
> $this->Session->setFlash('The Product has 
> been saved');
> $this->redirect('/products/index');
> } else {
> $this->Session->setFlash('Please correct 
> errors below.');
> $this->set('users', 
> $this->Product->User->generateList());
> }
> }
> }
>
> function delete($id = null) {
> if (!$id) {
> $this->Session->setFlash('Invalid id for Product');
> $this->redirect('/products/index');
> }
> if ($this->Product->del($id)) {
> $this->Session->setFlash('The Product deleted: id 
> '.$id.'');
> $this->redirect('/products/index');
> }
> }
>
> }
>
> ?>
> ==
>
> Thanks for any suggestion !
>
> Regards,
>
> Feris


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



Re: soap server

2007-07-13 Thread pigeon

thanks, i did try google cache but i couldnt retrieve the last file :(


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



Bakery Article : How to use ACL in 1.2.x

2007-07-13 Thread Ketan Patel

Hello All,

I have written an article in Bakery on how to use Acl. The url is
http://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x

I don't know whom to contact for getting the article published. But if
some one senior could have a look and let me know the feedback, that
would be great. The contents of the article are as below:



How to use ACL with Cake PHP 1.2.x?

By Ketan aka "ketan"
This tutorial will brief you on how to use Acl in CakePHP 1.2.x
versions. I had tough time figuring this out. But with help of Gwoo,
AD7Six & others, and doing debugging and reading code, here comes the
tutorial.
This tutorial assumes you know basic concept of ACL and what it is
suppossed to be used for? If not then please read 
http://manual.cakephp.org/chapter/acl

You can setup the databases needed for ACL through console command
Download code cake acl initdb

Now we would setup some higher level aros and acos for initial setup.
You could do it through console. But I prefered to do it through
controller, nothing special, just did it that way!

Think of Aros (could be Users, service, etc) as the one who is
requesting access to Acos (could be controller, actions or services).
But in this example, we will limit Aros as the users and Acos as the
controllers. We will setup the following Aros (users):

   1. Admin
   2. |-->User::1
   3. User
   4. Guest


You could add more depending on your requirements, but we will stick
to basic requirements for now. Admin, User & Guest are higher level
group and the actual users will belong to one of these groups. 'User::
1' is an alias for User with user id 1. We define that user with user
id 1 is a child of Admin and will inherit all admin previledges. Doing
this is not essential, but you will have to define at least one user
to be Admin, so why not do it here. Change the id to the userid
representing the admin user on your system.

We will setup the following Acos (controllers):

   1. User
   2. Post



This would add two acos 'User' and 'Post'. But now you think if Acos
is controller then why not have 'Posts' instead of 'Post'? Good
question. This is because usually a controller's action can be divided
into four types of action 'create', 'read', 'update' or 'delete' which
are performed on a single or group of records belonging to a model.
Hence, in this approach we going at record level Access Control. We
want to make sure whether the current Aro (a User) has access to do
'C', 'R', 'U' or 'D' action on the Aco ( a record for eg. A post). If
yes, then let him do the action otherwise don't. Now the code, that
shows you the manual way to create aros and acos as discussed above.

Controller Class:
Download code create();
$aro->save(
  'model'=>'User',
  'foreign_key'=>null,
  'parent_id'=>null,
  'alias'=>'Admin');

$aro->create();
$aro->save(
  'model'=>'User',
  'foreign_key'=>null,
  'parent_id'=>null,
  'alias'=>'User');

$aro->create();
$aro->save(
  'model'=>'User',
  'foreign_key'=>null,
  'parent_id'=>null,
  'alias'=>'Guest');

$parent = $aro->findByAlias('Admin');
$parentId = $parent['Aro']['id'];

$aro->create();
$aro->save(
  'model'=>'User',
  'foreign_key'=>1,
  'parent_id'=>$parentId,
  'alias'=>'User::1');



$aco = new Aco();
$aco->create();
$aco->save(
   'model'=>'User',
   'foreign_key'=>null,
   'parent_id'=>null,
   'alias'=>'User');

$aco->create();
$aco->save(
   'model'=>'Post',
   'foreign_key'=>null,
   'parent_id'=>null,
   'alias'=>'Post');
   }
   // Give admin full control over acos 'User' & 'Post'
   $this->Acl->allow('Admin', 'User', '*');
   $this->Acl->allow('Admin', 'Post', '*');

   // Give the user group only create & read access for 'Post'
   $this->Acl->allow('User', 'Post', array('create', 'read'));

   // Give the Guests only create access for 'User'
   $this->Acl->allow('Guest', 'User', 'create');
}
?>

Above you saw that using Acl, we granted the Admin full rights over
'User' and 'Post' Acos. ie. Admin can do CRUD for all user and post,
which in turn means that for any controller action which involves
creating, reading, updating or deleting a 'User' or 'Post' record,
Admin group is allowed to do it. So does any user that belongs to
group Admin.

'User' aro is allowed to do only create & read action for 'Post' acos,
which means that a 'User' group in general has access to a controller
action that can create and read 'post' records, which is what we want.
We want that any user that belongs to 'User' group can create new
posts and read posts. But we do not want all users (aros) to 'update'
or 'delete' any 'Post' (acos) they want. Which means, that belonging
to a 'User' group does not give you any previledges to 'U', 'D'
actions of 'Post' (acos). But you want to have 'U', 'D' action for the
user who created that Post!! I will get to giving user who created
post the full CRUD rights late

Re: cakephp 1.2 ACL problem

2007-07-13 Thread Ketan Patel

I have written an article on 'How to use Acl in 1.2x' which is pending
approval on bakery. I don't know if you could access it, though the
url is
http://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x

Let me know if it helps you.

Ketan


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



About {n}

2007-07-13 Thread Feris Thia

Hi,

What is {n}.Model.field used for ? I find it in generatelist function.

Regards,

Feris

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



Re: svn screencast + application deployment

2007-07-13 Thread cakeFreak


Cheers mate for the Capistrano hint!

I'll try it out!

Dan


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



Re: When will CakePHP go with full PHP5-powered codebase?

2007-07-13 Thread Chris Hartjes

On 7/13/07, Dinh <[EMAIL PROTECTED]> wrote:
> As you may notice, PHP4 is official killed for PHP5 adoption: http://php.net
>
> So I think it is time to draw a plan to migrate PHP4-compatible CakePHP
> codebase to fully PHP5 or PHP6 codebase. I think that lot of
> for-compatibility-only code will be dropped and CakePHP will run much
> faster. Lot of PHP5+ only features are very cool in comparison with buggy
> PHP4: new datetime support, SPL, new DOM and XML support, new memory
> manager, new object model.and a less painful migration path to PHP6. Now
> namespace in PHP6 is official. You can find it with the lastest PHP6 build.
>
> Any ideas?

Last time I had heard about this, Cake 2.0 was going to be PHP 5+
only.  When we get there is anyone's guess.

I'm sure most of the developers here are well acquainted with what PHP
5 offers over PHP 4, but there is NOTHING stopping you from building a
CakePHP application using PHP 5 features.  I've done it myself (mostly
for the ease of using SimpleXML for XML manipulation).

But like AD7six said, this topic has been discussed many times so
please let it die.


-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



Re: svn screencast + application deployment

2007-07-13 Thread Chris Hartjes

On 7/13/07, cakeFreak <[EMAIL PROTECTED]> wrote:
>
> Well does Capistrano works even for PHP applications?

It does.   Here's a link to the best tutorial out there on using
Capistrano to deploy your application:

http://www.simplisticcomplexity.com/2006/8/16/automated-php-deployment-with-capistrano


> about "I like to make sure my changes actually work, "
>
> If you branch your code via svn, you can work on the devapp, test the
> changes and then merge/commit them on the trunk only when they work.

> At this point you can commit the trunk to the svn repositry on the
> live server. This was the strategy I was asking about.
> Well what should get sincronysed is the working copy and not the
> repository itself.

I understand totally what you're getting at.  Personally, I prefer to
go with a dev to staging to production model of deployment, but that's
not always possible.  It's for that reason that I don't really like
doing svn updates on a live server.  I prefer to exports so there is
no svn metadata hanging around in production directories.  Just a
personal preference.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



Re: Cake PHP

2007-07-13 Thread Chris Hartjes

On 7/13/07, badi3 <[EMAIL PROTECTED]> wrote:
>
> Bonjour,
>
> Je dois faire le re développement d'un  portail web à fort trafic
> (1000 de page vu par mois) et je voulais savoir si c'est possible
> de gérer ce genre de site avec la framework cakephp.

Anything is possible, but there is nothing about CakePHP that would
not let you build a portal with the traffic levels you are talking
about.  It comes down to intelligent architecture and understanding
what the "choke points" of your application will be.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

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



Re: Cake PHP

2007-07-13 Thread Gonzalo Servat
On 7/13/07, badi3 <[EMAIL PROTECTED]> wrote:
>
>
> Bonjour,
>
> Je dois faire le re développement d'un  portail web à fort trafic
> (1000 de page vu par mois) et je voulais savoir si c'est possible
> de gérer ce genre de site avec la framework cakephp.
>
>
> Merci pour votre conseil


I love it how some people just post in their own language to a list without
doing so much as a very quick Google search to find out what language is
predominant on the list. I think even Babelfish could have translated "Hi,
is there a French list?" (in French, of course) properly.

Damn, I feel grumpy. Maybe I should stop reading Chris' posts ... ;-)

- Gonzalo

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



php Warnings running locally

2007-07-13 Thread RVince

I'm running Cake on my local machine (wherein php has been insrtalled
with, cough, InstantRails) except I have amended the php.ini to be:

error_reporting  =  E_ALL & ~E_NOTICE

Yet, when I hit the index.php page that is packaged with Cake (which I
have just installed) I get following Warnings, below. Anyonecan tell
me what I might have set wrong here? -R. Vince

Warning: session_start(): open(D:\INSTAN~1\\tmp\
\sess_cb0d495a31ac0066e6658da26e51694f, O_RDWR) failed: No such file
or directory (2) in d:\instantrails\www\cake\libs\session.php on line
154

Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at d:\instantrails\www\cake\libs\session.php:
154) in d:\instantrails\www\cake\libs\session.php on line 154

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at d:\instantrails\www\cake\libs
\session.php:154) in d:\instantrails\www\cake\libs\session.php on line
154

Warning: Cannot modify header information - headers already sent by
(output started at d:\instantrails\www\cake\libs\session.php:154) in d:
\instantrails\www\cake\libs\session.php on line 155


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



Cake PHP

2007-07-13 Thread badi3

Bonjour,

Je dois faire le re développement d'un  portail web à fort trafic
(1000 de page vu par mois) et je voulais savoir si c'est possible
de gérer ce genre de site avec la framework cakephp.


Merci pour votre conseil

Badi


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



Re: Member Methods in Views

2007-07-13 Thread Nick

Cake 1.x does have this wrong although not intentionally, but there is
enough flexibility to deal with it. As others noted, it's fundamental
to OO design that rather than having functions that are passed data to
operate on, the data contains the behaviour and operates upon itself.
Message passing languages such as Smalltalk make this particularly
clear, but in cake the data are not objects.

What I initially wanted as soon as I started with cake was model data
not to be raw fields, but where appropriate to be comprised of object
instances so that those instances can then be asked to perform
operations. As an example, if a table row contains fields that model
two address instances, having called find I wanted to see the data
with two Address class instances rather than the underlying fields.
Similarly when storing a model, the data saved would contain object
instances rather than raw fields. What I didn't do was have the entire
row being a model instance, but I've realised that it needs to be too
in some if not all cases.

To implement this, and one of the reasons that cake is great is that
it was trivial to do, was to create a behaviour that implemented
before/after methods, and I specified a model member variable as an
array that listed the classes that a database row was comprised of,
and that optionally would name the instance (so for address this might
be "home", "work", "holiday" etc.). The name corresponded to a column
prefix in the schema. The model then just acts as this new behaviour
and all find and save operations can work with class instances where
appropriate instead of raw columns. A little performance overhead but
nice to be in the world of objects again rather than data fragments.
The bigger win will be when the entire row is a class instance and
that's coming next.

I'll post the behaviour in due course in case it's useful to anyone
else.

Despite the shortcomings, thumbs up to cake for having the flexibility
to extend easily. I've found myself almost over enthusiastically
extolling the virtues of Cake to two people recently because even when
there's one step backwards, there's then two steps forward and it
gives the feelgood factor again.


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



Cake PHP

2007-07-13 Thread badi3

Bonjour,

Je dois faire le re développement d'un  portail web à fort trafic
(1000 de page vu par mois) et je voulais savoir si c'est possible
de gérer ce genre de site avec la framework cakephp.


Merci pour votre conseil

Badi


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



Re: Upload behavior

2007-07-13 Thread AD7six



On Jul 13, 2:47 pm, AD7six <[EMAIL PROTECTED]> wrote:
> beforeDelete(&$model) {
>  if (!parent::beforeSave()) {

Holy crossposting typos!

beforeSave in both cases for the example.

AD


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



Re: Upload behavior

2007-07-13 Thread AD7six



On Jul 13, 1:38 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 7/13/07, Gorka <[EMAIL PROTECTED]> wrote:
>
>
>
> > imageUpload, videoUpload, docUpload, spreadsheetUpload, ... classes.
> > Thoughts?
>
> IME most often the functions which act on the file at the time of upload are
> also needed in, to coin a phrase, non upload situations.

I made a typo in my previous message

"and the image version has functionality to create/delete thumbs"
should have read
"and the image version has functionality/calls to create/delete
thumbs"

In the context of an auto-thumbnail-making behavior I think a vendor
approach, with a skinny behavior to 'hook' it in, is much preferred.
The only doubt I have is how to do so without introducing, or at the
very least by reducing, coupling & dependencies.

If a robust 100% generic upload behavior exists. if you then had to
write in your SpecificUploadBehavior (if that approach is followed):

beforeDelete(&$model) {
 if (!parent::beforeSave()) {
  return false;
 }
 extract ($this->settings[$model->name]);
 vendor('Something' );
 if (VendorClass::addFluff($aSetting, $anotherSetting, $model-
>data[...], ...)) {
  return true;
 }
}

Does that seem a way forward?

AD


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



Re: cakephp 1.2 ACL problem

2007-07-13 Thread francky06l

If have a difference in my testing for the someone user :

$this -> Acl -> Aro -> create(array('parent_id' => 2, 'alias' =>
'Someone'));

then in the check:

$this->Acl->check('Users/Someone', ...);

On Jul 13, 1:08 pm, Pillow <[EMAIL PROTECTED]> wrote:
> On 13 Lip, 11:39, francky06l <[EMAIL PROTECTED]> wrote:
>
> > Using create and save does not seem to fill up the lft /  rght fields.
>
> No, lft and rght are alright (according to MPTT rules).
>
> These are my tables:
>
> acos:
>
> ++---+---+-++--+--
> +
> | id | parent_id | model | foreign_key | alias  | lft  | rght
> |
> ++---+---+-++--+--
> +
> |  1 |  NULL |   |NULL | controllers|1 |4
> |
> |  2 | 1 |   |NULL | someController |2 |3
> |
> ++---+---+-++--+--
> +
>
> aros:
>
> ++---+---+-+--+--+--+
> | id | parent_id | model | foreign_key | alias| lft  | rght |
> ++---+---+-+--+--+--+
> |  1 |  NULL |   |NULL | Users|1 |6 |
> |  2 | 1 |   |NULL | Admin|2 |5 |
> |  3 | 2 |   |NULL | User.Someone |3 |4 |
> ++---+---+-+--+--+--+
>
> aros_acos:
>
> ++++-+---+-+-+
> | id | aro_id | aco_id | _create | _read | _update | _delete |
> ++++-+---+-+-+
> |  1 |  1 |  1 |  -1 |-1 |  -1 |  -1 |
> |  2 |  2 |  2 |   1 | 1 |   1 |   1 |
> ++++-+---+-+-+


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



Re: Upload behavior

2007-07-13 Thread Gorka

That was my point :)

Whatever the nature of the uploaded file is, we might want to act on
it differently based on the functionality required by that precise
upload operation. That functionality is probably already out there, be
it creating a thumbnail, zipping a file or whatever. It is just that I
don't really like the idea of extending the class just for a simple
function call to operate on the file. But, anyhow, it is the most
flexible and sensitive approach given that there is more functionality
to cover than just applying a function to the file when it is
uploaded. Go for it! ;)

Now, for an extreme example, lets take a music publisher that wants to
put their records online using the best framework out there ;) An
album has multiple photos, a cover, videos, lyrics, audio tracks...
some of them would probably better be models themselves, but just for
the porpouse of the example the $actsAs array could look something
like this:

var $actsAs = array (
'imageUpload' => array (
'photos' => array (
'dir' => 'files/images',
'max_size' => 20,
'thumbs' => array (
'small' => array('width' => 320, 'height' => 200),
'medium' => array('width' => 640, 'height' => 400)
)
),
'cover' => array (
'dir' => 'files/images/covers',
'max_size' => 20,
'filters' => array (
'tint' => array('color' => '#FF9900'),
'resize' => array('width' => 400, 'height' => 400)
)
)
),
'videoUpload' => array (
'videos' => array (
'dir' => 'files/video',
'max_size' => 300,
'preview' => array('width' => 100, 'height' => 100),
'encode' => array('format' => 'flv', 'sound' => 'mono',
'fps' => 25)
)
),
'docIndexerUpload' => array (
'lyrics' => array (
'dir' => 'files/docs/lyrics',
'max_size' => 20
),
'intro' => array (
'dir' => 'files/docs/intros'
)
),
'audioUpload' => array(
...
),
...
);

Different behaviors (hint!) for different fields of the model, but
still the could all be referenced by the same DB table, name it
'files', associated to the model through the behavior. Thus, an album
might look like:

[Album] => Array (
[id] => 5,
[title] => 'Innuendo',
[group] => 'Queen',
[genre] => Array ([0] => 'pop', [1] => 'rock'),
...
[videos] => Array (
[0] => Array (
[dir] => 'files/videos',
[name] => 'delilah.flv',
...),
[1] => Array (
[dir] => 'files/videos',
[name] => 'all_gods_people.flv',
...),
...),
[photos] => Array (...),
[cover] => Array ([dir] => 'files/images/covers', [name] =>
'innuendo.jpg', ...)

)

Sorry for the lengthy post, you get the idea :)

On 13 jul, 13:38, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 7/13/07, Gorka <[EMAIL PROTECTED]> wrote:
>
>
>
> > imageUpload, videoUpload, docUpload, spreadsheetUpload, ... classes.
> > Thoughts?
>
> IME most often the functions which act on the file at the time of upload are
> also needed in, to coin a phrase, non upload situations. To give an example
> you create thumbnails while uploading but you could also want to re-create
> different sized thumbnails some other time - if your resize code was
> contained in a behavior it will not be much help.
>
> So after making a generic upload class it can be left to users to extend it
> to suit their needs using - vendor classes, stand-alone code, components or
> chicken entrails - Of course everyone loves examples though :)
>
> Tarique
>
> --
> =
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =


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



Re: Upload behavior

2007-07-13 Thread Dr. Tarique Sani
On 7/13/07, Gorka <[EMAIL PROTECTED]> wrote:
>
>
> imageUpload, videoUpload, docUpload, spreadsheetUpload, ... classes.
> Thoughts?
>

IME most often the functions which act on the file at the time of upload are
also needed in, to coin a phrase, non upload situations. To give an example
you create thumbnails while uploading but you could also want to re-create
different sized thumbnails some other time - if your resize code was
contained in a behavior it will not be much help.

So after making a generic upload class it can be left to users to extend it
to suit their needs using - vendor classes, stand-alone code, components or
chicken entrails - Of course everyone loves examples though :)

Tarique

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

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



Re: Error Handling

2007-07-13 Thread Dr. Tarique Sani
On 7/13/07, Ski <[EMAIL PROTECTED]> wrote:
>
>
>   With cake I get lots of missing controller and other errors that I
> don't wish the public to see - they don't care if it's a missing
> controller action or whatever, they just need to see a 404 or a
> sitemap.


set Debug to 0 and thats what your users will see

If you want the errors emailed to you use an AppError class and override the
function error404, you will have to define this class in error.php in your
app folder - something like

class AppError extends ErrorHandler {
  function error404()
 {
//your code
 }
}

See the same in core code to get more info

HTH
T


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

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



Re: Upload behavior

2007-07-13 Thread Gorka

This kind of inheritance would certainly allow the code to be better
structured and organized, but still we would need the flexibility to
select the kind of processing that should be applied to the files
uploaded through the config array, bakers would need to extend
imageUpload (or whatever) if they need any extra functionality not
covered by the class, and I think we could end up with a bunch of
imageUpload, videoUpload, docUpload, spreadsheetUpload, ... classes.
Thoughts?

On 13 jul, 13:11, Tijs Teulings <[EMAIL PROTECTED]> wrote:
> On 13-jul-2007, at 12:47, Gorka wrote:
>
>
>
>
>
>
>
> >> Or maybe even 'MiUploadBehavior extends UploadBehavior', and a  
> >> call to
> >> beforeSave{mime}{Type} is made if the method exists etc..
>
> > Though this might enforce convention over configuration approach, I
> > see two possible issues with it. First, some file types have several
> > mime types -or better, mime names- they can fit ('image/jpg', 'image/
> > jpeg' for example). On the other hand, you might want different
> > treatments applied for files of the same type, say extract and record
> > on DB the text from this PDF, but just zip and store the other one.
>
> > When defining validation rules, we can define custom functions or use
> > the ones implemented in Cake by setting the validation config array.
> > Maybe we could use something similar to that?
>
> Mimetype based super classes would indeed be a bit troublesome i  
> think. I like the ImageUploadBehavior extends UploadBehavior idea a  
> lot! You could still configure what constitutes an image or a  
> document in the UploadBehaviour based on mimetypes and maybe even set  
> some default methods to call. Then if you could override a default  
> method of, for instance, extractText with convertToPdf in the  
> controller you would have a very powerful set of functionality.
>
> Tijs- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -


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



Error Handling

2007-07-13 Thread Ski

Hi,

  I am trying to get to the bottom of error handling in cakephp.

  In previous systems I have worked on I have used set_error_handler
to catch php / database errors and email debugging / state information
to the site admin, then redirect to a standard error page.

  With cake I get lots of missing controller and other errors that I
don't wish the public to see - they don't care if it's a missing
controller action or whatever, they just need to see a 404 or a
sitemap.

  I know I can override the views and layouts for the cake errors, but
what I cannot seem to be able to do is override the ErrorHandler class
with my own AppError class - this works if I use cakeError(), but I
cannot trap these errors in a  cake controller / component and do
anything with them.

  How do I go about catching missing... errors and emailing them to
myself?

  Thanks.

  Glen


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



Re: cakephp 1.2 ACL problem

2007-07-13 Thread Pillow

On 13 Lip, 11:39, francky06l <[EMAIL PROTECTED]> wrote:
> Using create and save does not seem to fill up the lft /  rght fields.

No, lft and rght are alright (according to MPTT rules).

These are my tables:

acos:

++---+---+-++--+--
+
| id | parent_id | model | foreign_key | alias  | lft  | rght
|
++---+---+-++--+--
+
|  1 |  NULL |   |NULL | controllers|1 |4
|
|  2 | 1 |   |NULL | someController |2 |3
|
++---+---+-++--+--
+

aros:

++---+---+-+--+--+--+
| id | parent_id | model | foreign_key | alias| lft  | rght |
++---+---+-+--+--+--+
|  1 |  NULL |   |NULL | Users|1 |6 |
|  2 | 1 |   |NULL | Admin|2 |5 |
|  3 | 2 |   |NULL | User.Someone |3 |4 |
++---+---+-+--+--+--+

aros_acos:

++++-+---+-+-+
| id | aro_id | aco_id | _create | _read | _update | _delete |
++++-+---+-+-+
|  1 |  1 |  1 |  -1 |-1 |  -1 |  -1 |
|  2 |  2 |  2 |   1 | 1 |   1 |   1 |
++++-+---+-+-+



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



Re: Upload behavior

2007-07-13 Thread Tijs Teulings

On 13-jul-2007, at 12:47, Gorka wrote:

>
>> Or maybe even 'MiUploadBehavior extends UploadBehavior', and a  
>> call to
>> beforeSave{mime}{Type} is made if the method exists etc..
>
> Though this might enforce convention over configuration approach, I
> see two possible issues with it. First, some file types have several
> mime types -or better, mime names- they can fit ('image/jpg', 'image/
> jpeg' for example). On the other hand, you might want different
> treatments applied for files of the same type, say extract and record
> on DB the text from this PDF, but just zip and store the other one.
>
> When defining validation rules, we can define custom functions or use
> the ones implemented in Cake by setting the validation config array.
> Maybe we could use something similar to that?
>

Mimetype based super classes would indeed be a bit troublesome i  
think. I like the ImageUploadBehavior extends UploadBehavior idea a  
lot! You could still configure what constitutes an image or a  
document in the UploadBehaviour based on mimetypes and maybe even set  
some default methods to call. Then if you could override a default  
method of, for instance, extractText with convertToPdf in the  
controller you would have a very powerful set of functionality.

Tijs

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



Re: Cake1.2 Validation fails but no messages shown..

2007-07-13 Thread Mike Green

Thanks for your help.

Its probably worth me putting something on the trac about it then,
unless a kind dev on the list wants to take a look for me :)

Best regards

Mike

On 13/07/07, Dr. Tarique Sani <[EMAIL PROTECTED]> wrote:
>
>
> On 7/13/07, Mike Green <[EMAIL PROTECTED]> wrote:
> >
> > I'm using Development: 1.2.0.5427alpha (July 9, 2007), or at least
> > thats the tar.gz I downloaded. Is it possible that I've got an out of
> > date version? I assume there is no newer alpha release so is it
> > possible that his fixes did not make it into this release?
>
>  The fix was made long back - and now that I think more - it was made for
> 1.1 - I presume it was ported over to 1.2 as well, guess will have to let
> some one else answer that - a bit engrossed ATM
>
> T
>
> --
> =
> Cheesecake-Photoblog: http://cheesecake-photoblog.org
> PHP for E-Biz: http://sanisoft.com
> =
>  >
>


-- 

Mike Green

Find yourself some misspelled ebay bargains!
http://www.typingwand.com

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



Re: bad images url

2007-07-13 Thread d'plus



On 13 Lip, 11:57, Ski <[EMAIL PROTECTED]> wrote:
> Hi,
>
>   Try using the html helper - it takes a path to your image - relative
> to webroot/img as the first argument and generates an  tag.
>
>   Any attributes you want to set in the  tag - border, etc.  you
> specify using an array as the 2nd argument.
>
>   image('ico_comment.png', array('border' => 0)); ?>
>
>   You can make a linked image like this:
>
>   link($html->image('ico_comment.png' array('border' =>
> 0)), 'http://www.domain.com', null, false, false); ?>
>
>   Have a look at the "Helpers" section in the manual for more info.
>
>   Glen

Thank you. That helped.
I thought that relative url would not change when using diffrent
controllers, but I was wrong.

I got some places when I need to use url as argument to background
tag, ie.:
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Upload behavior

2007-07-13 Thread Dr. Tarique Sani
On 7/13/07, AD7six <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On Jul 13, 11:23 am, Gorka <[EMAIL PROTECTED]> wrote:
> > I agree that file uploading should be made as generic as possible, and
> > enabling some callbacks for file processing should be a great bonus.
>
> Hmm,
>
> I'm currently pondering "ImageUploadBehavior extends UploadBehavior"


+1 for this approach FWIW

T

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

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



Re: Upload behavior

2007-07-13 Thread Gorka

> Or maybe even 'MiUploadBehavior extends UploadBehavior', and a call to
> beforeSave{mime}{Type} is made if the method exists etc..

Though this might enforce convention over configuration approach, I
see two possible issues with it. First, some file types have several
mime types -or better, mime names- they can fit ('image/jpg', 'image/
jpeg' for example). On the other hand, you might want different
treatments applied for files of the same type, say extract and record
on DB the text from this PDF, but just zip and store the other one.

When defining validation rules, we can define custom functions or use
the ones implemented in Cake by setting the validation config array.
Maybe we could use something similar to that?

On 13 jul, 12:37, AD7six <[EMAIL PROTECTED]> wrote:
> On Jul 13, 11:23 am, Gorka <[EMAIL PROTECTED]> wrote:
>
> > I agree that file uploading should be made as generic as possible, and
> > enabling some callbacks for file processing should be a great bonus.
>
> Hmm,
>
> I'm currently pondering "ImageUploadBehavior extends UploadBehavior"
>
> where upload behavior has empty _postSave __postDelete (referring to
> after saving the original file to the disk, and after deleting the
> original file from the disk) methods and the image version has
> functionality to create/delete thumbs, and DocUploadBehavior has
> whatever else you might want to use etc.
>
> At least then the 'essential' functionality can be separated from
> image (or whatever) specific calls/functionality.
>
> Or maybe even 'MiUploadBehavior extends UploadBehavior', and a call to
> beforeSave{mime}{Type} is made if the method exists etc..
>
> More pondering required.
>
> AD


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



Re: Cake1.2 Validation fails but no messages shown..

2007-07-13 Thread Dr. Tarique Sani
On 7/13/07, Mike Green <[EMAIL PROTECTED]> wrote:
>
>
> I'm using Development: 1.2.0.5427alpha (July 9, 2007), or at least
> thats the tar.gz I downloaded. Is it possible that I've got an out of
> date version? I assume there is no newer alpha release so is it
> possible that his fixes did not make it into this release?


 The fix was made long back - and now that I think more - it was made for
1.1 - I presume it was ported over to 1.2 as well, guess will have to let
some one else answer that - a bit engrossed ATM

T

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

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



Re: When will CakePHP go with full PHP5-powered codebase?

2007-07-13 Thread AD7six



On Jul 13, 12:37 pm, Dinh <[EMAIL PROTECTED]> wrote:
> As you may notice, PHP4 is official killed for PHP5 adoption:http://php.net
>
> So I think it is time to draw a plan to migrate PHP4-compatible CakePHP
> codebase to fully PHP5 or PHP6 codebase. I think that lot of
> for-compatibility-only code will be dropped and CakePHP will run much
> faster. Lot of PHP5+ only features are very cool in comparison with buggy
> PHP4: new datetime support, SPL, new DOM and XML support, new memory
> manager, new object model.and a less painful migration path to PHP6. Now
> namespace in PHP6 is official. You can find it with the lastest PHP6 build.
>
> Any ideas?

I heard it was scheduled for half past Tuesday the last time this
repetitive topic was discussed.

AD


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



deleting records using a checkboxes

2007-07-13 Thread hashkash

Hi,
The user selects multiple checkboxes and hits the delete button to
delete.
Thats where i get stuck.
Just to check if i can get the values of the checkboxes i did this.
My checkbox name is the user id itself.
function delete()
{
  $j=1;
  //print_r(($this->params['form']['check']['3']));
  $ids=$this->User->findall('','User.id','','','',0);
  foreach($ids as $lastid)
   $last=$lastid['User']['id'];
  print_r($last);
  while($j<=$last)
  {
   if($this->params['form']['check'][$j] == "on")
{
 echo "hi";
}
   $j++;
  }
}
It works but i get
Notice: Undefined offset: 2,
Notice: Undefined offset: 4, etc.
I get that notice for checkboxes that i dint select.
Anyway out of this?
THanks!
Kashyap


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



Re: Upload behavior

2007-07-13 Thread AD7six



On Jul 13, 11:23 am, Gorka <[EMAIL PROTECTED]> wrote:
> I agree that file uploading should be made as generic as possible, and
> enabling some callbacks for file processing should be a great bonus.

Hmm,

I'm currently pondering "ImageUploadBehavior extends UploadBehavior"

where upload behavior has empty _postSave __postDelete (referring to
after saving the original file to the disk, and after deleting the
original file from the disk) methods and the image version has
functionality to create/delete thumbs, and DocUploadBehavior has
whatever else you might want to use etc.

At least then the 'essential' functionality can be separated from
image (or whatever) specific calls/functionality.

Or maybe even 'MiUploadBehavior extends UploadBehavior', and a call to
beforeSave{mime}{Type} is made if the method exists etc..

More pondering required.

AD


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



When will CakePHP go with full PHP5-powered codebase?

2007-07-13 Thread Dinh
As you may notice, PHP4 is official killed for PHP5 adoption: http://php.net

So I think it is time to draw a plan to migrate PHP4-compatible CakePHP
codebase to fully PHP5 or PHP6 codebase. I think that lot of
for-compatibility-only code will be dropped and CakePHP will run much
faster. Lot of PHP5+ only features are very cool in comparison with buggy
PHP4: new datetime support, SPL, new DOM and XML support, new memory
manager, new object model.and a less painful migration path to PHP6. Now
namespace in PHP6 is official. You can find it with the lastest PHP6 build.

Any ideas?

-
VN

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



Re: Paginating the results after creating a dummy model to filter HABTM results?

2007-07-13 Thread AD7six



On Jul 13, 10:39 am, inVINCable <[EMAIL PROTECTED]> wrote:
> Hey AD7six,
>
> I searched the entire model file and several of the main cake files
> and cannot seem to find the bindAll parameter you are talking about.

bindModel*
sorry for the typo, but come on ;)

https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/model.php?rev=5384#L505


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



Re: Cake1.2 Validation fails but no messages shown..

2007-07-13 Thread Mike Green

Hi

I'm using Development: 1.2.0.5427alpha (July 9, 2007), or at least
thats the tar.gz I downloaded. Is it possible that I've got an out of
date version? I assume there is no newer alpha release so is it
possible that his fixes did not make it into this release?

Many thanks

Mike

On 13/07/07, Dr. Tarique Sani <[EMAIL PROTECTED]> wrote:
> Are you using the latest  1.2 release? this use to be an issue  BUT Mariano
> had fixed it .
>
>
> T
> --
> =
> Cheesecake-Photoblog: http://cheesecake-photoblog.org
> PHP for E-Biz: http://sanisoft.com
> =
>  >
>


-- 

Mike Green

Find yourself some misspelled ebay bargains!
http://www.typingwand.com

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



Re: Cake1.2 Validation fails but no messages shown..

2007-07-13 Thread Dr. Tarique Sani
On 7/13/07, Mike Green <[EMAIL PROTECTED]> wrote:
>
>
> HOWEVER
>
> When I try to create a new channel_action (table2), which also has the
> validation set to "VALID_NOT_EMPTY" in the address field, the save
> fails BUT no error message are shown! If I put data in the field and
> hit save, everything saves as it should.



Are you using the latest  1.2 release? this use to be an issue  BUT Mariano
had fixed it .


T

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

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



Re: bad images url

2007-07-13 Thread Ski

Hi,

  Try using the html helper - it takes a path to your image - relative
to webroot/img as the first argument and generates an  tag.

  Any attributes you want to set in the  tag - border, etc.  you
specify using an array as the 2nd argument.

  image('ico_comment.png', array('border' => 0)); ?>

  You can make a linked image like this:

  link($html->image('ico_comment.png' array('border' =>
0)), 'http://www.domain.com', null, false, false); ?>

  Have a look at the "Helpers" section in the manual for more info.

  Glen

On Jul 13, 10:26 am, d'plus <[EMAIL PROTECTED]> wrote:
> I'm using ver. 1.1.
> I've got problems with images urls.
> In my default main controller which loads first all images are ok.
> But when I go into diffrent controller all images on the website are
> gone.
> I'm generating image url like this:
> 
>
> What I'm doing wrong?


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



Re: cakephp 1.2 ACL problem

2007-07-13 Thread francky06l

I did some testing, and using the same method as you did for creating
aro / aco. Actually if you create the aro / acos using the console it
works.
Using create and save does not seem to fill up the lft /  rght fields.

use the command line for creating aro such as :

cake -app 'yourapp' acl create aro / Users
cake -app 'yourapp' acl create aro Users Admin

Do the same for the acos..

However the "grant" command seems not to work, for this I used the
$this->Acl->allow / deny


On Jul 12, 8:24 pm, Pillow <[EMAIL PROTECTED]> wrote:
> On 12 Lip, 19:20, Ketan Patel <[EMAIL PROTECTED]> wrote:
>
> > Did you check in database to see whether your AROs and ACOs are with
> > proper parent/child relationship? Or use console to check
>
> > "cake acl view aros"
>
> Yes, everything seems to be alright. Shell script outputs nice trees.
>
> > Acl works fine the way it is. Also, look in the ACL behavior, this
> > will save you the trouble from repeating yourself as it would create
> > Aros or Acos depending on setup automatically when there is a save
> > action and would delete when record is deleted, pretty slick.
>
> Hmm, thx :)


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



Helper dynamically loading other helpers

2007-07-13 Thread mac joost

Hi,

In my plugin a web-developer can add custom helpers. Therefore I load
the needed helpers dynamically. In the controller, this works fine,
but now I want to dynamically load other helpers in my main helper.
This doesn't work, since the view class loads all helpers before any
helper code is excecuted.

Is there a way for a helper to call a helper loaded in the
controller?
DynHelperName::functionName() does not work in my case because then
any 'startup variables' are not loaded in the Helper Class.

Or, how can I load other helpers in my main helper after the view
class has done it's work (maybe by just copiing parts of view.php)?

Thanks!


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



Cake1.2 Validation fails but no messages shown..

2007-07-13 Thread Mike Green

Dear all

I have a very simple setup, two tables, linked by id:

Table 1: (channels): ID, channel_name, source, number
Table 2: (channel_actions): ID, channel_id, action, address

Table2 links to Table1 through channel_id->id

When I add a new channel (table1) I have set the validation to
"VALID_NOT_EMPTY" in the number field. And If I try to save the row
with the field empty, it promptly shows me the error "This field
cannot be left blank"

HOWEVER

When I try to create a new channel_action (table2), which also has the
validation set to "VALID_NOT_EMPTY" in the address field, the save
fails BUT no error message are shown! If I put data in the field and
hit save, everything saves as it should.

Is this a known bug? Or Am I doing things the wrong way?

Many thanks in advance

Mike


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



Re: Upload behavior

2007-07-13 Thread Tijs Teulings

On 13-jul-2007, at 9:12, AD7six wrote:
>
> On Jul 12, 1:53 pm, Tijs Teulings <[EMAIL PROTECTED]> wrote:
>
> Hi Tarique,
>
> The behavior in cheesecake is almost stripped to the bone, and has
> some assumptions built in (where the files will go meaning the use of
> WWW_ROOT, each file is a foto, the format for the name of the thumb
> file etc.). For a photo driven site I guess it's what's needed.
>
> Hi Tijs,
>
> The paste was not for a finished version but I did a bit more than
> change the way the default setup works. I added/did the following:
>  * style changed to be more inline with other behaviors (use of
> extract so you don't need $this->params to refer to all your variables
> for example)
>  * changed to work with almost no parameters
>  * made separate methods for some operations such as determining file,
> thumb and path names
>  * the folder to save can be configured/changed on the fly 'dir' =>
> '{APP}uploads{DS}{$class}{DS}{$foreign_id}' <- those get replaced when
> used
>  * the thumb/versions to save can be configured/changed on the fly
> ''name' => '{$file}.small.{$ext}' <- can be what you like
>  * added a name cleanup routine (only applicable if you are not using
> random filenames) so that áccëñtèd characters in file names are
> converted
>  * fixed the beforeDelete method and wrote it to ensure that the pics/
> thumbs/versions of abcd.jpg are not deleted when you delete the pic
> bcd.jpg
>
> I changed it to use relative file paths when saving to the database,
> although that's currently hard coded. Not sure if it is still a bit
> too db-centric as a model may not be a table in the db of course.
>
> The thing that mildly bugged me before was that a file (upload) is a
> file, not a jpeg/png. The behavior was and still is (because I decided
> to stop thinking and just write something) a bit foto centric imo. I
> need to be able to upload images and pdfs, but the same upload
> behaviour could be used for any file type, so if it includes image
> resizing, shouldn't it include any of doc to text, text to pdf, mp3 to
> first x seconds, movie to first x seconds, unzip zip etc. ?
>
> I like the way cheesecake keeps things separate by outsourcing image
> manipulation to a vendor. Maybe configuring a callback is a
> possibility, maybe image resizing should be done in the model or maybe
> I'm thinking too much.
>
> Anyway, thoughts?
>
> AD

Hi Andy,

Ok, i missed all that from my quick scan of the code. Sounds  
excellent. What i'll do first is use your version as a base and then  
fix some of the things i found like the resizing and not being able  
to update 'extra' fields you might have used without uploading a new  
image.

I guess the second step would indeed be to generalize everything a  
bit more for file uploads of different types. I could take a look at  
the cheesecake method for 'outsourcing' image handling to a vendor.  
Some way to configure actions based on mimetype arrays would be  
nice... The filename array could serve as a base for that, i do like  
that you can set that up in the single model and don't need much  
logic in the controller at all. Something like this might work:

var $actsAs = array('Upload' => array(
'filename' => array(
'Image'=> array( // <-- file subtypes (may or 
may not refer to  
model)
'dir' => 'files/images',
'overwrite_existing' => false,
'create_directory' => false,
'allowed_mime' => array('image/jpeg', 
'image/pjpeg', 'image/ 
gif', 'image/png'),
'allowed_ext' => array('.jpg', '.jpeg', 
'.png', '.gif'),
'thumbsizes' => array(
'small' 
=>  array('width'=>100, 'height'=>100),

'medium'=>  array('width'=>220, 'height'=>220),
'large' 
=>  array('width'=>800, 'height'=>600)
)
)
'Document'=> array(
'dir' => 'files/docs',
'overwrite_existing' => false,
'create_directory' => false,
'allowed_mime' => array('text/plain', 
'application/msword',  
'application/pdf'),
'allowed_ext' => array('.txt', '.pdf', 
'.doc'),
'parse_text' => array(true, 
'db_field'=>'text'), // parse text  
and store in db field for searches/extract
)
)
   

Re: Upload behavior

2007-07-13 Thread Gorka

I agree that file uploading should be made as generic as possible, and
enabling some callbacks for file processing should be a great bonus.

I used uploadBehaviour as published in the Bakery for a recent project
and -though it really simplified my work- I had to make some
adjustments for it to work properly. Still I wasn't happy with it
being so image oriented and also I would prefer not to hardcode the
file fields in the DB model (id, name, photo1, photo2, photo3, pdf...)
which, for example, limits the number of images a post might have.
IMHO, this should be addressed in a similar fashion to
translateBehaviour, where an extra table is added to the DB and
associations are made on the fly to the corresponding model. That way
we could have Post hasMany Files, defining file type as 'image',
'video', 'pdf', or whatever and allowing setting up a callback to
handle any extra file manipulations.

The architecture for such a solution doesn't seem trivial, but it
certainly can and should be done as it would be of great value for the
framework itself and for all the bakers out there.

I'm really short on time these days, but will give it a try. Anyone
else? :)

On 13 jul, 09:12, AD7six <[EMAIL PROTECTED]> wrote:
> On Jul 12, 1:53 pm, Tijs Teulings <[EMAIL PROTECTED]> wrote:
>
> Hi Tarique,
>
> The behavior in cheesecake is almost stripped to the bone, and has
> some assumptions built in (where the files will go meaning the use of
> WWW_ROOT, each file is a foto, the format for the name of the thumb
> file etc.). For a photo driven site I guess it's what's needed.
>
> Hi Tijs,
>
> The paste was not for a finished version but I did a bit more than
> change the way the default setup works. I added/did the following:
>  * style changed to be more inline with other behaviors (use of
> extract so you don't need $this->params to refer to all your variables
> for example)
>  * changed to work with almost no parameters
>  * made separate methods for some operations such as determining file,
> thumb and path names
>  * the folder to save can be configured/changed on the fly 'dir' =>
> '{APP}uploads{DS}{$class}{DS}{$foreign_id}' <- those get replaced when
> used
>  * the thumb/versions to save can be configured/changed on the fly
> ''name' => '{$file}.small.{$ext}' <- can be what you like
>  * added a name cleanup routine (only applicable if you are not using
> random filenames) so that áccëñtèd characters in file names are
> converted
>  * fixed the beforeDelete method and wrote it to ensure that the pics/
> thumbs/versions of abcd.jpg are not deleted when you delete the pic
> bcd.jpg
>
> I changed it to use relative file paths when saving to the database,
> although that's currently hard coded. Not sure if it is still a bit
> too db-centric as a model may not be a table in the db of course.
>
> The thing that mildly bugged me before was that a file (upload) is a
> file, not a jpeg/png. The behavior was and still is (because I decided
> to stop thinking and just write something) a bit foto centric imo. I
> need to be able to upload images and pdfs, but the same upload
> behaviour could be used for any file type, so if it includes image
> resizing, shouldn't it include any of doc to text, text to pdf, mp3 to
> first x seconds, movie to first x seconds, unzip zip etc. ?
>
> I like the way cheesecake keeps things separate by outsourcing image
> manipulation to a vendor. Maybe configuring a callback is a
> possibility, maybe image resizing should be done in the model or maybe
> I'm thinking too much.
>
> Anyway, thoughts?
>
> AD


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



Re: Updating a via ajax, although getLastInsertId() or $this->Comment->id does not retrieve the last inserted record.. why?

2007-07-13 Thread wralph

The last insert id should be set straight after the call to save. What
is the SQL output from the call to save? Is the data getting saved
correctly?

Try assigning it first before using it in the find query like so
(shouldn't matter):

$last_id = $this->Comment->getLastInsertId();
$this->set('comment', $this->Comment->findAll('id ='.$last_id);

Regards,
Winston


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



bad images url

2007-07-13 Thread d'plus

I'm using ver. 1.1.
I've got problems with images urls.
In my default main controller which loads first all images are ok.
But when I go into diffrent controller all images on the website are
gone.
I'm generating image url like this:



What I'm doing wrong?


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



Re: Paginating the results after creating a dummy model to filter HABTM results?

2007-07-13 Thread inVINCable

Hey AD7six,


I searched the entire model file and several of the main cake files
and cannot seem to find the bindAll parameter you are talking about.
Do I have to modify code somwhere to get it to work somehow?

Thank you.

On Jul 10, 8:59 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Jul 10, 5:22 pm, inVINCable <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hey guys,
>
> > I am trying to paginate the results after creating an association on
> > the fly that lets me search the results of a HABTM association. This
> > is what it look like...
>
> > $userschool = $this->Session->read('User.school_id');
> > $this->Story->bindModel(array('hasOne' =>array('StoriesTag' 
> > =>
> > array(;
> > $condition['Story.school_id'] = $userschool;
> > $condition['StoriesTag.tag_id'] = $tagid;
> > //$this->set('test',$this->Story->findAll($condition));
>
> > Now it works fine just like this, although I don't want a findAll()
> > statement, I want to paginate the results. So I have tried all
> > different kinds of combinations of this:
> > $this->set('test',$this->paginate('Story', $condition));
>
> > And no matter what I do, nothing seems to work. :(
>
> > It keeps throwing me an error because there is no "StoriesTag.tag_id
> > in the stories field. But I though paginate worked exactly the same
> > functionally to that of a findAll() statement?
>
> > I'm sure I am doing something wrong, could someone please offer
> > advice.
>
> > Thank you.
>
> Check the parameters for bindAll, by default it is bound for one
> query, you want to make it permanent.
>
> hth,
>
> AD


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



Why I recieved a request /controller/action/favicon.ico?

2007-07-13 Thread hi and hello


  And the cakephp give me a url such as metioned above at a
request,why?
  Is there something configured not right?


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



Re: Upload behavior

2007-07-13 Thread Dr. Tarique Sani
On 7/13/07, AD7six <[EMAIL PROTECTED]> wrote:
>
>
>
>
> The behavior in cheesecake is almost stripped to the bone, and has
> some assumptions built in (where the files will go meaning the use of
> WWW_ROOT, each file is a foto, the format for the name of the thumb
> file etc.). For a photo driven site I guess it's what's needed.



Sorry, I had assumed that the original was committed  at least once  but
apparently it was not

Tarique

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

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



cacheing a dynamic menu

2007-07-13 Thread Ski

Hi,

  I am trying to implement caching for my site and one of the major
places needing this is the dynamic menu.

  Because this appears on every page, the model data for the menu is
fetched in the AppController and used in an element included by the
default layout.

  How would I go about ensuring that this is cached?

  Thanks

  Glen


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



Re: svn screencast + application deployment

2007-07-13 Thread cakeFreak


Sorry for asking twice Chris!

I was just curious!

Well does Capistrano works even for PHP applications?

about "I like to make sure my changes actually work, "

If you branch your code via svn, you can work on the devapp, test the
changes and then merge/commit them on the trunk only when they work.

At this point you can commit the trunk to the svn repositry on the
live server. This was the strategy I was asking about.
Well what should get sincronysed is the working copy and not the
repository itself.

Dan


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



Re: Being cached ?

2007-07-13 Thread Feris Thia

On 7/13/07, majna <[EMAIL PROTECTED]> wrote:
>
> Must be something else. Paste controller code.

Hi Majna,

This is my code

==
Product->recursive = 0;
$this->set('products', $this->Product->findAll());
}

function view($id = null) {
if (!$id) {
$this->Session->setFlash('Invalid id for Product.');
$this->redirect('/products/index');
}
$this->set('product', $this->Product->read(null, $id));
}

function add() {
if (empty($this->data)) {
$this->set('users', 
$this->Product->User->generateList());
$this->render();
} else {
$this->cleanUpFields();
if ($this->Product->save($this->data)) {
$this->Session->setFlash('The Product has been 
saved');
$this->redirect('/products/index');
} else {
$this->Session->setFlash('Please correct errors 
below.');
$this->set('users', 
$this->Product->User->generateList());
}
}
}

function edit($id = null) {
if (empty($this->data)) {
if (!$id) {
$this->Session->setFlash('Invalid id for 
Product');
$this->redirect('/products/index');
}
$this->data = $this->Product->read(null, $id);
$this->set('users', 
$this->Product->User->generateList());
} else {
$this->cleanUpFields();
if ($this->Product->save($this->data)) {
$this->Session->setFlash('The Product has been 
saved');
$this->redirect('/products/index');
} else {
$this->Session->setFlash('Please correct errors 
below.');
$this->set('users', 
$this->Product->User->generateList());
}
}
}

function delete($id = null) {
if (!$id) {
$this->Session->setFlash('Invalid id for Product');
$this->redirect('/products/index');
}
if ($this->Product->del($id)) {
$this->Session->setFlash('The Product deleted: id 
'.$id.'');
$this->redirect('/products/index');
}
}

}
?>
==

Thanks for any suggestion !

Regards,

Feris

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



Re: $this->data what are the possibilities

2007-07-13 Thread Preloader

Ahh, I see, misinterpreted your message ... :-)  yes, you're
absolutely right!

Greets, Christoph


On 13 Jul., 09:29, AD7six <[EMAIL PROTECTED]> wrote:
> On Jul 12, 1:19 pm, Preloader <[EMAIL PROTECTED]> wrote:
>
> > Thank you AD and keymaster, this helps me out!
>
> > @AD: Can you tell me, why I should not use checkboxes instead of
> > multiple selects?
>
> Hi Christoph,
>
> I didn't say that. I said that the means to achieve functional
> multiple checkboxes != having your checkboxes named in the way that
> you want them (maybe)
>
> Cheers,
>
> AD


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



Re: Being cached ?

2007-07-13 Thread majna

Must be something else. Paste controller code.

On Jul 13, 4:49 am, "Feris Thia" <[EMAIL PROTECTED]> wrote:
> On 7/13/07, kionae <[EMAIL PROTECTED]> wrote:
>
>
>
> > Are you sure the database is actually updating, and you're not just
> > being redirected to the list view without seeing an error message?
>
> Yes, it is updating. It seems like it has to do with browser cache and HTTP
> header, but I don't  know how to do it here.
>
> Regards,
>
> Feris


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



Re: Using a Join Table to Join one table?

2007-07-13 Thread AD7six



On Jul 12, 10:18 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I'm getting fairly confused on how to do the follow so I'm reaching
> out and hoping that someone here can either show me how to do this or
> help me solve the problem.
>
> Problem:  I'm building a site navigation that is in a tree format.
> The relationship is HABTM.

O double posting... bad karma.

AD


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



Re: $this->data what are the possibilities

2007-07-13 Thread AD7six



On Jul 12, 1:19 pm, Preloader <[EMAIL PROTECTED]> wrote:
> Thank you AD and keymaster, this helps me out!
>
> @AD: Can you tell me, why I should not use checkboxes instead of
> multiple selects?

Hi Christoph,

I didn't say that. I said that the means to achieve functional
multiple checkboxes != having your checkboxes named in the way that
you want them (maybe)

Cheers,

AD


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



Empty data return Fatal Error

2007-07-13 Thread Feris Thia

Hi All,

I have a controller and view generated with Bake and has modified the
add function(). All seems well, but when I have empty data submitted
it returns :

Notice: Trying to get property of non-object in
C:\wamp\www\cake2\cake\libs\controller\controller.php on line 514

Fatal error: Cannot access empty property in
C:\wamp\www\cake2\cake\libs\controller\controller.php on line 514
0 query took ms

What's wrong ?

I attached my code here


User controller (add function)

function add() {
$this->set('username_error', 'Please enter user name ');
if (empty($this->data)) {
$this->render();
} else {

if($this->User->validates($this->data)&&!empty($this->data)):
$this->cleanUpFields();

if($this->User->findByUsername($this->data['User']['username']))
{
$this->User->invalidate('username');
$this->set('username_error','User 
already exist');
}
else
{
if ($this->User->save($this->data)) {
$this->Session->setFlash('User 
has been saved');
$this->redirect('/users/index');
} else {

$this->Session->setFlash('Please correct errors below.');
}
}
else:
$this->validateErrors($this->data);
endif;
}
}

User Model

 VALID_NOT_EMPTY,
'useralias' => VALID_NOT_EMPTY
);

var $hasMany = array ('Product' => array(
'className' => 'Product',
'condition'=>null,
'order'=>null,
'foreignKey'=>'user_id')
);
}
?>

add.thml view

New User


labelTag('User/useralias', 'Useralias');?>
input('User/useralias', array('size' => '60'));?>
tagErrorMsg('User/useralias', 'Please enter the
Useralias.');?>


labelTag('User/username', 'Username');?>
input('User/username', array('size' => '60'));?>
tagErrorMsg('User/username', $username_error);?>


submit('Add');?>



link('List Users', '/users/index')?>




Regards,

Feris

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



  1   2   >