Re: Array to XML

2010-06-16 Thread calvin
There are many ways to convert the same array into XML. How will the
function know which you want? How will it know when you want to add a
value as an attribute or as a textnode?

On Jun 15, 10:34 pm, Kyle Decot  wrote:
> I need to take an array that I have and turn it into something similar
> to:
>
> 
>
> 
>
> sdfsdfkdsjfdsfljdsflkjdsfkldsjf
>
> 
>
> 
>
> 
>
> Is it possible to do this without knowing the exact structure of the
> array I'm providing. I want to be able to pass it pretty much anything
> as this will be used in a bunch of methods. Thanks for any help you
> can provide me with.

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

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


Re: serious problem with cakephp about CakePHP Auth Component & Permissions

2010-06-16 Thread calvin
No one is going to do your work for you (no matter how "easy" you
claim it is). And you can't become a successful web develop by being a
copy-n-paste programmer. Instead of looking for source code on the
web, just read the documentation for Cake and for the components
you're trying to use. If you still don't get it, try some tutorials.
Then when you run into __specific__ problems with your code, paste a
snippet in your post or use pastebin.com to show us what part of your
code you're having trouble with. Don't just upload a zip file of your
app folder and expect people to debug your program and get it working
for you.

On Jun 15, 10:12 am, hoss7  wrote:
> hi
>
> i have serious problem with cakephp about CakePHP Auth Component &
> Permissions
>
> i am search in the internet and book.cakephp.org and cakeforge.org and
> cakeqs.org
> for find some easy and professional idea(source code) for create
> CakePHP Auth Component - Users, Groups & Permissions but i find noting
>
> please help me and if you are professional in cakephp send some code
> to my email
> & explain step by step(i am new in cake)
>
> i want sample code like 
> this:http://www.studiocanaria.com/articles/cakephp_auth_component_users_gr...

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

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


Re: Install cakePHP in Ubuntu 10.04

2010-06-16 Thread calvin
I dunno, I actually got Cake 1.3 set up on a Ubuntu Server (10.4)
server pretty easily. To enable a module that isn't enabled by
default, just use a2enmod. I didn't realize the Ubuntu Apache package
came with that command, so I actually did it manually at first. I also
wasn't used to the modular configurations, which was different from
how it is in Windows. But it's not too hard to figure out. Actually
hammering out the bugs in gnome and the OS itself was much more
challenging than actually setting up the web server and Cake IMO.

The only advice I have is to look at the modules-available directory
before you try to manually change the config files to enable a module.
A lot of the documentation or articles online have a different name
for the mod_rewrite module than the one that is actually used in
Ubuntu. So if you follow those instructions to add the module
manually, it will throw an error saying the file couldn't be found.
But if you just use a2enmod (which just copies the config file from
modules-available to modules-enabled) to enable mod_rewrite, then it
will work perfectly.

On Jun 16, 3:33 am, leo  wrote:
> Installing AMP on Ubuntu is trivial. The confusing part is getting
> CakePHP to work. It is not out-of-the-box because the Ubuntu default
> Apache config doesn't include mod_rewrite. Even when you have that set
> up, there is some Debian-ness to contend with. The trick is finding
> the right files to alter and making the right alterations, hence my
> earlier post linking 
> tohttp://leoponton.blogspot.com/2010/05/getting-cakephp-up-and-running-
>
> On 16 June, 10:46, Zaky Katalan-Ezra  wrote:
>
> > install LAMPhttp://www.howtoforge.com/ubuntu_lamp_for_newbies
> > Unzip the cakephp where ever you like, home/zaky/cakephpproj/ for example.
> > under /var/www create a link you your site
> > cd /var/www
> > sudo ln -s home/zaky/cakephpproj/ mynewapp
>
> > chmod 777 app/tmp
>
> > update app/config/database.php with you database details.
>
> >http://localhost/mynewapp
>
> > On Tue, Jun 15, 2010 at 6:34 PM, Abrão Ximenes 
> > wrote:
>
> > > Hello, I am very interested to learn cakePHP, can anyone  send the steps 
> > > to
> > > me how to install and configure/setting cakePHP in Ubuntu 10.04?
>
> > > Thanks
> > > Newbie
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.comFor
> > >  more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> > --
> > Regards,
> > Zaky Katalan-Ezra
> > QA Administratorwww.IGeneriX.com
> > Sites.IGeneriX.com
> > 054-7762312

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

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


Re: 10 PHP code snippets for working with strings

2010-06-16 Thread calvin
Eh, none of those snippets are particularly clever. They're all either
really obvious or just poorly written (the Twitter, contains(), and
the URL transform ones for example). With the way those snippets are
presented, I thought they'd either help you accomplish difficult tasks
or be elegantly written. Maybe if you're unfamiliar with regular
expressions then you might find the regexp snippets useful; otherwise,
meh...

I mean, does how to use fgetcsv() really warrant a snippet? Or how to
check if a string starts with/contains another string? Anyone can look
up those functions on php.net and figure it out for themselves within
15 seconds. There are much more complicated or less well documented
php functions/classes that would be more worthy of a snippet to
explain their usage--e.g. mcrypt, soap, xml-rpc, etc.

On Jun 16, 5:57 am, amiable_indian  wrote:
> Some of the snippets might be good enough to be added to the
> framework.
>
> http://www.catswhocode.com/blog/10-php-code-snippets-for-working-with...
>
> -amiable

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

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


Re: Validation - specifying which rules to use

2010-06-16 Thread calvin
That's pretty clever. Though it would still be nice to have a way to
simply specify which rules to ignore/use--the same way that you can
specify which fields to validate.

On Jun 16, 8:36 am, LunarDraco  wrote:
> There are ways to deal with this, often times you need to use
> different validation rules for adding a new record vs updating an
> existing record. Or sometimes as an administrator you want to be able
> to override the validation that is to take place.
>
> Jonathan Snook has posted a pattern of using the multiple validations
> based on the controller action that is being called. So it is very
> possible to do what you are looking for.
> His article is here and should get you moving in the right direction.
> If its not a perfect fit, it will at least give you some ideas around
> how to specify multiple validations and then select the correct
> validation for the current 
> use.http://snook.ca/archives/cakephp/multiple_validation_sets_cakephp/
>
> On Jun 15, 7:45 am, WhyNotSmile  wrote:
>
> > Is there any way to validate on a restricted set of rules in the
> > controller?
>
> > For instance, I have an email address which is validated in the model
> > like this:
>
> > var $validate = array(
> >      'email' => array(
> >          'maxlength' => array(
> >              'rule' => array('maxLength',100),
> >              'message' => 'Email address must be 100 characters or
> > less'
> >           ),
> >           'notEmpty' => array(
> >               'rule' => 'notEmpty',
> >               'message' => 'Please enter your email address'
> >            ),
> >           'validEmail' => array(
> >               'rule' => array('email', false),
> >               'message' => 'Please enter a valid email address'
> >            ),
> >           'unique' => array(
> >               'rule' => array('isUnique', false),
> >               'message' => 'This email address has already been
> > registered.  If you have forgotten your password, you can get a
> > reminder by clicking on the link on the login page'
> >            )
> >      )
> > )
>
> > At one point I want to validate an email address, but I don't want to
> > check that it's unique (because I'm not actually saving it, just
> > checking it's otherwise valid).
>
> > So far I have:
>
> > if($this->User->validates(array('fieldList' => array('email' {
> >  ...
>
> > }
>
> > Is there any way to define which rules I want it to validate against,
> > or does it have to do all of them?  I can't find anything on this in
> > the validation section of the manual (using v.1.2), so any directions
> > would be much appreciated.
>
> > Thanks.

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

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


Re: model-view - related data; choos fields to be displays?

2010-06-15 Thread calvin
Sorry, I misunderstood your question. I hope I didn't offend you. That
wasn't my intention.

And the Cookbook section called "Developing with CakePHP" actually
does sorta break everything down into where each function is called
from/when you'd use it. With the API documentation, you have to look
at which class it belongs to. Since find is a Model function:
http://api13.cakephp.org/class/model#method-Modelfind

--that means it needs to be called from a Model object. And since you
have access to a model object inside of the model ($this->find()) and
inside of controllers ($this->MyModel->find()), you can use it in
either model or controller.

But I generally find the Cookbook more informative and easier to use
than the API documentation.

On Jun 15, 2:54 am, mivogt-LU  wrote:
> @calvin:
> Thanks I am not that new to php, I know what an array and and array
> index is
> I can not du as you suppose as the data I need is not passed to the
> $booking array.
> $booking only contains the foreignkey in the field mealclassid
> the field melclassKennung is not available.
> I doublechecked this once by hardcoding it in and getting errors for
> non available array index
> once did the debug ($booking) to see what is contained.
>
> This is why I asked for hot to do within cake.
> I might do myselfe some php sql syntax and get my data from the db
> directly
> but this is no good style i was told.
>
> My tryout using cakes find() also did not hit when I tired it inside
> the view code
> somhow I think it was the wrong place and might work if i do the
> find() inside the controller
>
> ** might be a guess for the cake book: add in the api where to call
> wich command **
>
> cu
>
> michael
>
> On 15 Jun., 02:51, calvin  wrote:
>
> > When you baked your models did you set the displayField property when
> > cake bake asks you to? "requestName" and "mealclassKennung" are not
> > standard display field names. Cake only knows to look for fields
> > called "name" or "title" to use as display fields by default. If you
> > want to display any other field, you need to tell cake which field to
> > use.
>
> > If you don't want to use cake bake to generate your views for you,
> > then just edit the code manually. Replace $booking['mealclass_id']
> > with $booking['mealclassKennung']. That's just basic PHP. If you can't
> > understand what your code says, then I'd recommend getting a PHP book
> > and skimming through it--particularly read the chapters about how
> > arrays and associative arrays work. You're going to need to know that
> > stuff to work with cake.
>
> > On Jun 14, 11:26 am, mivogt-LU  wrote:
>
> > > HI there,
>
> > > if I choos in the index view the view button I get all my models data
> > > and also the related models are shown somehow.
>
> > > i.e. if I choos from customer-index: view I get the customer details.
> > > I also get the orders he placed in some manner.
> > > Sadly instead of an item name I am only shown the indexnumbers.
>
> > > i.e.:
>
> > > Related Bookings
> > > Id      Name    Customer Id     Mealclass Id    Request Id
>
> > > I would like to show up other fields instead of the id.
> > > instead of requestID I prefer showing requestName
> > > instead of mealclassID I prefer showing mealclassKennung
>
> > > Might you please tell me how to change my code from
> > >                         
> > >                         
> > >                         
> > >                         
> > >                         
>
> > > to something doing as I want?
> > > I know I ll need to use the indexes to show up the fitting item out of
> > > the database.
> > > But still not that fit in cake to get the solution on my own.
>
> > > Thanks in advance..
>
> > > Michael

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

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


Re: 1.3 $scripts_for_layout not working

2010-06-15 Thread calvin
It depends on where you try to use the $scripts_for_layout to include
a script from. You can't use it from the layout or elements included
from the layout (because $scripts_for_layout has already been printed
out). So in those cases, your best bet is just to hard code it into
the document head.

On Jun 15, 1:45 am, Ragnis  wrote:
> In my header i have 
>
> But when i try to use this, then the script tag doesn't appear in the
> header:
> Html->script('general', array('inline' => false)); ?>

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

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


Re: Using query in the model

2010-06-15 Thread calvin
Matt, query() is a model method (as you can see in the cookbook:
http://book.cakephp.org/view/456/query ). So there is no need to
"guess" what the syntax should be.

If you're doing it from the model, then you'd call it using $this-
>query();

If you're doing it from the model, but need to call it from an
associated model, then it would be: $this->AssociatedModel->query();

If you're doing it from a controller, then you would do it like so:
$this->MyModel->query();

The $this 'pseudo-variable' represents the current calling-object:
http://us2.php.net/manual/en/language.oop5.basic.php

And if you are making an update, then query() will not return any
data. If you are trying to check if the query succeeded or not, you
need to do use the 'identical' comparison (=== or !==):

if ($this->query($query) !== false) {
  // success
} else {
  // failed
}

On Jun 15, 9:17 am, Matt Y  wrote:
> So I have searched for this, but the cookbook does not help me with my
> problem.
>
> I have been trying to write functions in my models that use the
> query() function that updates some HABTM tables
>
> i have copied many pieces of code to try and make this happen but have
> had no luck. I have tried
>
> $results = $this->query();
> $results = $this->Model->query();
> $this->query();
> $this->Model->query();
>
> What am I doing wrong, is it just not possible to do this in model
> code, must I put all calls to the query function in the controller?
>
> Thank you for your help,
>
> Matt

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

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


Re: Automagic Form (Drop down list)

2010-06-15 Thread calvin
And also, if you have a nonstandard display field that isn't just
being used for this particular select input, then you will probably
want to set the $displayField property in your model so cake can
automagically display that field in find('list') results and in
tables.

On Jun 15, 8:46 am, euromark  wrote:
> usually you dont pass the dummy field via controller
> there is an empty field param for it
>
> echo $this->Form->input('category_id', array('options'=>$cats,
> 'empty=>'dummyName');
> or
> echo $this->Form->input('category_id', array('options'=>$cats,
> 'empty=>array('dummyFieldValue'=>'dummyName')));
>
> On 15 Jun., 17:35, leo  wrote:
>
> > You might also want to do this if you want to specify which fields to
> > return:
> > $this->set('categories', $this->Item->Category-
>
> > >find('list',array('fields'=>array('id','other_name'));
>
> > If you need to add a dummy field, try:
> > $categories = array(0=>'unassigned') + 
> > $this->Item->Category->find('list',array('fields'=>array('id','other_name'));
>
> > $this->set('categories', $categories);
>
> > And in the view, if your categories aren't appearing (because the
> > naming is different) try:
> > echo $this->Form->input('category_id',array('options'=>$cats));

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

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


Re: : reuseable view

2010-06-15 Thread calvin
Yea, I think you'll be hard pressed to find a justification for
merging all the views together. It could become a maintenance
nightmare. Besides, cake bake makes generating views quick and
painless. It literally takes only 2-3 seconds to generate all the
views for a single controller/model.

If you're going to spend time working on views and want to eliminate
duplicate code, I would recommend breaking down repeated view code
into elements. For example, most of my edit and add views share a form
element. The element is usually named something like form.user or
form.rates (allows adding multiple rates at once) and contains
conditional logic for handling the differences between edit and add
actions.

Likewise, another good idea (IMO) I've found is to eliminate the
"actions" list that cake bake generates for each view. These actions
are hardcoded links that can be a pain to update. Some people just
rebake every time they make changes to model associations to update
the actions list, but this isn't really an option if you have
customized views that have been modified after baking. So instead of
that, I just have an element called "actions" that I place inside of
each view, which renders the actions that I specify inside of the
controller like so:

var $actions = array(
array(
'label' => 'Explore {%N}',
'url' => array('action' => 'explore'),
'pass' => true,
'on' => array('view', 'edit')
),
array(
'label' => 'View {%N}',
'url' => array('action' => 'view'),
'pass' => true,
'on' => array('explore', 'edit')
),
array(
'label' => 'Edit {%N}',
'url' => array('action' => 'edit'),
'pass' => true,
'on' => array('view')
),
array(
'label' => 'Delete {%N}',
'url' => array('action' => 'delete'),
'pass' => true,
'on' => array('view', 'edit')
),
array(
'label' => 'List {%Ns}',
'url' => array('action' => 'index')
),
array(
'label' => 'List {%Ns}',
'url' => array('controller' => 'media_files', 'action' => 
'index')
),
array(
'label' => 'New {%Ns}',
'url' => array('controller' => 'media_files', 'action' => 'add')
)
);

You can probably also turn "associated data" tables into elements or
create helpers that help you generate AJAX tables or something. All of
this will help you simply your views and reduce repetitive code.

On Jun 15, 8:44 am, leo  wrote:
> Yes, you can do that by having conditional code in the view and
> setting the template:
> $this->render('crudView');
>
> and a mode in a view variable:
> $this->set('mode','edit');
>
> In general, you be better off following the accepted way, though, as
> things can get terribly comfusing and complicated if you don't. You're
> not saving paper or electricity by combining into one view. Keep it
> simple and keep it clear.
>
> On 15 June, 09:35, Mario Simaremare  wrote:
>
> > dear all,
>
> > i am very new with php and the cake. i used to play with java
> > actually.
> > i would ask you, if there is a way in the cake to create a single view
> > file to view, add, and edit then reuse them.
> > i mean to use the same view with different models. the views
> > automatically detects the table columns and it's header then fill the
> > cell with the thrown models data?
>
> > thank you,
>
> > regards,

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

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


Re: i was defined one global variable in core.php how can i use that variable in my app controller

2010-06-15 Thread calvin
define() is a PHP function that defines a constant: http://us.php.net/define

So you can simply set $theme to xxx, e.g.:

var $theme = xxx;

On Jun 15, 5:11 am, Narendra Padala  wrote:
> Hi all I am new to cake php,
>
> I am created some themes like red, green blue etc.
>
> i have to use these themes in my appliaction.
>
> so i defined in my app controller like this
>
>     var $view = 'Theme';
>     var $theme = 'black'; // here i need global value.
>
> this value i have to set in the core .php
>
> like this i wrote
>
>         define('', 'blue');
>
> now i need use the '' value to
>
>     var $theme = $''  // here how can i use.
>
> Please any one can help me out to solove this problem

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

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


Re: Getting .htpasswd protection to work

2010-06-14 Thread calvin
Actually, you can use .htaccess for http authentication on windows
machines; you just need to be running Apache or one of the few non-
Apache web servers that mimic this functionality. I would recommend
switching to a web hosting service based on *nix/Apache web servers--
especially if you're developing in PHP. Unless you're developing in
ASP or using some other Windows-exclusive technology, there's no
benefit to using a Windows/IIS-based web host. You'll have less
incompatibility issues, more features, and more freedom with a *nix/
Apache-based web host, which usually come with shell accounts.
DreamHost is a good option. They're likely to be just as cheap as
Network Solutions, if not cheaper, and they have great support (and
aren't involved in any nasty business like Network Solutions).

And if you decide in the future to switch to an Apache-based web host,
I would recommend using digest authentication unless you're going to
be doing everything over an https connection. Pretty much all web
browsers except for Lynx support digest authentication now, so there's
no reason to use basic authentication, which is antiquated and not
secure. It's just as easy to set up digest authentication (you just
use htdigest instead of htpasswd).

On Jun 14, 8:27 pm, Jeff  wrote:
> Hi Andy,
>
> Thanks again for the help.  It turns out that because my server
> (hosted by GoDaddy) was running on Windows, I was not able to
> use .htaccess/.htpasswd authentication.  In addition, as you
> mentioned, I did not have the server's full path, which GoDaddy
> provided me.  I will have to keep that "echo __FILE__;" trick in my
> book though.
>
> Thanks.
> Jeff
>
> On Jun 2, 12:10 am, Andy Dirnberger  wrote:
>
> > While that may be your FTP user's full path, it most likely isn't your
> > server's full path. Try putting a file in webroot with the line:
> > echo __FILE__;
>
> > For example, putting that line in a file called path.php will probably
> > give you /full/path/to/app/webroot/path.php rather than just /app/
> > webroot/path.php.
>
> > On Jun 1, 11:16 pm, Jeff  wrote:
>
> > > Hi Andy,
>
> > > Actually that is my full path.  At least when I FTP to my server,
> > > immediately in the root directory "/" is the app folder.  Is there
> > > anything else that could be wrong?
>
> > > Thanks
>
> > > On May 12, 9:20 pm, Andy Dirnberger  wrote:
>
> > > > You need to use /the/full/path/to/app/.htpasswd.
>
> > > > On May 12, 11:17 pm, Jeff  wrote:
>
> > > > > Hi, I have the following in my /app/webroot/.htaccess file, as well as
> > > > > a matching .htpasswd file in the correct directory per multiple online
> > > > > how-to's, but my password protection is not working.  Can someone tell
> > > > > me what I am doing wrong?
>
> > > > > /app/webroot/.htaccess
>
> > > > > AuthUserFile /app/.htpasswd
> > > > > AuthName "Restricted Area"
> > > > > AuthType Basic
> > > > > require valid-user
>
> > > > > 
>
> > > > >         RewriteEngine On
> > > > >         RewriteCond %{REQUEST_FILENAME} !-d
> > > > >         RewriteCond %{REQUEST_FILENAME} !-f
> > > > >         RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
>
> > > > > 
>
> > > > > I saw one tutorial that said I needed to find httpd.conf or something
> > > > > to that effect, but I don't see anything.  Maybe this config file
> > > > > doesn't exist with the Cake setup
>
> > > > > Any help is GREATLY appreciated.
>
> > > > > Check out the new CakePHP Questions 
> > > > > sitehttp://cakeqs.organdhelpotherswiththeir CakePHP related questions.
>
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups "CakePHP" group.
> > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > > group athttp://groups.google.com/group/cake-php?hl=en
>
> > > > Check out the new CakePHP Questions 
> > > > sitehttp://cakeqs.organdhelpotherswith their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > group athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: showing data in a popup in aftersave()

2010-06-14 Thread calvin
You're getting server-side/client-side code confused. PHP code runs on
the web server, not on the visitor's web browser. It can't create pop-
up windows in the browser.

If you want to use PHP to generate JavaScript in the _view_ to pop up
a window, then you need to do that in the view, not in the model. The
model is only for reading/writing/manipulating your data.

On Jun 14, 12:03 pm, mivogt-LU  wrote:
> HI @ all,
>
> I would like to know if there is a way to settle some function inside
> my aftersave() (inside the modelcode) to open an popupwindow showing
> the modeldate in a printable format.
>
> I am thinking on something like
> function aftersave()
> {
> doPopupwindows($this->data)
>
> }
>
> and inside the popup
>
> echo $this->data->model->field;
>
> Any suggestions on this?
>
> Thanks
>
> Michael

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

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


Re: model-view - related data; choos fields to be displays?

2010-06-14 Thread calvin
When you baked your models did you set the displayField property when
cake bake asks you to? "requestName" and "mealclassKennung" are not
standard display field names. Cake only knows to look for fields
called "name" or "title" to use as display fields by default. If you
want to display any other field, you need to tell cake which field to
use.

If you don't want to use cake bake to generate your views for you,
then just edit the code manually. Replace $booking['mealclass_id']
with $booking['mealclassKennung']. That's just basic PHP. If you can't
understand what your code says, then I'd recommend getting a PHP book
and skimming through it--particularly read the chapters about how
arrays and associative arrays work. You're going to need to know that
stuff to work with cake.

On Jun 14, 11:26 am, mivogt-LU  wrote:
> HI there,
>
> if I choos in the index view the view button I get all my models data
> and also the related models are shown somehow.
>
> i.e. if I choos from customer-index: view I get the customer details.
> I also get the orders he placed in some manner.
> Sadly instead of an item name I am only shown the indexnumbers.
>
> i.e.:
>
> Related Bookings
> Id      Name    Customer Id     Mealclass Id    Request Id
>
> I would like to show up other fields instead of the id.
> instead of requestID I prefer showing requestName
> instead of mealclassID I prefer showing mealclassKennung
>
> Might you please tell me how to change my code from
>                         
>                         
>                         
>                         
>                         
>
> to something doing as I want?
> I know I ll need to use the indexes to show up the fitting item out of
> the database.
> But still not that fit in cake to get the solution on my own.
>
> Thanks in advance..
>
> Michael

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

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


Re: What is the best way to do simple authentication?

2010-06-14 Thread calvin
Are you logging in with the username "user" and the password "sekrit"?
Do you have capslock on?

I've never used the Security component in this way before (I only use
HTTP Authentication to temporarily protect a directory), but if this
is a single-user application, and you don't need user management, then
you could skip the Security component and just create /app/webroot/
{controller}/edit/.htaccess and configure the HTTP Authentication that
way. This hack only works for edit and delete because you only ever
access /{controller}/edit/{id} and not just /{controller}/edit by
itself. You can protect all the controller actions by putting
the .htaccess file in /app/webroot/{controller}, but you'll need to go
to /app/webroot/{controller}/index if you want the index action.
Alternately, you can use admin routing and just password protect
everything in /app/webroot/admin. But regardless of what you do, I'd
suggest using Digest authentication instead of Basic unless you are
doing this over a secure connection.

On Jun 13, 9:37 pm, dbme  wrote:
> I'm building a little application that displays a publically viewable
> resume but I want to protect the add/edit/delete methods for a given
> controller. It's a dead simple app for a single user and the whole Acl
> bit would be serious overkill.
>
> The Security component seemed to fit the bill so I did the following
> in one of my controllers as a test:
>
>         function beforeFilter() {
>         $this->Security->loginOptions = array(
>             'type'=>'basic',
>             'realm'=>'Authentication Required'
>         );
>         $this->Security->loginUsers = array(
>             'user'=>'sekrit'
>         );
>         $this->Security->requireLogin('edit');
>         }
>
> This code came directly from The Book(http://book.cakephp.org/view/
> 1309/Basic-HTTP-Authentication)
>
> As expected a login box will pop up when I go to that page.
> Unfortunately, when I put in the proper credentials it just pops up
> the authentication dialog again. If I hit cancel, it goes to the white
> page (the black hole I'm assuming).
>
> Any ideas on why it isn't working? Is there a better way to go about
> this?
>
> Thanks!

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

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


Re: Issue with saving data

2010-06-14 Thread calvin
Maybe post some of your code?

On Jun 13, 7:40 pm, breakintheweb  wrote:
> First off, i'm still very new to cakephp.
>
> I have two tables i'm trying to work with. The first table contains a
> list of orderable data. The second table is a list of ordered data
> id's from the first table.
>
> I want to be able to select 10,000 rows from the orderable table and
> insert there id's into the ordered table.
>
> When i select the data from the orderable table, the data is returned
> with the tables model name. I'm trying to them save it to a model with
> a differnt name. I'm not getting any errors but the data isn't
> showing.
>
> I'm sure i'm doing doing another of things wrong here.
>
> Any help is appreciated.
>
> -Justin

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

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


Re: should I know php in order to learn cakePHP

2010-06-14 Thread calvin
That's reasonable. It takes a while to get your head around the
thought paradigms that a lot of veteran programmers take for granted;
but it will come to you eventually.

Personally, I started programming with BASIC, then VB, then JavaScript/
Perl/MySQL, then PHP, and I didn't start using Cake (or any other type
of MVC framework) until about 2 years ago. So I was already pretty
experienced in web development and PHP by the time I picked up Cake,
but I think there's a huge advantage to learning Cake or a similar MVC
framework early on. It teaches a lot of good programming practices
that you will benefit from regardless of what language or framework
you're using. In contrast, because my programming knowledge is mostly
self-taught, and I'd always stubbornly preferred to "roll-my-own" in
the past instead of picking up a framework, I have picked up a lot of
bad habits that Cake has forced me to gradually unlearn over the past
2 years.

So in that sense, even though learning Cake as a PHP newbie is much
more challenging, the benefits still outweigh the costs. It may even
be easier to learn how to program following Cake conventions and using
an MVC design pattern when you don't have years of bad programming
habits to unlearn. This is especially true if you're going the self-
taught route rather than taking formal classes. Of course it's always
better to have formal training, but learning Cake alongside PHP is
infinitely better than learning just PHP by copying-and-pasting random
scripts found on the web (you can still do that with Cake of course,
but there's much less of a need to).

On Jun 13, 5:56 pm, huoxito  wrote:
> I've been working with PHP for about 6 months and only recently
> started studying cakephp. It's been interesting but not even close to
> easy for me. Maybe because PHP is my first experience with programming
> languages and i had no experience with OOP before start taking
> cakephp.
>
> On 13 jun, 20:16, Tomasz Brymora  wrote:
>
> > If you plan on sticking with Cake (or any other framework for that
> > matter) you won't be able to help but pick up on php. You can pick up on
> > both at the same time and cake will make a lot more sense then as well.
> > It will make life a lot easier.
>
> > On 06/13/2010 05:46 PM, Chris Hanson wrote:
>
> > > ye i would probably learn the basics and do some playing around with
> > > PHP before jumping into a frameworkbut thats just my opinion. :D
> > > welcome to CakePHP :D
>
> > > On 13 June 2010 20:04, Jahongir Abdurahmonov  
> > > wrote:
>
> > >> I wonder if one should know PHP in order to learn and use CakePHP?
> > >> Should I first learn PHP and then CakePHP?
>
> > >> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > >> with their CakePHP related questions.
>
> > >> You received this message because you are subscribed to the Google 
> > >> Groups "CakePHP" group.
> > >> To post to this group, send email to cake-php@googlegroups.com
> > >> To unsubscribe from this group, send email to
> > >> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > >> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: find list, filtered

2010-06-14 Thread calvin
Ah, good call WebbedIT. I don't know how I missed that. Actually, I'm
pretty sure I've read that part of the Cookbook but just forgot about
it when I wrote that post. I've added 'joins' to the available find
parameters/keys list and added a link to the "Joining tables" section.

cricket:
Sorry, I haven't had time to actually try that query myself, but I'd
give Dr. Loboto's code a shot and see if using the 'conditions' param
rather than 'foreignKey' works. Let us know if that works for you.

On Jun 13, 11:25 pm, WebbedIT  wrote:
> > Unfortunately, the 'joins' parameter is not documented in the Cookbook
> > for find(). It's only mentioned in the subQuery example using
> > buildStatement(), but that's not necessary.
>
> Just for reference the join parameter is documented under Developing
> with CakePHP > Models > 
> Associationshttp://book.cakephp.org/view/872/Joining-tables
>
> I'm not sure when this was added as I certainly missed it for quite
> some time until I read an article a cpl of months back which mentioned
> using this mysterious new parameter, but when I looked lo and behold
> there it was.
>
> It could possibly do with a cross link from find() to I suppose.
>
> Paul

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

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


Re: Self Join table cakephp

2010-06-14 Thread calvin
What part didn't work? You have to be more specific or we can't help
you.

This is all you need to know to create a self-join table, just replace
"Post" with your model name in the last example:
http://book.cakephp.org/view/1046/Multiple-relations-to-the-same-model

And why not use a more intuitive/descriptive table name? Instead of a
table called "c_folders" and a model called "CFolder", just name the
table "client_folders" and call the model "ClientFolder". It'll make
your code more readable and be less confusing to other people who have
to look at your code or who may inherit the application from you.

On Jun 14, 5:56 am, Abhishek  wrote:
> Hi,
> I am in a situation where i need to self-join a table.
>
> This is the structure of the table ..
>
> CREATE TABLE IF NOT EXISTS `c_folders` (
>   `id` int(5) NOT NULL AUTO_INCREMENT,
>   `parent_id` int(5) NOT NULL,
>   `client_id` int(3) NOT NULL,
>   `name` varchar(100) NOT NULL,
>   PRIMARY KEY (`id`)
> ) ;
>
> The c_folders table needs to refer itself so that we can create a tree
> like structure. What should the model look like in this case.
>
> I referred to the article below .. but somehow it didnt seem to work
> for 
> me.http://bakery.cakephp.org/articles/view/coding-a-self-join-in-a-cake-...
>
> Regards
> Abhishek Jain

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

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


Re: How i can increase session time in cakephp,

2010-06-14 Thread calvin
If you set the timeout to 260, it's still going to time out after 4
minutes and 20 seconds of inactivity. If you want people to be able to
leave their desk and come back the next day and still have the session
active, you'll need to set it to something way higher (try 60*60*24).

Also, if you are deleting your cookies (a lot of anti-spyware programs
do this) or using a private browsing option in your browser, it's
going to destroy your session as well. There are also some plugins for
Firefox that let you monitor HTTP headers so that you can debug
potential issues with the session_id cookie.

On Jun 14, 4:50 am, arif hossen  wrote:
> Thank you Marcelo,
>  my session stay only  few second or few minutes no stable time. I have set
> session security level high and set 260, but session time out certainly . i
> don't know why occurs this .
>
> On Mon, Jun 14, 2010 at 6:22 PM, Marcelo F Andrade wrote:
>
>
>
> > On Mon, Jun 14, 2010 at 8:15 AM, arif hossen 
> > wrote:
> > > Dear Experts,
> > > How i can increase session time in cakephp,
>
> > You can change Security.level in app/config/core.php
> > and there is a Session.timeout entry too.
>
> > Atts.
>
> > --
> > MARCELO F ANDRADE
> > Belem, Amazonia, Brazil
>
> > "I took the red pill"
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> Regards,
> Mohammad Arif Hossen
> Software Enginner at
> Epsilon Consulting and Development 
> Services(ECDS)www.ecds-tech.comwww.arifhossen.wordpress.com
> +88 01714355911

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

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


Re: CakePHP, SSH PHP CLI not working on hostgator jailshell

2010-06-14 Thread calvin
Add the /cake/console directory to your PATH variable:
http://www.codecoffee.com/tipsforlinux/articles/11.html

On Jun 13, 9:48 pm, Adgower  wrote:
> I'm trying to setup CakePHP on my server and I have uploaded and
> configured it properly and its working fine, but I wanna bake via SSH
> into my server... I have made a .profile that points to my Mysql and
> PHP
>
> when I try to bake it says that cake command not found... any ideas?

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

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


Re: Problem with counting records

2010-06-14 Thread calvin
$locations = $this->Location->find('list');
$report = array();
foreach ($locations as $locationId => $locationName) {
  foreach ($statuses as $status) {
$report[$locationId][$status] = $this->Voter->find('count', array(
  'conditions' => array(
'Voter.location_id' => $locationId,
'Voter.status' => $status
  )
));
  }
}
$this->set(compact('locations', 'report'));

I'd recommend reading the Cookbook and doing the blog example if
you're still unsure as to how to send data from a controller to the
view.

On Jun 14, 5:04 am, Kiza  wrote:
> Hello,
>
> I'm currently working on app for Voters registering and it's pretty
> much completed.
>
> I have 5 tables in database: voters, locations, categories, users,
> statuses.
>
> Table voter is in "belongs to" relationship with other tables and
> tables have following structure:
>
> voters
>
> id int(11) NOT NULL auto_increment,
>
> firstName varchar(50) NOT NULL,
>
> lastName varchar(50) NOT NULL,
>
> phone varchar(50) NOT NULL,
>
> status_id int(11) NOT NULL,
>
> user_id int(11) NOT NULL,
>
> location_id int(11) NOT NULL,
>
> category_id int(11) NOT NULL,
>
> locations
>
> id int(11) NOT NULL auto_increment,
>
> name varchar(50) NOT NULL,
>
> statuses
>
> firstName0 int(11) NOT NULL auto_increment,
>
> firstName1 varchar(50) NOT NULL,
>
> categories
>
> firstName2 int(11) NOT NULL auto_increment,
>
> firstName3 varchar(50) NOT NULL,
>
> What I would like to do is display all locations names, each followed
> with a count of the number of voters from that locations for status 1,
> status 2 and so on
>
> .
>
> Basically I must generate report witch has following structure:
>
> Location name| Number of voter in status 1 | Number of voters in
> status 2 | etc.
>
> Location 1
>
> Location 2
>
> Location 3
>
> etc
>
> I guessing that I should use find('count') or counterCache but I just
> don't know how to write that query or how to send result to view. This
> is really major problem for me so if anyone have some suggestion it
> will be appreciated.
>
> If you need some additional information I will be happy to provide it
> in order to solve this problem.

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

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


Re: XML Helper

2010-06-14 Thread calvin
I don't think I've ever used the XML helper, but this seems like a
pretty simple array manipulation problem:

foreach ($data['news']['news_images'] as $newsImage) {
   $data['news'][] = $newsImage;
}
unset($data['news']['news_images']);

On Jun 14, 3:57 am, Jankeesvw  wrote:
> Hi fellow Cake bakers!
>
> I have a question about the XML helper I have a model which has a
> hasMany relationship. (News hasMany NewsImages). But when I use the
> serialize function to render the data to XML I get a result I don't
> really like. I would like cake to wrap a xml-node around the child
> nodes of the images. Is this something that's possible? I really hope
> so.
>
> I created a pastie with how the current XML looks and how I would like
> it to look:http://www.pastie.org/1003646
>
> Thanks a lot!
> Jankees

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

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


Re: Cake 2.0 Roadmap - must it be all at once?

2010-06-13 Thread calvin
Which roadmap are you referring to? The one I'm looking at (http://
cakephp.lighthouseapp.com/projects/42648/2-0-development-roadmap)
doesn't mention anything about PHP5 hacks, only removing PHP4 hacks,
which is pretty reasonable since people have had nearly 6 years to
upgrade to PHP5, and the PHP Group itself has long since stopped
supporting PHP4.

Also, incremental upgrades defeats the purpose of a major version
number change. If they were going to continue with incremental
upgrades to 1.x, then it wouldn't make sense to call it CakePHP 2.x.
There are also some thing which can't be changed/added with
incremental upgrades. And if the framework is going to be majorly
reworked, it's best to do it in one release than to make users
repeatedly upgrade and rewrite their application(s).

Users are already able to download 2.0 and will continue to have
access to the latest builds so that they can try the latest features
(on a development/test server of course) and give feedback to the
developers. That's one of the benefits of open source and using a
public repository.

For major framework changes, the migration guide will assist users in
migrating their code over to 2.0. For instance, the current migration
guide explains that if you don't want to use PHPUnit, you can continue
to use SimpleTest by replacing related files. And part of announcing
the development roadmap early on is to allow users and the developers
to plan ahead and prepare for the upcoming framework changes. Features
that are being removed or replaced can be marked as deprecated in
upcoming  1.x releases to give developers time to change their code.
So if you're using 1.3 right now and are removing the use of
deprecated methods from your application, you'll be prepared for the
2.0 migration. And for those that still don't want to go through the
hassle of rewriting their live applications, they can simply go on
using 1.x, which will still be supported concurrently with 2.0.

On Jun 13, 3:02 am, keymaster  wrote:
> Please don't throw eggs, but..
>
> ...after looking over the 2.0 roadmap, I am wondering about the
> relative benefit of major "shock and awe" releases vs. the
> continuation of the successful 1.x pattern of smaller, but still
> significant, incremental releases (where applicable).
>
> I am a tad concerned the 2.0 roadmap might be taking on too much for
> one release.
>
> In particular, I am wondering if there is any remote possibility for
> the development team to consider the division of 2.0 into a series of
> smaller releases, rather than a whopping "grand 2.0" one shot
> delivery?
>
> For example (just an example), might it be feasable to release a 2.0
> with the only new PHPUnit testing framework, on a php5-only base?
>
> People can use it to start writing their new tests, migrating their
> old ones, in parallel with  2.1 development.
>
> Over the next few releases, there can be a phase in of the rest of
> lazy loading, removal of PHP5 hacks, E_STRICT compliance, interfaces/
> abstract classes/exceptions , etc.
>
> This will enable quicker deployment of new features to the community,
> and as a result engender quicker feedback to the developers through
> more parallel usage of the releases. It somewhat derisks things, and
> keeps the ball moving.
>
> Comments?

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

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


Re: Pagination: Sort by count of related model (e.g. User -> Posts)

2010-06-13 Thread calvin
Ideally, you should be able to create post_count as a virtualField and
then sort by that, by as the cookbook states, the paginator can't
order by virtualFields of associated models, so you wouldn't be able
to sort by it. But there are two simple workarounds for this:
http://book.cakephp.org/view/1608/Virtual-fields

On Jun 13, 4:11 am, DigitalDude  wrote:
> Hey,
>
> I have a problem here and need to fix it. It's about the following
> situation:
>
> I have a model "User" that has a relation to some entrie, let's say
> "Posts". I want to paginate the User-Model and add a counting of the
> user's posts to my index of Users. So I will have the following table-
> structure in my view:
>
> Id Name Posts Actions
> 2  Ben      5       view/edit/delete
> 5  Mary    8       view/edit/delete
>
> The first two columns are easy to sort, but HOW can I sort my
> paginated user-array by the count of the related Post-entries?
>
> I would really appreciate some help here, because I just cannot find a
> way to do this... :(
>
> Regards,
>
> DD

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

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


Re: CakePHP Helper

2010-06-12 Thread calvin
In case you don't get a response here, you might try the CakePHP IRC
channel (I think it's on Freenode). Someone there will likely be able
to help you.

On Jun 12, 10:35 am, Marc  wrote:
> Hi There,
>
> This is Marc Fernandez, I've been programming with CakePHP a couple
> years ago and recently I needed to do a Google Map with the last V3
> Google Map API, and because there is no any helper in the Bakery I
> decided to create one and publish it.
>
> The thing is that I've posted the helper like a month ago but it says
> that is still "unpublished" I was wondering why? Do you guys know what
> to do to post the helper in the Bakery???
>
> Thanks

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

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


Re: find list, filtered

2010-06-12 Thread calvin
Ah, I misunderstood you. I think you should be able to just use the
'join' and 'group' keys, e.g.:

$countries = $this->Country->find('list', array(
  'joins' => array(
array(
  'table' => 'cake_members',
  'alias' => 'Member',
  'type' => 'inner',
  'foreignKey' => 'Member.country_id'
)
  ),
  'group' => array('Country.id')
));

I think that should work. Or you may need to use the 'conditions'
parameter in the 'joins' array instead of the 'foreignKey' parameter.

Unfortunately, the 'joins' parameter is not documented in the Cookbook
for find(). It's only mentioned in the subQuery example using
buildStatement(), but that's not necessary.

On Jun 12, 2:07 pm, cricket  wrote:
> On Jun 11, 12:39 pm, calvin  wrote:
>
> > Wouldn't a simple GROUP BY work?:
>
> > SELECT Country.* FROM cake_countries AS Country JOIN cake_members AS
> > Member ON Country.id=Member.country_id GROUP BY Country.id
> > or
> > SELECT Country.* FROM cake_members AS Member JOIN cake_countries AS
> > Country on Country.id=Member.country_id GROUP BY country_id HAVING
> > COUNT(country_id)>1
>
> This is pretty much what I'm doing now (should have been more clear).
> But the data then needs to be massaged with Set to get in the correct
> format (like find('list')). I was hoping there was some options I
> could pass to find('list') but I'm having a lot of trouble figuring
> what they all are and how to use them. I've been looking at the
> "Complex Find Conditions" section of the manual but aren't getting
> very far.

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

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


Re: Modification of a helper method?

2010-06-12 Thread calvin
Well, you could create a helper that doesn't modify the helper method,
but simply uses it.

E.g. in your views:
echo $myHelper->link('delete', $id); // generate a delete link for $id
for the active controller
echo $myHelper->link('edit', $id); // generate an edit link for $id
for the active controller
echo $myHelper->link('delete', $id, 'posts'); // generate a delete
link to another controller

Then in your helper, you just need to check the value of a view
variable and either generate the link or not generate it based on
that:
function link($action, $id = null, $controller = null) {
  ... // set default $id and $controller
  $link = '';
  $view =& ClassRegistry::getObject('view');
  if ($view->viewVars['hasPrivilege']) { // check the controller-set
variable
$link = ... // generate the link
  }
  return $link;
}

Then in your controller you just need to set $hasPrivilege in the
view.

On Jun 12, 4:26 pm, cricket  wrote:
> On Jun 12, 6:14 pm, saidbakr  wrote:
>
> > In other word,
>
> > In the controller action some logic will be done and it will return
> > either true or false. If it true, I need something to call the html
> > helper in the view and then changing all links with title contains the
> > text "Edit" or "Delete" to return null or empty string instead of html
> > link.
>
> That's not a good way to handle it. Pass your flag (true|false) to the
> view:
>
> $this->set( 'flag', $this->myLogic() );
>
> ... and then:
>
> if ( !$flag )
> {
>     $html->link(...)
>
> }
>
> Or:
>
> if ( ( $foo['Edit'] || $foo['Delete'] ) && !$flag )
> {
>     $html->link(...)
>
> }

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

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


Re: controller and view extention problem.

2010-06-12 Thread calvin
Yes, there is an HTTP status code specifically for that:

Status: 301 Moved Permanently
Location: http://yoursite.com/new/page/location

http://www.somacon.com/p145.php

On Jun 12, 2:30 am, Sam Sherlock  wrote:
> seo redirect old url to new one.
>
> new one being cake address
> - S
>
> On 12 June 2010 10:07, fadhli -  wrote:
>
> > I have to usewww.example.com/home/index.phpaddress because it was used
> > in the website address rating.
>
> > On Thu, Jun 10, 2010 at 12:12 AM, cricket  wrote:
>
> >> On Jun 8, 11:44 pm, fadhli -  wrote:
> >> > hi everyone.
>
> >> > i'm new in cakephp and i want to know how to makehttp://
> >>www.example.com/home/index.phpincakePHP.
> >> > controller without 's' (home not homes)
>
> >> In routes.php:
>
> >> Router::connect(
> >>  '/home',
> >>  array('controller' => 'homes', 'action' => 'index')
> >> );
>
> >> > and to view page i must use php
> >> > (index.php not index.ctp) extextion.
>
> >> There's no need to have index.php in the URL. And your URLs should not
> >> ever have "something.ctp" in them. The .ctp files are templates;
> >> they're not supposed to be accessed directly through a URL.
>
> >> Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> >> others with their CakePHP related questions.
>
> >> You received this message because you are subscribed to the Google Groups
> >> "CakePHP" group.
> >> To post to this group, send email to cake-php@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> cake-php+unsubscr...@googlegroups.comFor
> >>  more options, visit this group at
> >>http://groups.google.com/group/cake-php?hl=en
>
> >  Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> > others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

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

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


Re: Get rid of render time in ajax response

2010-06-11 Thread calvin
That would remove the render time from all pages, not just AJAX calls.
Either do what nurvzy suggests or check for AJAX calls in
beforeFilter() and change the debug value there; that's what I usually
do, but nurvzy's method seems better.

On Jun 11, 10:17 am, majna  wrote:
> Just edit webroot/index.php, and remove line with render time.
>
> On 11 lip, 07:22, nurvzy  wrote:
>
> > Set Configure::write('debug', 0); in layouts/ajax.ctp before
> > content_for_layout.
>
> > That way all ajax calls are rendered with debug 0 regardless of the
> > actual app debug.
>
> > HTH,
> > Nick
>
> > On Jun 10, 9:37 pm, Roland Pish  wrote:
>
> > > Hi!
>
> > > I'm doing some ajax calls and I realized that cakephp is appending the
> > > render time to the ajax response; something like: 
> > > I set debug to 2 because I'm in the development phase. I assume that
> > > setting debug to 0 gets rid of the render time, but, keeping the debug
> > > set to 2 is there some way to get rid of this render time?
>
> > > Thanks in advance

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

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


Re: General development with MVC and Cake in particular

2010-06-11 Thread calvin
Yes, I was clearly being a dick by answering your question and trying
to point you in the right direction.

Perhaps next time you'll find the patience to actually read the doc
before you dismiss it as "crap." If you did that, you'd realize that
in Cake, URLs can often be passed as a string or in array format (as
explained in the blog example).

BTW, the Cookbook is user-contributed. So if you think you can come up
with a more logical/useful organization for the info, then, by all
means, make the appropriate changes. But putting redirect() in the
"Developing with CakePHP" section under "Controller Methods" is hardly
"buried." And if you think a simple redirect method needs more than 6
examples, then you're likely just complaining to complain.

On Jun 11, 2:11 pm, Mike Alberghini  wrote:
> Wow.  Are you trying to corner the market on snarky replies in this group?
>
> Yes, the cookbook does detail the redirect method.  It buries it five
> levels deep.  It even says it is " The flow control method you'll use
> most often."  How much documentation does the Cookbook give to this, the
> most used method?  One page.  Twelve whole lines of code, comments
> included.  One browser page.  That page even makes things WORSE, by
> having conflicting info.  The syntax example at the top says the first
> parameter should be a url string.  The first code example conflicts this
> by making the first parameter an array.
>
> So despite your best efforts to be a dick and waste peoples time, you
> managed to answer my question.  Thanks.
>
> Mike
>
> On 6/11/10 1:02 PM, calvin wrote:
>
>
>
> > I'll give you the benefit of the doubt that you're not just an obvious
> > troll. So please enlighten us on the cake-specific way to create a
> > multi-step action.
>
> > And the cookbook _does_ tell you how to redirect and how to create
> > links or buttons.
>
> > You may as well start complaining that the Cookbook doesn't have an
> > example forum/online store/CRM app/search engine/webmail app and a
> > million other applications.
>
> > The Cookbook already explains the syntax for the redirect() method. It
> > also gives numerous examples. If you want the Cookbook to include a
> > list of all the scenarios where an HTTP redirect should be used, which
> > has nothing to do with Cake, then you are confusing the Cookbook with
> > a general web development guide.
>
> > On Jun 10, 8:25 am, Windex  wrote:
>
> >>> And creating a multi-step action in Cake is no different from
> >>> creating one in a non-Cake app.
>
> >> Except for all the cake specific ways to accomplish those tasks.
>
> >>> What's wrong with just redirecting the user to the next action/form
> >>> instead of index at the end of each action? If you need to add a back
> >>> button, then just add a link in the view as shown in the cookbook
> >>> section on the Html Helper.
>
> >> These kind of examples are what the OP i think was referring to.
> >> Theres the standard no framework way of redirecting, theres the ugly
> >> hacks using cake specific functions, then there is the correct cake
> >> method.
>
> >>> If you need to store persistent data, then
> >>> just use session variables like you would in any other application.
> >>> There's nothing here that a little common sense and basic web
> >>> development knowledge can't solve. I don't think it's reasonable to
> >>> expect the Cookbook to hold your hand and walk you through every
> >>> possible programming scenario that you might encounter in your web
> >>> development.
>
> >> No but expanding on all those methods specific to cake used to
> >> accomplish such tasks isn't asking to much
>
> >>> If you want web development tutorials on how to solve real-world
> >>> programming problems, then try devshed.com. It has a lot of general
> >>> PHP (and other languages) development tutorials on all kinds of real-
> >>> world web development problems, like implementing different types of
> >>> session management systems, how to implement a search engine, etc.
>
> >> I think its clear from this post you have missed the point and you
> >> should have just said something like 'lrn2webdesign' it would have
> >> provided just as much information and saved you some time.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this mess

Re: Path of Slugs in URL (separated with Slashes)

2010-06-11 Thread calvin
You can still create a virtual full_slug field, just use concat() to
concatenate the parent slug, a slash, and the slug.

Or, since all of your data should already be set in the view anyway,
just create a helper that accepts Item data in the form of:
array(
  'Item' => array(
'field1' => 'val1',
'field2' => 'val2',
...
'slug' => 'slug value'
  ),
  'ParentItem' => array(
...
'slug' => 'parent slug value'
  )
)

and outputs a correctly formatted link.

On Jun 10, 4:31 pm, RobertMeisner  wrote:
> Hello fellow cakers.
>
> How can I solve the following problem.
>
> Let's say you have a model called "Item".
> Item has a parent Item and a slug.
> I use a slug to Identify Item.
> URLs have the formhttp://domain/items/view/slug
>
> What I want to achieve is: URLs containing parents' slugs .
>
> ie:http://domain/items/view/parentparentslug/parentslug/slug
>
> I would preffer some Automagic solution, where i can use
> $html-> link ('controller' => 'item', 'action' => 'view', 'slug' =>
> 'my-item-slug'); //without parrents
>
> I thought about overriding AppHelper:: url ();  and calling some
> getParentSlugs() function on Item model but as far as i know cake's
> Good Practices i shoudnt use Model calls in helpers.
>
> Another idea was to calculate some virtual full_slug field in
> afterFind() but i want path-of-slugs to be separated by slashes.
>
> What should be my approach on this one?

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

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


Re: General development with MVC and Cake in particular

2010-06-11 Thread calvin
I'll give you the benefit of the doubt that you're not just an obvious
troll. So please enlighten us on the cake-specific way to create a
multi-step action.

And the cookbook _does_ tell you how to redirect and how to create
links or buttons.

You may as well start complaining that the Cookbook doesn't have an
example forum/online store/CRM app/search engine/webmail app and a
million other applications.

The Cookbook already explains the syntax for the redirect() method. It
also gives numerous examples. If you want the Cookbook to include a
list of all the scenarios where an HTTP redirect should be used, which
has nothing to do with Cake, then you are confusing the Cookbook with
a general web development guide.

On Jun 10, 8:25 am, Windex  wrote:
> > And creating a multi-step action in Cake is no different from
> > creating one in a non-Cake app.
>
> Except for all the cake specific ways to accomplish those tasks.
>
>
>
> > What's wrong with just redirecting the user to the next action/form
> > instead of index at the end of each action? If you need to add a back
> > button, then just add a link in the view as shown in the cookbook
> > section on the Html Helper.
>
> These kind of examples are what the OP i think was referring to.
> Theres the standard no framework way of redirecting, theres the ugly
> hacks using cake specific functions, then there is the correct cake
> method.
>
> > If you need to store persistent data, then
> > just use session variables like you would in any other application.
> > There's nothing here that a little common sense and basic web
> > development knowledge can't solve. I don't think it's reasonable to
> > expect the Cookbook to hold your hand and walk you through every
> > possible programming scenario that you might encounter in your web
> > development.
>
> No but expanding on all those methods specific to cake used to
> accomplish such tasks isn't asking to much
>
> > If you want web development tutorials on how to solve real-world
> > programming problems, then try devshed.com. It has a lot of general
> > PHP (and other languages) development tutorials on all kinds of real-
> > world web development problems, like implementing different types of
> > session management systems, how to implement a search engine, etc.
>
> I think its clear from this post you have missed the point and you
> should have just said something like 'lrn2webdesign' it would have
> provided just as much information and saved you some time.

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

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


Re: Set format for DATETIME in model

2010-06-11 Thread calvin
You're going to have to use the virtualFields model property.
Otherwise, it will always place it under a 0 index (even if you
specify the virtual field in the find as 'Model.field'). Otherwise,
just use a helper or the PHP date() function.

On Jun 11, 7:29 am, John Andersen  wrote:
> As far as I understand from the manual, then CONVERT means that you
> cast the date into another type, not converting the date into another
> format.
>
> Use DATE_FORMAT(date, format) instead!
> Enjoy,
>    John
>
> On Jun 11, 4:26 pm, Jonas  wrote:
>
> > What is the correct way of setting how I want the date returned from a
> > database Model->find ?
>
> > Without anything set it returns [createdate] => Jun 11 2010
> > 03:08:12:283PM which is not the format I'd like.
>
> > If I modify the column name to i.e. convert(varchar(26), createdate,
> > 126) as createdate I get the correct format but the result is returned
> > as:
>
> > [id] => 1,
> > [text] => 'Hello',
> > [0] => Array(
> >    [createdate] => '2010...'
> > )
>
> > which is not what I'd like either.
>
> > Thanks!
>
> > /Jonas

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

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


Re: find list, filtered

2010-06-11 Thread calvin
Wouldn't a simple GROUP BY work?:

SELECT Country.* FROM cake_countries AS Country JOIN cake_members AS
Member ON Country.id=Member.country_id GROUP BY Country.id
or
SELECT Country.* FROM cake_members AS Member JOIN cake_countries AS
Country on Country.id=Member.country_id GROUP BY country_id HAVING
COUNT(country_id)>1

The first query should only list countries with more than 1 member,
whereas the second query allows you to specify an arbitrary number of
members you want filter by (e.g. countries with more than 5 members).
You can probably also achieve the same thing with subqueries, but I
haven't figured it out.

On Jun 11, 6:41 am, cricket  wrote:
> Using Cake 1.2.x
>
> Member belongsTo Country
>
> I want to create a select list of countries but only include those
> countries that have at least one Member. The only thing I can think of
> doing is to first select DISTINCT Member.country_id, then do a
> find('list') and pass the first result as a condition. Does anyone
> know of a better method?

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

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


Re: URL is showing wrong

2010-06-11 Thread calvin
I don't think you need the final slash at the end. I usually just put /
path/to/dir/* in my Apache directory directives.

On Jun 10, 9:53 pm, Jeremy Burns | Class Outfit
 wrote:
> I just had some problems getting Cake to run on a new MacBook Pro I bought 
> this week . I didn't want to install MAMP; I enabled PHP 
> and installed MySQL. I went through all the published steps to get Apache to 
> play nice, but I was not getting any CSS or images.
>
> I stumbled across this article which contained something that I hadn't 
> thought of before, and it suddenly burst into life. It *could* help you?
>
> In my httpd.conf file I had this section:
>
> 
>     Options Indexes MultiViews FollowSymLinks
>     AllowOverride All
>     Order allow,deny
>     Allow from all
> 
>
> ...which I thought was enough. Following advice in that article I changed the 
> first line to:
>
> 
>
> ...and it all sprang into life (note the */ at the end).
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 11 Jun 2010, at 01:45, Davor Ilic wrote:
>
> > sry for my bad english. i hope you did understand me... also it is hard to 
> > understand you what you meen somtimes but google translate helps a little 
> > bit.
>
> > i´ve try to change now something and it didn´t work...  i realy don´t know 
> > what i have done to get this issue. but i know that i only create 
> > controllers, views and models nothing else... and also chane the route to 
> > my path i´d liketo have
>
> > 2010/6/10 Davor Ilic 
> > I didn´t turn it off i´ve only changed in the core the Salt security values 
> > for sha1 and numbvalues nothing else.
>
> > I´ve tested it. if i use the url like 
> > this:http://my.site/clients/add_clientit also work. Hm the html->link is 
> > only showing like this but htaccess is working well if i try the link it 
> > can be that i´ve only have this issue.
>
> > lg,
>
> > Davor
>
> > 2010/6/9 Dr. Loboto 
>
> > Did you study cakebook link? You need:
>
> > 1) mod_rewrite installed and enabled;
> > 2) AllowOverride set to All for your site dir;
> > 3) .htaccess files must exist, be valid (unchanged rewrite section
> > actually), and be accessible by webserver (on *nix wrong rights
> > prevent it).
>
> > Also there can be problem with alias if you use it. And finally you
> > can try to point DocumentRoot to app/webroot instead of root folder.
>
> > But I still think that or you have mod_rewrite not working for your
> > site OR you turned off pretty URLs in core.php
>
> > On Jun 9, 5:16 pm, Davor Ilic  wrote:
> > > it is enabled i also worked with it and cake wouldn´t show me a correct 
> > > page
> > > with this
>
> > > url:http://my.site/*app/webroot/index.php/*clients/add_client
>
> > > it have to be anything else. perhaps it have something to do with the
> > > route.php or the .htaccess isn´t done well
>
> > > 2010/6/9 Dr. Loboto 
>
> > > > You need mod_rewrite enabled.
>
> > > >http://book.cakephp.org/view/37/Apache-and-mod_rewrite-and-htaccess
>
> > > > On Jun 7, 12:40 am, Davor Ilic  wrote:
> > > > > Hi,
>
> > > > > my url is 
> > > > > this:http://my.site/*app/webroot/index.php/*clients/add_client
>
> > > > > why is it like this it change after time but can´t say i´ve changed
> > > > > something.
>
> > > > > i wont to show the link like this with "$html->link()" :
> > > >http://my.site/clients/add_client
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>For more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

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

You received this message because you a

Re: can i use html5 in cakephp?

2010-06-11 Thread calvin
Andy, 2012 is the _Candidate_ Recommendation stage (the third
milestone in the timeline you linked to). So after CR there's still
the Proposed Recommendation milestone before HTML5 will actually reach
the status of a W3C Recommendation. According to WHATWG's sources, the
expected W3C Recommendation stage is still 2022.

TBH, when I read the 2022 date, I was pretty shocked and disappointed.
But if that's when the browser developers expect the standard to
become a full W3C recommendation, then that's what I have to go on.
That said, as the WHATWG FAQ explains, you'll be able to use _parts_
of the HTML5 standard long before then. But at this point, only WebKit
even has 50% of the standard implemented. It doesn't help that each
rendering engine is implementing different parts of the HTML5
specification, so even if every browser had 50% implemented, what
you'll realistically be able to use (without using JavaScript to
emulate functionality) is going to be far less than that. It would
probably speed things up if, throughout the development of a new
standard, the W3C lists which parts of the specification are pretty
much fixed and should be implemented by browser developers first. That
would cut down the time between when browser developers decide to
implement a feature and when web developers can actually use it.

On Jun 10, 6:55 pm, Andy Dirnberger  wrote:
> I realize that they've fallen behind, but you originally said 2022,
> which is a bit further away than 2012.
>
> On Jun 10, 4:40 pm, calvin  wrote:
>
> > As much as I am grateful for the W3C and believe that an organization
> > like theirs is vital to the continued growth of the web, the W3C has
> > not had a great track record in keeping to their projected timeline
> > for HTML5. And the W3C has long since fallen behind the provisional
> > timeline you linked to. For instance, by March 2010, the HTML work
> > group still hadn't reached "Last Call", when they were already
> > supposed to have reached the Candidate Recommendation 
> > stage:http://dev.w3.org/html5/status/2010-03.html
>
> > I have more faith in the WHATWG projections for HTML5's completion
> > since they're the ones who have to implement it. At this point, the
> > Candidate Recommendation stage isn't expected to be reached until
> > 2012:http://wiki.whatwg.org/wiki/FAQ#When_will_HTML5_be_finished.3F
>
> > On Jun 9, 10:04 pm, Andy Dirnberger  wrote:
>
> > > According to the W3C, they expect to reach the recommendation
> > > milestone for HTML5 in Q3 
> > > 2010.http://www.w3.org/2007/03/HTML-WG-charter.html#deliverables
>
> > > On Jun 9, 11:11 pm, calvin  wrote:
>
> > > > You can "use" whatever you want, but HTML5 is nowhere near completion.
> > > > It's not even expected to become a W3C recommendation until 2022, and
> > > > few browsers besides Chrome and Safari even support half of the
> > > > specification.
>
> > > > On Jun 9, 6:40 am, ytbryan  wrote:
>
> > > > > how do I render html element in cakephp?
>
> > > > > Thanks!
>
> > > > > /Bryan

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

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


Re: can i use html5 in cakephp?

2010-06-10 Thread calvin
As much as I am grateful for the W3C and believe that an organization
like theirs is vital to the continued growth of the web, the W3C has
not had a great track record in keeping to their projected timeline
for HTML5. And the W3C has long since fallen behind the provisional
timeline you linked to. For instance, by March 2010, the HTML work
group still hadn't reached "Last Call", when they were already
supposed to have reached the Candidate Recommendation stage:
http://dev.w3.org/html5/status/2010-03.html

I have more faith in the WHATWG projections for HTML5's completion
since they're the ones who have to implement it. At this point, the
Candidate Recommendation stage isn't expected to be reached until
2012:
http://wiki.whatwg.org/wiki/FAQ#When_will_HTML5_be_finished.3F

On Jun 9, 10:04 pm, Andy Dirnberger  wrote:
> According to the W3C, they expect to reach the recommendation
> milestone for HTML5 in Q3 
> 2010.http://www.w3.org/2007/03/HTML-WG-charter.html#deliverables
>
> On Jun 9, 11:11 pm, calvin  wrote:
>
> > You can "use" whatever you want, but HTML5 is nowhere near completion.
> > It's not even expected to become a W3C recommendation until 2022, and
> > few browsers besides Chrome and Safari even support half of the
> > specification.
>
> > On Jun 9, 6:40 am, ytbryan  wrote:
>
> > > how do I render html element in cakephp?
>
> > > Thanks!
>
> > > /Bryan

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

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


Re: can i use html5 in cakephp?

2010-06-09 Thread calvin
You can "use" whatever you want, but HTML5 is nowhere near completion.
It's not even expected to become a W3C recommendation until 2022, and
few browsers besides Chrome and Safari even support half of the
specification.

On Jun 9, 6:40 am, ytbryan  wrote:
> how do I render html element in cakephp?
>
> Thanks!
>
> /Bryan

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

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


Re: General development with MVC and Cake in particular

2010-06-09 Thread calvin
Can you elaborate on what you mean by "multi step logic"? If you're
talking about something like a user registration process with multiple
steps/screens, then just link multiple "single-interaction actions"
together. That isn't something that needs to be covered in the
documentation because the cookbook isn't a general PHP web development
guide. And creating a multi-step action in Cake is no different from
creating one in a non-Cake app. The Cookbook also doesn't show you how
to implement a meta-moderation system, a tag cloud, or RESTful web
services. That's because these topics aren't Cake-specific or require
Cake-specific knowledge to build.

What's wrong with just redirecting the user to the next action/form
instead of index at the end of each action? If you need to add a back
button, then just add a link in the view as shown in the cookbook
section on the Html Helper. If you need to store persistent data, then
just use session variables like you would in any other application.
There's nothing here that a little common sense and basic web
development knowledge can't solve. I don't think it's reasonable to
expect the Cookbook to hold your hand and walk you through every
possible programming scenario that you might encounter in your web
development.

If you want web development tutorials on how to solve real-world
programming problems, then try devshed.com. It has a lot of general
PHP (and other languages) development tutorials on all kinds of real-
world web development problems, like implementing different types of
session management systems, how to implement a search engine, etc.

On Jun 9, 6:28 am, Mike Alberghini  wrote:
> I've built the blog, the ACL controlled version and a few other apps in
> Cake already.  The book and API docs are helpful to a point.  The point
> when they stop being helpful is when you try to figure out how to build
> multi step logic into an app.  Which is where I am.
>
> I've already tried the documentation and found it lacking.  It's great
> at demoing some of the fundamentals, but crap at showing how to take
> Cake beyond simple single-interaction actions into useful real world
> applications.  For example, this page of the Book:
>
> http://book.cakephp.org/view/898/A-Typical-CakePHP-Request
>
> Manages to tell me how the logic flow of a Cake Request goes, without
> giving me any useful direction to go in.
>
> Mike
>
> On 6/9/2010 12:11 AM, Ed Propsner wrote:
>
> > It doesn't seem like the "blog" tutorial is really your thing but have
> > you tried it? All the fundamentals are there including functions and
> > how they relate to views, as well as passing data back and forth
> > between MVC. It really is the best place to start and any additional
> > info can be found in the book or the API.
>
> >http://book.cakephp.org/view/1528/Blog
> >http://book.cakephp.org/view/875/x1-3-Collection
> >http://api13.cakephp.org/
>
> > Once you get the basics down most people on this list are really great
> > about getting you pointed in the right direction once you start making
> > a mess of things 8-)
>
> > - Ed
>
> > On Tue, Jun 8, 2010 at 5:53 PM, Mike A  > > wrote:
>
> > I'm new to Cake and the MVC style of programming.  I've had no luck
> > finding a guide to best practices for programming this way, or even
> > guides to building anything much more complicated than a blog.  I've
> > been tasked with rebuilding an ancient intranet app, and I'm trying to
> > use Cake to do it.  I could use a bit of advice on the best way to go
> > about this.
>
> > Our current app is written in Fusebox 3.  It's designed to track our
> > staff vacation and sick days works as follows:
>
> > 1.  user selects the employee who is taking time off
> > 2.  script pulls that employees data from database A
> > 3.  user is given a web form with the employees data filled in
> > 4.  user selects the dates of leave and if it is charged to vacation
> > and sick time, then submits the form
> > 5.  script records info to database B
> > 6.  web page displays the employees updated sick and vacation totals
>
> > In the existing Fusebox app, I can chain a series of php pages
> > together (actions, views and queries) to do all the work.  Data is
> > passed from page to page via POST variables.
>
> > Can someone give me advice on how to do all this in Cake?  I'm trying
> > to figure out the best way.  Should I create a function in the
> > controller for each step?  How can I pass that data back and forth?
>
> > Thanks in advance for any advice you can give.
>
> > Mike
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd
> > help others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google
> > Groups "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > 

Re: Query question(s)

2010-06-09 Thread calvin
Manipulating bit fields can be confusing at times (e.g. on Monday it
took me a while to realize the query in my original post didn't do
what I thought it would), and there's usually more than one way to do
it. But, basically, the way I approached it was to group all of the OR
conditions together and treat them collectively as another AND
condition (so the search has to match all of the ANDs, and at least
one of the ORs). That may not be what you want for your search, but it
demonstrates how you'd evaluate  AND & OR conditions.

So taking your example of a record that has the bitfield value of 3,
if you want to do a purely OR search for Videos(1) or Photos(4) or
Text(8), you'd only use the first half the query I wrote:

Model.type & $orOptions > 0

So the database engine would evaluate:

3 & 13 > 0

The bit fields in big-endian notation would be:
0011 (3)
1101 (13)

So the result is 0001 because both the search params and the record
field have the bit for "Video" set. And since 1 > 0, that record would
be returned as a match.

To perform the same search using AND, you'd simply check to see if 3 &
13 = 13, which it obviously does not. But a record that has a value of
13 for the type field would evaluate to:

1101 & 1101 = 1101

So such a record would be return as a result.

On Jun 8, 10:36 am, Ed Propsner  wrote:
> @Calvin:
>
> I do like the idea of using array_sum() and storing the options as an INT,
> I've taken this approach in the past with a different app (once) and it
> worked out just fine. In this case let's say you have a value of 3 stored in
> the db representing 2 options ... '1' => 'video, '2' => 'audio. A search on
> that column would only hit on an exact match, no? I only need the stored
> value and the search criteria to have one of their values in common, not
> all. In this case if a user searched just '1' => 'video' it should return
> the column containing the value of 3 because both the search and the stored
> data have '1' => 'video' in common.
>
> I won't stress the checkbox search too much at this time. I did get it
> working without writing any kind of custom query. The query itself is to the
> point but checking the values of the array and setting up the $orOptions to
> account for each possibility was a tad lengthy. About the checkboxes ...
> well ... I was submitting them as separate input fields instead of one
> 'multiple' ... don't ask! 8-).
>
> The query giving me problems at this time is the advanced search. It's not
> much a problem more than I'm unsure of how to approach it. I want to toy
> around with it for a bit then I'll let know what issues I'm having.
>
> @John:
>
> [quote]
>
> When the user submits the search, the first thing I do, is to save the
> search parameters in the database (Enquiry model), so as to get an ID..
>
> [/quote]
>
> Errr ... Something came up and I have to leave the house but I have a few
> questions for ya' ... I'll get back you when I get back in.
>
> On Tue, Jun 8, 2010 at 3:38 AM, John Andersen wrote:
>
> > This may not be relevant to your issue, but maybe to your solution. I
> > will try to explain how I did my search functionality.
>
> > In my application, the user will search for a specific object
> > (Article, Author, Blog, etc.), not a combination of these.
>
> > The search form provides the following entries:
> > Words [text] - one or more words
>
> > Word criteria [radiogroup] - :
> > 1) must contain all words.
> > 2) must contain at least one word.
> > 3) must contain exact phrase.
>
> > Search criteria [checkbox] - :
> > 1) In title (default).
> > 2) In summary.
> > 3) In body.
>
> > Category(ies) [checkbox] - all categories.
>
> > When the user submits the search, the first thing I do, is to save the
> > search parameters in the database (Enquiry model), so as to get an ID.
>
> > The search parameters are then passed on to the responsible model
> > (Article, Author, Blog, etc), which then performs the actual search.
> > The resulting rows (ids) are passed back to the Enquiry model, which
> > saves the result (creates relationships between Enquiry model and
> > responsible model).
>
> > I then uses the ID to paginate the result, when presenting it to the
> > user.
>
> > Building the search query:
> > 1) I split into single words from the Words entry.
> > 2) Based on the Word criteria, I prepare the respective AND, OR, or
> > phrase condition(s) for all possible Search criteria. That is one for
>

Re: How php form availabilities do you know?

2010-06-09 Thread calvin
Maybe you should ask this in the PHP Forms forum. This is the CakePHP
group.

On Jun 8, 8:26 am, LoveYou  wrote:
> Hey!
> I have such question: How php form availabilities do you know? PHP
> Form have different varifications and functions such as form
> generator, form creator, form builder... And Can php form keeps in
> touch with java script?http://phpforms.net/tutorial/html-basics/php-forms.html

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

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


Re: cakephp cms with CCK Funcionality

2010-06-08 Thread calvin
I would suggest giving a text description of what the video is in,
both, this thread and your YouTube video description. You may also
want to record a new video where you narrate what you are doing
(perhaps including a clear and audible intro at the start of the
video, explaining to viewers the purpose of the video). An explanation
of what "CCK" is would also be helpful.

On Jun 7, 7:38 pm, Toan Nguyen Dinh  wrote:
> i 'm still working. i hope get more tips from all members
>
> http://www.youtube.com/watch?v=j4JFlTNvDYM
>
> thanks
>
> kind regards

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

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


Re: difficulty with report component

2010-06-08 Thread calvin
Perhaps you should explain your solution in case someone else
encounters the same problem in the future.

Also, if a Bakery admin is reading this, please remove the spam
comment at the bottom of this page:
http://bakery.cakephp.org/articles/view/report-creator-component

On Jun 8, 8:37 am, butterlamb  wrote:
> Nevermind. I figured out the fix a while back.
>
> On May 4, 9:31 am, butterlamb  wrote:
>
> > Hello,
>
> > I'm having difficulty implementing the report component that was
> > posted in the bakery some time 
> > ago:http://bakery.cakephp.org/articles/view/report-creator-component
>
> > Since I'm using Cake 1.2.6, I modified it as suggested further down in
> > the comments, but I'm getting the below fatal error when I try to run
> > the reports:
>
> > Fatal error: Class '' not found in [path/to/component/class] on line
> > 78
>
> > The line in question is:
>
> > $this-> model = new $value;
>
> > I'm wondering if anyone has had any luck using this in 1.2, and if so,
> > do you have any suggestions on how to fix this?
>
> > Best,
> > butterlamb
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: User errors and fat model, skinny controller

2010-06-08 Thread calvin
Thanks for your reply. It's good to know that I'm on the right track.
I guess part of what was tripping me up was wanting to have high-level
Model functions when in actuality some of them belonged in the
controller since they contained application flow logic/requirements.
And I've also decided that returning a mixed data array with some kind
of a status structure is the best way to go. I'm also in the process
to implementing an event logger in my application to track errors,
anomalous conditions, and possibly usage patterns.

It's also interesting that you mentioned your method for importing CSV
data as an example as that's the exact problem I was working on when I
wrote the original post. I haven't tried offloading data processing to
a background task, but I may have to investigate that approach as some
of my CSV spreadsheets can take quite a while to process as well (it's
an intranet app, so I just increase the max script execution time). By
the way, you wouldn't happen to have found a way to import .xls (Excel
spreadsheet) data have you? My data sets (sales data from various
distributors) almost always comes in the form of Excel xls
spreadsheets or, occasionally, Excel html spreadsheets. The html
spreadsheets are pretty easy to deal with since they're just HTML
tables with some proprietary tags and attributes, but as yet I've
found no way to process or automatically convert XLS data to something
readable like CSV.

On Jun 7, 9:06 am, LunarDraco  wrote:
> I've been using fat model for a while now. It was difficult for me to
> get over what now appear to insignificant problems but at the time
> they looked huge.
>
> As the model's primary responsibility is to deal with data, I found it
> useful to always return something more than a boolean. So most of my
> model functions return a mixed data array.
> Part of that result array is a status structure which I can then refer
> to from the controller to display errors or redirect etc. This also
> allows the model to process a set of data and return an iterative list
> of errors. As an example I have a csv import which will process the
> first 100 rows of an import. Each row has the potential of creating an
> error, and the loop moves on to the next row. all these errors are
> returned in a single result. The model then passes the file to a
> background task to process the remainder of the rows. The controller
> displays via the view to the user the results of the first 100 rows
> along with the list of errors. I did this because some of these files
> are huge and would timeout. I can process 100 rows fairly quick and
> return control back to the user where they can see those newly
> imported records along with any errors.
>
> A second reason for this process is the model code doesn't know if it
> is being called by human interaction or via a cron script in either
> case the errors are also written to a logger which the user can review
> at any point in the app.
>
> In a previous post to this thread you mentioned you needed to redirect
> in certain conditions. Don't get your business logic (model) confused
> with your application flow (controller). A lighter controller doesn't
> mean there isn't any logic in those functions it just means there is
> less logic in them. Logic to control redirects definitely does belong
> in the controller and your model needs to be able to give enough
> information back to the controller to make those decisions.
>
> I've also found building test for the models is a lot easier than for
> the controller. If your using test do your best to write the test
> first. If your not using test, at least think in the mindset of the
> model code being called from human interaction as well as from a
> headless script. This will force you to deal with errors in a batch
> mode instead of one off exceptions.
>
> Overall your on the right track your making your model fat and you
> have identified the model is too deep for direct human interaction. I
> think there are many ways to deal with this without breaking the MVC
> pattern.
>
> My method explained above may seam too much for some, but having the
> errors logged and being able to review them has helped in identifying
> pieces of code which were in need of rework. A type of live profiling.
> Not so much of the performance but more so on quality and intuitive
> use or to identify poor assumptions on my part about the ability of my
> users.

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

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


Re: Using Javascript->link Inside An Element

2010-06-08 Thread calvin
I know, it sucks. I think I did manage to achieve a similar result in
a very roundabout way in one of my older applications, but it's not
really worth the hassle; Cake just isn't set up for it.

On Jun 8, 7:15 am, Dima  wrote:
> My original implementation did exactly what you describe but I was
> hoping that it could be done otherwise.  Guess not.
>
> Thanks,
> Dima
>
> On Jun 7, 8:12 pm, calvin  wrote:
>
> > You only use echo when you're linking them inline. So you would never
> > have something like:
>
> > echo $javascript->link($scriptname, false);
>
> > It would either be:
>
> > echo $javascript->link($scriptname);
>
> > or:
>
> > $javascript->link($scriptname, false);
>
> > Unfortunately, you can't use the $scripts_for_layout variable in the
> > layout or elements included from the layout because usually by that
> > point the variable has already been printed out.
>
> > Your best bet would be to just place inline link calls in the header
> > section of the layout.

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

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


Re: URL is showing wrong

2010-06-08 Thread calvin
Check your web server configurations. Cake usually generates urls like
that when you set your www_root/document_root to the / instead of /app/
webroot .

On Jun 8, 7:35 am, Davor Ilic  wrote:
> This is my code which i use to display my link:  
>   $ui_Url): ?>
>  
>  
>  link($ui_naviName,
>
>  array('controller'=>'clients','action'=>$ui_Url),
>
>   array('class'=>'gpFloatLeft')
>
>   ) ?>
>  
>
>  link('',
>  array('controller'=>'clients','action'=>'add_client'),
>  array('class'=>'ui_icons ui_icon_add gpFloatLeft tool-tip','title'=>'')
>  ) ?>
>  
>  
>  
>  
>  
>   and this is my route.php:   Router::connect('/', array('controller'
> => 'clients', 'action' => 'index'));
> 2010/6/7 John Andersen 
>
> > Yes, I understand what the result is, but which code (please show) is
> > the base for the link?
> > Have you defined any routes that may affect this - if yes, then show
> > them too!
> > Which folder is your webroot set to in your web server? Is it the app
> > folder or the app/webroot folder?
> > Enjoy,
> >   John
>
> > On Jun 7, 5:36 pm, Davor Ilic  wrote:
> > >  this creates link "
> >http://my.site/*app/webroot/index.php/*clients/add_client";
> > > but i want to tell link to show it without
> > > *app/webroot/index.php/ it should look like this url *
> >http://my.site/clients/add_client.
>
> > > thanks
>
> > > 2010/6/7 John Andersen 
>
> > > > And I were too fast here, sorry for that!
>
> > > > What is the code that creates the link?
> > > > Enjoy,
> > > >   John
>
> > > > On Jun 7, 4:28 pm, Davor Ilic  wrote:
> > > > > does anybody else have this issue too?
>
> > > > > 2010/6/6 Davor Ilic 
>
> > > > > > Hi,
>
> > > > > > my url is this:
> > > >http://my.site/*app/webroot/index.php/*clients/add_client
>
> > > > > > why is it like this it change after time but can´t say i´ve changed
> > > > > > something.
>
> > > > > > i wont to show the link like this with "$html->link()" :
> > > > > >http://my.site/clients/add_client
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > others
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com
> > >For
> > more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

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

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


Re: problem in auth component when i was creating a login controller.

2010-06-08 Thread calvin
Don't post the same question twice, please. You already had people
helping you with this in the other thread.

On Jun 8, 4:16 am, Narendra Padala  wrote:
> Hi i am new to cake php, when i am  creating a login authentication using
> app controller the following error was showed so please help me out. here
> data base i am using postgress sql, here i dont have permission to chanage
> the databse.
>
> this is app_controller.php
> --
>
> 
> class AppController extends Controller {
>
>     var $components = array('Auth', 'RequestHandler');
>
>     var $uses = array ('Tbluser') ;
>
>     var $helpers = array('Javascript','Html','Form','Ajax');
>
>     function beforeFilter(){
>
>         $this->Auth->loginAction = array('admin' => false, 'controller' =>
> 'tblusers', 'action' => 'login');
>
>         $this->Auth->authError = "Sorry, you are lacking access.";
>
>         $this->Auth->loginError = "No, you fool! That's not the right
> password!";
>
>         $this->Auth->userModel = 'Tbluser';
>
>         $this->Auth->authorize = 'tblusers';
>
>         $this->Auth->fields = array('username' => 'struid', 'password' =>
> 'strpid');
>
>         $this->Auth->allow('login');
>
>         $username = $this->Auth->user('struid');
>
>         $id = $this->Auth->user('lnguser');
>
>         $this->set('userId', $this->Auth->user('lnguser'));
>
>         $this->Auth->loginRedirect = array('controller' => 'tblusers',
> 'action' => 'index');
>
>     }
>
>     function isAuthorized() {
>             return true;
>     }
>
> }
>
> ?>
>
> Error Message :
> 
>
> *Warning* (512) : Auth::isAuthorized() -
> $authorize is set to an incorrect value.  Allowed settings are:
> "actions", "crud", "model" or null.
> [*CORE/cake/libs/controller/components/auth.php*, line *525*]
> *Warning* (2) : Cannot modify header information
> - headers already sent by (output started at
> /var/www/wizard_auth/cake/basics.php:108)
> [*CORE/cake/libs/controller/controller.php*, line *646*]
>
> Please any one can help me out...thanks in advance..!

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

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


Re: Problems with $model->find() in nest conditions

2010-06-08 Thread calvin
Cake doesn't do joins automatically with hasOne/Many or belongsTo
associations. Instead, it fetches the data from the first table, then
it performs additional queries to get the associated data.

You'll have to specify the joins manually if you want to base a find
condition on associated data:
http://book.cakephp.org/view/1047/Joining-tables

On Jun 7, 3:28 pm, jamc  wrote:
> Hello Friends, I want to do a query like this:
>
> $Anuncio->Inmueble->Zona
>
> where Anuncio hasOne Inmueble and Inmueble belongsTo Zona,
> obtain data works perfect, but the problem is to filter Anuncios
> according to one Zona.ciudad_id
> for that I am doing this:
> $this->Anuncio->find('all', array('conditions' => array(
>                                               'Zona.ciudad_id' =>
> $idCiudad
> )))
>
> where I can get $ciudadId with 'GET'.
>
> do it that way gives me the following error:
>
> SQL Error: 1054: Unknown column 'Zona.ciudad_id' in 'where clause'
>
> can someone please tell me how I can make that kind of conditions?
>
> Note: Excuse me, but I do not write English very well

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

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


Re: Query question(s)

2010-06-07 Thread calvin
Ack, that example wasn't very good either, so let's try _one_ more
time...

Say you want to do a search for records that conform to these
conditions:
-must be of _both_ type Video AND Photo
-must also be _either_ type Audio OR Text

then $andOptions would be 5; $orOptions would be 10.

On Jun 7, 7:38 pm, calvin  wrote:
> (My earlier post was inaccurate so I removed it. Let's try this
> again...)
>
> I don't think you need buildStatement() in this case as your query,
> although long, shouldn't actually be that complex, even if you end up
> with both OR and AND conditions. You just need to take a look at how
> OR/AND conditions are constructed in find() and then use them to build
> custom pagination 
> queries:http://book.cakephp.org/view/249/Custom-Query-Pagination
>
> Also, I did a test on GET forms using cake, and it should still create
> URLs like:
> /search?var1[]=0&var1[]=1...
>
> How are you creating the checkboxes? A good way to do it is:
> echo $this->Form->input('type', array(
>         'type' => 'select',
>         'multiple' => 'checkbox',
>         'options' => array(
>                 '1' => 'Video',
>                 '2' => 'Audio',
>                 '4' => 'Photo',
>                 '8' => 'Text',
>         )
> ));
>
> Also, notice that I use multiples of 2 for the option values. This
> allows you to perform bitwise operations when querying the database.
> When you save, you just call array_sum() and turn the array into an
> integer, and save to a tinyint field.
>
> And when you do a search, you can just create a simple query like:
> array(
>         'and' => array(
>                 "Model.type & $orOptions > 0",
>                 "Model.type & $andOptions = $andOptions"
>         )
> );
> --where $orOptions is just an array_sum() of the OR options and
> $andOptions is the array_sum() of the AND options.
>
> So if the user wants to find a directory that has Videos AND Photos OR
> Text, then $orOptions would be 8 and $andOptions would be 5 (1 + 4).
>
> This circumvents the problem of building long queries using LIKE and
> multiple ANDs and ORs. I would strongly advise against hand-building
> the SQL, especially in this case as your search query isn't so complex
> that you can't have Cake build it for you.
>
> On Jun 7, 12:14 pm, Ed Propsner  wrote:
>
> > @John:
>
> > [quote]
>
> > Can you explain why you have not separated/normalized the
> > "SomeCol.contents"?
> > And do you have other such columns in your database?
>
> > [/quote]
>
> > No, that is the only column in the db that stores multiple values in one
> > field (that aren't for display only). At one point in time the data in that
> > column wasn't searchable and it never presented an issue. A little hard to
> > explain but even though there are separate values, with the exception of the
> > recently added query they get treated as a whole within the app. I figured
> > that if the app ever changes down the road and needs to handle the values
> > individually it would be easy enough to explode the data. So to answer your
> > question of why? To be honest ... I thought I had good enough reasons but in
> > the end I suppose I didn't think it through well enough or far enough ahead.
> > If need be a restructuring of the db is not out of the question I just
> > assumed it wouldn't be a real stretch to come up with a creative solution
> > which ultimately ended up being the case. Just for the record, I do
> > recognize that a 'creative' solution is not always the best solution 8-).
>
> > �...@calvin:
>
> > About the queries ... there was a basic and an advanced. The basic is done
> > and working. With the advanced search since I don't know fields elements are
> > being submitted for the search I would normally concatenate the query
> > itself.
>
> > [example]
>
> > $query= " SELECT something FROM somewhere WHERE etc. etc. etc. ";
>
> >    if (isset($_GET['some_value']) && $_GET['some_value'] != '' )
> >   {
> > $value = $_GET['some_value'];
> > $query .= "AND  something = '".addslashes($value)."'";
> >   }
>
> > if (isset($_GET['some_other_value']) && $_GET['some_other_value'] != '' )
> >   {
> > $value = $_GET['some_other_value'];
>

Re: Query question(s)

2010-06-07 Thread calvin
(My earlier post was inaccurate so I removed it. Let's try this
again...)

I don't think you need buildStatement() in this case as your query,
although long, shouldn't actually be that complex, even if you end up
with both OR and AND conditions. You just need to take a look at how
OR/AND conditions are constructed in find() and then use them to build
custom pagination queries: 
http://book.cakephp.org/view/249/Custom-Query-Pagination

Also, I did a test on GET forms using cake, and it should still create
URLs like:
/search?var1[]=0&var1[]=1...

How are you creating the checkboxes? A good way to do it is:
echo $this->Form->input('type', array(
'type' => 'select',
'multiple' => 'checkbox',
'options' => array(
'1' => 'Video',
'2' => 'Audio',
'4' => 'Photo',
'8' => 'Text',
)
));

Also, notice that I use multiples of 2 for the option values. This
allows you to perform bitwise operations when querying the database.
When you save, you just call array_sum() and turn the array into an
integer, and save to a tinyint field.

And when you do a search, you can just create a simple query like:
array(
'and' => array(
"Model.type & $orOptions > 0",
"Model.type & $andOptions = $andOptions"
)
);
--where $orOptions is just an array_sum() of the OR options and
$andOptions is the array_sum() of the AND options.

So if the user wants to find a directory that has Videos AND Photos OR
Text, then $orOptions would be 8 and $andOptions would be 5 (1 + 4).

This circumvents the problem of building long queries using LIKE and
multiple ANDs and ORs. I would strongly advise against hand-building
the SQL, especially in this case as your search query isn't so complex
that you can't have Cake build it for you.

On Jun 7, 12:14 pm, Ed Propsner  wrote:
> @John:
>
> [quote]
>
> Can you explain why you have not separated/normalized the
> "SomeCol.contents"?
> And do you have other such columns in your database?
>
> [/quote]
>
> No, that is the only column in the db that stores multiple values in one
> field (that aren't for display only). At one point in time the data in that
> column wasn't searchable and it never presented an issue. A little hard to
> explain but even though there are separate values, with the exception of the
> recently added query they get treated as a whole within the app. I figured
> that if the app ever changes down the road and needs to handle the values
> individually it would be easy enough to explode the data. So to answer your
> question of why? To be honest ... I thought I had good enough reasons but in
> the end I suppose I didn't think it through well enough or far enough ahead.
> If need be a restructuring of the db is not out of the question I just
> assumed it wouldn't be a real stretch to come up with a creative solution
> which ultimately ended up being the case. Just for the record, I do
> recognize that a 'creative' solution is not always the best solution 8-).
>
>  @Calvin:
>
> About the queries ... there was a basic and an advanced. The basic is done
> and working. With the advanced search since I don't know fields elements are
> being submitted for the search I would normally concatenate the query
> itself.
>
> [example]
>
> $query= " SELECT something FROM somewhere WHERE etc. etc. etc. ";
>
>if (isset($_GET['some_value']) && $_GET['some_value'] != '' )
>   {
> $value = $_GET['some_value'];
> $query .= "AND  something = '".addslashes($value)."'";
>   }
>
> if (isset($_GET['some_other_value']) && $_GET['some_other_value'] != '' )
>   {
> $value = $_GET['some_other_value'];
> $query .= "AND  something = '".addslashes($value)."'";
>   }
>
> $query .= "WHERE some_col = some_criteria"
>
> mysql_query($query);
>
> [/example]
>
> This worked well enough in the past. I agree that if the conditions were all
> 'OR' I would be good to go, unfortunately they all need to be 'AND'. The
> closest example I can find in the book
>  (http://book.cakephp.org/view/1030/Complex-Find-Conditions) that seems
> even remotely close would be $dbo->buildStatement but to be brutally honest
> I have no clue how I would implement that (or something similar) in this
> case. Cake will accept the query whichever way I present it but the r

Re: Query question(s)

2010-06-07 Thread calvin
I don't think you need buildStatement() in this case as your query,
although long, shouldn't actually be that complex, even if you end up
with both OR and AND conditions. You just need to take a look at how
OR/AND conditions are constructed in find() and then use them to build
custom pagination queries: 
http://book.cakephp.org/view/249/Custom-Query-Pagination

Also, I did a test on GET forms using cake, and it should still create
URLs like:
/search?var1[]=0&var1[]=1...

How are you creating the checkboxes? A good way to do it is:
echo $this->Form->input('type', array(
'type' => 'select',
'multiple' => 'checkbox',
'options' => array(
'1' => 'Video',
'2' => 'Audio',
'4' => 'Photo',
'8' => 'Text',
)
));

Also, notice that I use multiples of 2 for the option values. This
allows you to perform bitwise operations when querying the database.
When you save, you just call array_sum() and turn the array into an
integer, and save to a tinyint field.

And when you do a search, you can just create a simple query like:
array(
'or' => array(
'Model.type | '.$orOptions,
'Model.type & '.$andOptions
)
);

This circumvents the problem of building long queries using LIKE. I
would strongly advise against hand-building the SQL, especially in
this case as your search query isn't so complex that you can't have
Cake build it for you.

On Jun 7, 12:14 pm, Ed Propsner  wrote:
> @John:
>
> [quote]
>
> Can you explain why you have not separated/normalized the
> "SomeCol.contents"?
> And do you have other such columns in your database?
>
> [/quote]
>
> No, that is the only column in the db that stores multiple values in one
> field (that aren't for display only). At one point in time the data in that
> column wasn't searchable and it never presented an issue. A little hard to
> explain but even though there are separate values, with the exception of the
> recently added query they get treated as a whole within the app. I figured
> that if the app ever changes down the road and needs to handle the values
> individually it would be easy enough to explode the data. So to answer your
> question of why? To be honest ... I thought I had good enough reasons but in
> the end I suppose I didn't think it through well enough or far enough ahead.
> If need be a restructuring of the db is not out of the question I just
> assumed it wouldn't be a real stretch to come up with a creative solution
> which ultimately ended up being the case. Just for the record, I do
> recognize that a 'creative' solution is not always the best solution 8-).
>
> �...@calvin:
>
> About the queries ... there was a basic and an advanced. The basic is done
> and working. With the advanced search since I don't know fields elements are
> being submitted for the search I would normally concatenate the query
> itself.
>
> [example]
>
> $query= " SELECT something FROM somewhere WHERE etc. etc. etc. ";
>
>    if (isset($_GET['some_value']) && $_GET['some_value'] != '' )
>   {
> $value = $_GET['some_value'];
> $query .= "AND  something = '".addslashes($value)."'";
>   }
>
> if (isset($_GET['some_other_value']) && $_GET['some_other_value'] != '' )
>   {
> $value = $_GET['some_other_value'];
> $query .= "AND  something = '".addslashes($value)."'";
>   }
>
> $query .= "WHERE some_col = some_criteria"
>
> mysql_query($query);
>
> [/example]
>
> This worked well enough in the past. I agree that if the conditions were all
> 'OR' I would be good to go, unfortunately they all need to be 'AND'. The
> closest example I can find in the book
>  (http://book.cakephp.org/view/1030/Complex-Find-Conditions) that seems
> even remotely close would be $dbo->buildStatement but to be brutally honest
> I have no clue how I would implement that (or something similar) in this
> case. Cake will accept the query whichever way I present it but the real
> problem lies in 'paginate' and 'containable', both of which I need. I
> suppose both could be written manually but then I would be well off the
> beaten path as far as Cake conventions and given my track record it would
> undoubtedly create some unforeseen problem somewhere down the line.
>
> As far as URL-encoded array data goes I j

Re: Using Javascript->link Inside An Element

2010-06-07 Thread calvin
You only use echo when you're linking them inline. So you would never
have something like:

echo $javascript->link($scriptname, false);

It would either be:

echo $javascript->link($scriptname);

or:

$javascript->link($scriptname, false);

Unfortunately, you can't use the $scripts_for_layout variable in the
layout or elements included from the layout because usually by that
point the variable has already been printed out.

Your best bet would be to just place inline link calls in the header
section of the layout.

On Jun 7, 2:51 pm, Dima  wrote:
> vekija, thanks a ton for your help!!  I added echo in front of all 4
> of the lines in nav_menu.cpt.  I was immediately able to see the style
> sheets kick in; however, when I look at page source, it still doesn't
> show those files in the page header and is not displaying correctly.
> Am I using the  correctly?  Does it
> have to go before/after a certain point in the header?
>
> Thanks again,
> Dima
>
> On Jun 7, 4:10 pm, vekija  wrote:
>
> > you have to "echo" those :)
>
> > echo $javascript->link('mootools-for-dropdown', false);
>
> > On Jun 7, 8:43 pm, Dima  wrote:
>
> > > I'm pretty new to CakePHP so it is likely that my issue is rather
> > > simple to fix.  I have a custom element which I created called
> > > nav_menu.cpt.  I call this element from default.cpt using:
>
> > > element('nav_menu'); ?>
>
> > > For my element to work properly, I need to import 3x .js files and
> > > 1x .css file; I have placed these files in /webroot/js/ and /webroot/
> > > css/ respectively and am attempting to call them inside the element
> > > like so:
>
> > >  > > $javascript->link('mootools-for-dropdown', false);
> > > $javascript->link('UvumiDropdown-compressed', false);
> > > $javascript->link('nav_menu', false);
> > > $html->css('uvumi-dropdown');
> > > ?>
>
> > > However, when the page loads and I check page source, it doesn't
> > > include these files in the header.  I've also tried calling this
> > > following line in default.cpt with no success:
>
> > > 
>
> > > What am I doing wrong??
>
> > > Thanks,
> > > Dima

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

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


Re: Query question(s)

2010-06-07 Thread calvin
If all of your search options are OR conditions, then you could
theoretically do something like this:
SELECT ... WHERE contents REGEXP '(opt1|opt2|opt3|opt4|opt5|opt6)';

http://dev.mysql.com/doc/refman/5.0/en/regexp.html#operator_regexp

On Jun 6, 1:24 pm, Ed Propsner  wrote:
> I found a usable solution, a bit exhaustive and long-winded perhaps, but
> usable nonetheless.
>
> I still need to put together a dynamic query and I'm finding myself avoiding
> having to do it at this time.
>
> I need to build a query dynamically based on what elements a user chooses
> from a form. There could be 20 choices or there could be 2.
>
> Every solution I'm coming up with is ridiculously excessive for something
> that should be so simple. I'm sure the answer is there, I'm just not
> familiar enough with Cake at this point to see it.
>
> - Ed
>
> On Sat, Jun 5, 2010 at 4:36 PM, Ed Propsner  wrote:
> > Perhaps I'm over-complicating this but I'm still having some problems with
> > building my query.
>
> > I'm looking to do something like:
>
> > $array = array (A, B, C, D, E);
> > $list = implode( ',' , $array);
>
> > 'conditions' => array(
> >                                'SomeCol.contents' => array($list)
> >                              )
>
> > The problem I'm running into is that $array can contain any number and
> > combination of values (A, C, E), (A, B), (E) ... etc.
> > And 'SomeCol.contents' can also contain any number and combination of
> > values stored as a comma separated string. (it was originally stored as a
> > serialized array).
>
> > I need the query to return a result if 'SomeCol.contents' and $array have
> > any one of their values in common.
>
> > I was thinking along the lines of :
>
> > 'conditions' => array(
> >                                'SomeCol.contents LIKE' => '%'.$array[0].'%'
> >                                                          OR
> >                                 'SomeCol.contents LIKE' =>
> > '%'.$array[1].'%'    etc, etc // this way should include any record in the
> > result that shares a value with $array
>
> > but I assume I would run into an issue with an undefined index by not
> > knowing how many values $array contains. (I do know it has the potential to
> > store a max of 7 values)
>
> > I had this all worked out with conventional PHP but now I need to use
> > Paginate and containable with this query as well as a bunch of other
> > conditions (with a set value) and I'm confusing myself more than anything
> > else which isn't a real stretch for me to begin with 8-).
>
> > Any suggestions are appreciated.
>
> > Thanks.
>
> > - Ed
>
> > On Fri, Jun 4, 2010 at 11:54 PM, Ed Propsner  wrote:
>
> >> Thanks Calvin, point well taken. I'll just stick with GET like I always
> >> have for searches.
>
> >> I tweaked the routing and got things cleaned up a bit so I guess I'm okay
> >> with it.
> >> I'm not quite sure what I was expecting in the first place? 8-)
>
> >> The search uses a lot of checkboxes and results in something like
> >>http://mysite.com/search/results/value1=0&value1=1&value2=0&value2=1.
> >> I can't seem to clean it up any more when submitting with GET, or am I
> >> still missing something?
>
> >> Anyhow, at least it's working the way that I want it to. I'm still having
> >> some issues with query so I'll quit fussing with the url for now.
>
> >> - Ed
>
> >> On Fri, Jun 4, 2010 at 10:15 PM, calvin  wrote:
>
> >>> POST requests are generally not cached, but you can force it to be
> >>> cached using the Cache-Control and Expires headers. However, I've
> >>> never tried this so I don't know if the browser will still show the
> >>> form submission dialog (it may need to resend the form data to check
> >>> to see if the document has changed since last requested). It probably
> >>> won't, but I would still strongly advise against this.
>
> >>> A search request is generally an idempotent operation (multiple
> >>> requests do not have any side-effects), which is precisely what the
> >>> GET request is designed for. There's no reason to use POST in this
> >>> case. Cake has a perfectly good way of hiding ugly URL-encoding using
> >>> its REST-style routing patt

Re: Query question(s)

2010-06-07 Thread calvin
I'm not sure what you ought to do about the custom query (you may just
have to build it the hard way or do as Ed suggest and redesign the
DB), but regarding the URL, there are a few ways to go about it.

Firstly, I should point out that the URL you wrote doesn't look right.
Usually, with something like checkboxes, you want to transmit the data
as an array:

http://mysite.com/search/results/value1[]=0&value1[]=1&value2[]=0&value2[]=1

I think that's how URL-encoded array data usually looks.

As to how to get from the standard http URL-encoding to Cake's REST-
style encoding, there are a few ways to go about it. The most obvious
way is to use JavaScript to build the Cake URL. That would be easy to
do, but it's not a good approach from an accessibility standpoint.
Instead, I would recommend accepting the "ugly" url and then, in the
controller, translate that into a Cake URL and redirect the user
there.

For example, you'd start with a standard search form with an action
url of:

http://mysite.com/search

which produces URLs like:

http://mysite.com/search?value1[]=0&value1[]=1&value2[]=0&value2[]=1...

Then the action that http://mysite.com/search routes to will take
those GET variables and convert them into:

http://mysite.com/search/result/value1:0,1/value2:0,1/...

I'm not sure if Cake has its own way of serializing arrays for URLs,
but that would seem like the most readable way to do it. You might
also try:

/search/result/value1[]:0/value1[]:1/value2[]:0/value2[]:1

or use PHP's serialize() function, which would return something like:

/search/result/value1:a:2:{i:0;i:0;i:1;i:1;}/value2:a:2:{i:0;i:0;i:1;i:
1;}

--which is not very pretty.

On Jun 4, 8:54 pm, Ed Propsner  wrote:
> Thanks Calvin, point well taken. I'll just stick with GET like I always have
> for searches.
>
> I tweaked the routing and got things cleaned up a bit so I guess I'm okay
> with it.
> I'm not quite sure what I was expecting in the first place? 8-)
>
> The search uses a lot of checkboxes and results in something 
> likehttp://mysite.com/search/results/value1=0&value1=1&value2=0&value2=1.
> I can't seem to clean it up any more when submitting with GET, or am I still
> missing something?
>
> Anyhow, at least it's working the way that I want it to. I'm still having
> some issues with query so I'll quit fussing with the url for now.
>
> - Ed
>
> On Fri, Jun 4, 2010 at 10:15 PM, calvin  wrote:
> > POST requests are generally not cached, but you can force it to be
> > cached using the Cache-Control and Expires headers. However, I've
> > never tried this so I don't know if the browser will still show the
> > form submission dialog (it may need to resend the form data to check
> > to see if the document has changed since last requested). It probably
> > won't, but I would still strongly advise against this.
>
> > A search request is generally an idempotent operation (multiple
> > requests do not have any side-effects), which is precisely what the
> > GET request is designed for. There's no reason to use POST in this
> > case. Cake has a perfectly good way of hiding ugly URL-encoding using
> > its REST-style routing patterns, e.g.:
>
> >http://yoursite.com/pages/search/foo/bar/foo2/bar2/...
>
> > You can also use named parameters to make the search URL more
> > readable, e.g.:
>
> >http://yoursite.com/products/search/q:paegan/artist:acid+bath/categor...
>
> > Unless you have a ton of search options, I see no reason to use POST.
> > And even if you use POST and generate shorter/cleaner URL--what's the
> > point? What will that clean URL achieve? The user can't bookmark it.
> > They can't link a friend to it. They can't do anything with it.
>
> > A happy compromise would be to do what a lot of forums do, and cache
> > each search server-side. Then when the user performs a search (with
> > either POST or GET), they get redirected to the cached search result,
> > which might be something like:
>
> >http://yoursite.com/search/paegan+terrorism+tactics/f83e3a4b389c6b
>
> > That will decrease your server load, allow you to use a POST form, and
> > still allow the user to bookmark/link the search results (at least for
> > a time).
>
> > On Jun 4, 10:40 am, Ed Propsner  wrote:
> > > I was checking out the book on complex queries and not really finding
> > what
> > > I'm looking for.
>
> > > I'm trying to create a query that covers both a basic and advanced
> > search.
> > > The form may be submitting all or just some of the options available on
> > the
> > > page de

Re: Dynamic Navigation (Menu and submenu)

2010-06-07 Thread calvin
He's laid out pretty much how to implement it yourself (with example
code). Why not just follow the article and implement it on your site
yourself instead of waiting for someone to hand you a complete plugin
for what is a relatively simple task?

On Jun 6, 10:53 pm, saavedrajj  wrote:
> OMG Hi JeremyPlease if you have some working example there
> send it to me if you can.
>
> saavedrajj -at- gmail.com
>
> otherwise... i have to wait :(
>
> good luck with the update
>
> On 7 jun, 01:21, Jeremy Burns  wrote:
>
> > That's my article. It needs updating as I have improved it substantially 
> > since writing it. It also needs some code to download. I can't commit to a 
> > timeframe, but I will work on it.
>
> > Jeremy Burns
> > jeremybu...@me.com
>
> > On 7 Jun 2010, at 05:06, saavedrajj wrote:
>
> > > I'm tired of search all the web for the best article about Dynamic
> > > Navigation in CakePHP
>
> > > I think this is one of the best articles that i found, but doesn't
> > > have a code to download
> > >http://articles.classoutfit.com/2009/11/cakephp-dynamic-navigation-bars/
>
> > > I realized that nobody wants to share how to do this
> > > it would be nice that SOMEONE post the "ultimate dynamic navigation"
> > > helper for everybody
>
> > > I can believe that it's very difficult to make a menu and submenu with
> > > active tabs!!
>
> > > Any help please?
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Total count of posts?

2010-06-07 Thread calvin
Just put it in the AppController (e.g. in beforeRender() or
beforeFilter()). That's what I do for my navigation variables.

On Jun 6, 3:49 am, saidbakr  wrote:
> Hi,
>
> What I meant is placing this in the layout to be available in all
> parts or pages of the application. I discovered that "requestAction()"
> method is able to do this in the layout.
> However, requestAction() method could not able to call private actions
> - Actions of name start with underscore _ such as _postcount.
>
> My question now is how to make requestAction able to call private
> action?
>
> On Jun 6, 4:20 am, Andras Kende  wrote:
>
> > Hello,
>
> > in the controller:
> > $this->set('postcount', $this->Post-find('count'));
>
> > in the view:
> > 
>
> > Andras
>
> > On Jun 5, 2010, at 6:34 PM, saidbakr wrote:
>
> > > Hi,
>
> > > How could I set dynamic data in the layout?
>
> > > In other word, I need to place the total count of posts in the layout
> > > footer.
>
> > > My application has posts controller and post model.
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Routes File Customization

2010-06-05 Thread calvin
It's sorta already doing that. If you want the "bank" homepage then
you have to go to site1.com/home or site2.com/home. I don't think the
Router is equipped for routing by hostname (could be wrong though).

If you absolutely have to have the 2 sites mixed together and have the
domains mirror each other, except at document root, then your best bet
would be to just use mod_rewrite and add a rule for document root.
Otherwise, you'll have to check the hostname in PagesController and
serve the correct homepage.

Personally, I would just use one domain, making the other domain a
redirect, and use prefix routing. For instance:

bank.com would be the active domain, with pages like:
bank.com/contact-us
bank.com/careers
bank.com/privacy
bank.com/corp would be the prefix for all the bancorp stuff, e.g.:
bank.com/corp/contact-us
bank.com/corp/careers
bank.com/corp/privacy

This is much more intuitive to the user, instead of having 2 domains
with similarly-named pages like:
site#.com/privacy
site#.com/privacy_policy
site#.com/contact-us
site#.com/contact_us

On Jun 4, 1:29 pm, GregFL2001  wrote:
> Hey everyone - We've got a bit of an odd configuration, and I was
> wondering if anyone had ideas on how we could fix this. We took over
> hosting of a website this past week that essentially is two sites in
> one, a bank site and it's parent corp site. The routes.php file is
> used to determine which 'site' you are on, essentially loading up
> various pages based on the path. Pretty straightforward.
>
> However, what I'm running into is that any root traffic
> (www.site1.com/orwww.site2.com/) gets redirected to the corp site
> because of the routes file. You can see how the routes.php file is set
> up here:
>
>  *
>  * first the bancorp...
>  */
>     Router::connect('/', array('controller' => 'pages', 'action' =>
> 'display', 'bancorphome'));
>         Router::connect('/gpb-in-the-news', array('controller' => 'pages',
> 'action' => 'display', 'bancorpnews'));
>         Router::connect('/board-of-directors', array('controller' =>
> 'pages', 'action' => 'display', 'bancorpofficers'));
>         Router::connect('/contact-us', array('controller' => 'pages',
> 'action' => 'display', 'bancorpcontact'));
>         Router::connect('/thank-you', array('controller' => 'pages',
> 'action' => 'display', 'bancorpthankyou'));
>         Router::connect('/faq', array('controller' => 'pages', 'action' =>
> 'display', 'bancorpfaq'));
>         Router::connect('/privacy', array('controller' => 'pages', 'action'
> => 'display', 'bancorpprivacy'));
>
> /**
>  * then the bank ...
>  */
>         Router::connect('/home', array('controller' => 'pages', 'action' =>
> 'display', 'bankhome'));
>         Router::connect('/our-proposed-bank', array('controller' => 'pages',
> 'action' => 'display', 'bankhome'));
>         Router::connect('/executive-team', array('controller' => 'pages',
> 'action' => 'display', 'bankexecutive'));
>         Router::connect('/board_of_directors', array('controller' =>
> 'pages', 'action' => 'display', 'bankboard'));
>         Router::connect('/take-a-tour', array('controller' => 'pages',
> 'action' => 'display', 'banktakeatour'));
>         Router::connect('/career-opportunities', array('controller' =>
> 'pages', 'action' => 'display', 'bankcareers'));
>         Router::connect('/contact_us', array('controller' => 'pages',
> 'action' => 'display', 'bankcontact'));
>         Router::connect('/thank_you', array('controller' => 'pages',
> 'action' => 'display', 'bankthankyou'));
>         Router::connect('/privacy_policy', array('controller' => 'pages',
> 'action' => 'display', 'bankprivacy'));
>
> /**
>
> So, any root path gets sent to the bancorp site. Is there any way to
> differentiate the two sites, so that maybe it looks for the url and
> redirects to the appropriate home page (aside from splitting the one
> site into two)?
>
> Thanks!

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

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


Re: echoing a bigger font

2010-06-05 Thread calvin
The selector should be changed to p#largeText, no space, and that
should work.

And don't use font tags or b/i/u tags.

On Jun 5, 6:22 am, Jonathon Musters  wrote:
> use My Text HERE
>
> in css
>
> p #largeText {
>
> font-size: 20px;
>
> }
>
> and you will get what you are looking for
>
> On Sat, Jun 5, 2010 at 8:58 AM, ytbryan  wrote:
> > Hi all,
>
> > If i am printing out a variable $result like the below in my view
>
> > 
>
> > How can I make the printed value appear bigger? I tried to surround
> > the value with  or control the css. But it don't help.
>
> > Thanks!
> > Bryan
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

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

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


Re: Query question(s)

2010-06-04 Thread calvin
POST requests are generally not cached, but you can force it to be
cached using the Cache-Control and Expires headers. However, I've
never tried this so I don't know if the browser will still show the
form submission dialog (it may need to resend the form data to check
to see if the document has changed since last requested). It probably
won't, but I would still strongly advise against this.

A search request is generally an idempotent operation (multiple
requests do not have any side-effects), which is precisely what the
GET request is designed for. There's no reason to use POST in this
case. Cake has a perfectly good way of hiding ugly URL-encoding using
its REST-style routing patterns, e.g.:

http://yoursite.com/pages/search/foo/bar/foo2/bar2/...

You can also use named parameters to make the search URL more
readable, e.g.:

http://yoursite.com/products/search/q:paegan/artist:acid+bath/category:t-shirt

Unless you have a ton of search options, I see no reason to use POST.
And even if you use POST and generate shorter/cleaner URL--what's the
point? What will that clean URL achieve? The user can't bookmark it.
They can't link a friend to it. They can't do anything with it.

A happy compromise would be to do what a lot of forums do, and cache
each search server-side. Then when the user performs a search (with
either POST or GET), they get redirected to the cached search result,
which might be something like:

http://yoursite.com/search/paegan+terrorism+tactics/f83e3a4b389c6b

That will decrease your server load, allow you to use a POST form, and
still allow the user to bookmark/link the search results (at least for
a time).

On Jun 4, 10:40 am, Ed Propsner  wrote:
> I was checking out the book on complex queries and not really finding what
> I'm looking for.
>
> I'm trying to create a query that covers both a basic and advanced search.
> The form may be submitting all or just some of the options available on the
> page depending on what the user chooses.
>
> Once the form has been submitted clicking any one of the query results would
> navigate the user away from the 'results page'.
>
> To avoid getting hit with the "form submission" dialogue when the users
> clicks the back button to return to the search results page
> and to cover the 'conditional query' ... I used to use a combo of $_GET and
> if(isset.
>
> ie:
>
> $query= " SELECT something FROM somewhere WHERE etc. etc. etc. AND ";
>
>    if (isset($_GET['some_value']) && $_GET['some_value'] != '' )
>   {
> $value = $_GET['some_value'];
> $query .= "AND  something = '".addslashes($value)."'";
>   }
>
> And so on.
>
> I'm not familiar with using cache for anything. To avoid using get and the
> ugly urls would I be able to use post and cache the results also avoiding
> the "form submission" dialogue when returning to the results page?
>
> Also, what is the best approach to setting up a 'conditional' query similar
> to what I posted above?
>
> I'll spend some more time digging through the book and experimenting if
> someone can point me in the right direction.
>
> Thanks,
>
> - Ed

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

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


Re: Saving multiple rows of key-value pairs during a single update?

2010-06-04 Thread calvin
Did you define the relationship between User and MetaUser?

i.e. in the User model:

$hasMany = array('MetaUser' => array());

Because both, your approach and vekija's, should work.

On Jun 4, 9:48 am, mwaterous  wrote:
> Well my last question here turned out to be between keyboard and
> chair, so hopefully this isn't quite as silly a question!
>
> I am learning Cake and building a custom user authentication system
> (who isn't?). I am trying to use two separate tables to store data,
> the User Model table as parent which stores only mission critical data
> (login, password, email, created, etc), and a MetaUser model table
> which is built around key value pairs (meta_id, user_id, meta_key,
> meta_value).
>
> Upon registration I have two pieces of meta information I would like
> to store - the activation code and an optin for receiving
> communication from site admins. I have built the forms as instructed
> by the Cake Book in order to use saveAll() in my Register action. The
> problem is that this results in the following array:
>
> Array
> (
>     [MetaUser] => Array
>         (
>             [optin] => 1
>             [activation_code] => 9c1a26272907d4196a7bf39d
>             [user_id] => 17
>         )
> )
>
> This obviously won't save since there is no optin or activation_code
> column in the MetaUser table. So I tried creating a beforeSave() under
> the presumption that if this was a numerical array it might try and
> add multiple rows on its own;
>
> public function beforeSave() {
>
>         if ( isset( $this->data['MetaUser']['user_id'] ) ) {
>
>                 $userid = $this->data['MetaUser']['user_id'];
>
>                 $new = array();
>                 $i = 0;
>
>                 foreach ( $this->data['MetaUser'] as $k => $v ) {
>                         $new[$i]['user_id']    = $user_id;
>                         $new[$i]['meta_key']   = $k;
>                         $new[$i]['meta_value'] = $v;
>                         $i++;
>                 }
>
>                 $this->data['MetaUser'] = $new;
>
>         }
>
>         return true;
>
> }
>
> But apparently it doesn't work that way. I'm going to try it next
> using distinct save()'s for $this->User and $this->MetaUser but am I
> missing something else that I should be doing instead? I want to
> create a MetaUser model where I can save each entry (even if multiple
> are coming from one form) as separate rows based on the key => value
> pair setup.

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

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


Re: Redirecting from javascript

2010-06-04 Thread calvin
I don't think you're understanding how a webpage works. JavaScript
can't invoke PHP functions or any server-side functions. JavaScript is
client-side. It's executed in the browser. The browser can send
requests to the web server for web _pages_. That's what
window.location does--it tells the browser to request the webpage at
that location. You can't redirect a browser to a "function".

You _can_, however, redirect the browser to a URL that represents a
controller "action". If you don't know the standard URL for a
controller action is, then you need to read the Cake Cookbook. The
standard routing pattern for Cake is one of the most basic concepts
you need to know for Cake development. So if you don't know that,
chances are you haven't bothered to read the Cookbook at all, which is
going to make developing a proper Cake application close to
impossible. So start here:

http://book.cakephp.org/view/879/Beginning-With-CakePHP

The specific info you are looking for with regards to this question is
here:
http://book.cakephp.org/view/945/Routes-Configuration

But I highly recommend at least skimming through the first 3 chapters
of the Cookbook, if not the entire Cookbook. It will save you _so_
much trouble (trust me).

On Jun 4, 1:22 pm, "[-Cheluis-]"  wrote:
> How to redirect to another controller/function. From html you can do
> something like:
>
> link('Message',
> array('controller'=>'x','action'=>'y',$parm); ?>
>
> How can I do this from js? window.location is enough?
>
> Thanks
>
> On Jun 4, 10:43 am, calvin  wrote:
>
> > Are you asking how to redirect to a different page in JavaScript?
> > That's not really Cake-related, but it's window.location = 'your new
> > page'.
>
> > On Jun 3, 9:49 pm, "[-Cheluis-]"  wrote:
>
> > > Hi! I was wondering if there is a way to redirect from one action to
> > > another via javascript. I want to do some validations and then,
> > > redirect the flow to one specific action.
>
> > > Any ideas?
>
> > > thanks

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

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


Re: Validate data & md5

2010-06-04 Thread calvin
I don't get that. I think that presents a false sense of security.

It's best practice to use a secure connection whenever you're
transmitting passwords. And if you're handling the request over secure
http, then it doesn't matter if you send the password back to the
user.

On Jun 4, 10:08 am, vekija  wrote:
> When you have an error on the registration form, it is a best practice
> to clear the password value and force the user to renter that info.
>
> So, in the controller...
>
> if($this->User->save($this->data)) {
>    // ... whatever you do after user had registered successfully} else {
>
>  // ... there was an error
>  $this->data['User']['password'] = null;
>
> }
>
> V
>
> On Jun 4, 4:21 pm, Chrriss  wrote:
>
> > Hi,
>
> > I have a form to add a user and I use an md5 encryption when I save
> > the password in the database.
> > I use $validate to check if the email address is valid. If it's not,
> > the form shows the data again with the error message but the password
> > is not the right one in this case. It's the hashed password. So when I
> > re-enter a valid email address, the password that is saved in the
> > database is not the one I wanted!
>
> > How can I do ?
>
> > Thank you in advance!

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

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


Re: DHMLX

2010-06-04 Thread calvin
Who is "they"? The DHTMLX developers?

A helper is just an object with a set of functions that save you time
when creating your views (e.g. eliminate repetitive code, convenience
functions, etc.). You might want to write a helper for DHTMLX, but
it's not necessary.

You probably want to start off by just ignoring the AJAX stuff and
build a regular site using Cake. Then once you figure out how Cake
works, it should be simple to add the AJAX handlers. If you've already
read the Cookbook and followed the tutorial, then it should be pretty
straightforward how to use any JavaScript UI library with cake. Cake
doesn't care how you style your tables or form inputs, and DHTMLX
doesn't care what backend code you have. So just read the Cake and
DHTMLX manuals and use DHTMLX as you would on any other site.

On Jun 4, 8:43 am, Alexsandro  wrote:
> Hello!
>
> Personal'm starting with cake and had a question. I use
> DHTMLX to create windows and layouts, but they do not know how to use
> it in
> cake we need a helper? or just call in the index?
>
> Sincerely,
>
> André Alexsandro
> Brazil / Joinville-SC
> (55) (47) 8825-0133

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

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


Re: Query Results, Empty Array

2010-06-04 Thread calvin
Yes, it does the same thing, because PHP still evaluates debug($page).
I'm just saying that debug() doesn't have a return value; it just
prints out the variable dump directly. Usually when people call
die(expression), it's because they want die() to print out
{expression} as the termination message. Calling die(debug($var)) is
sort of like calling die(echo($var)) or die(var_dump($var)).

There's nothing wrong with it. It will still do what you want it to
do. I just thought it was odd is all.

On Jun 4, 8:28 am, Jeremy Burns  wrote:
> @calvin: Not sure I understand you. die(debug($page)); will return the 
> contents of $page and then stop the code. Works every time.
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 4 Jun 2010, at 16:24, calvin wrote:
>
> > ^I'm pretty sure that debug() doesn't have a return value. So I
> > usually just call debug($page);die;.
>
> > DragonFlyEye:
> > How many queries are in the query table? Are you sure you're looking
> > at the right one? Is there some kind of command-line client for MS-SQL
> > that you can use to see exactly what each query returns? And you have
> > pretty non-standard field names (and probably table names as well).
> > Did you use Cake Bake to generate all of your models or make sure that
> > the models are all defined properly?
>
> > On Jun 4, 6:46 am, Jeremy Burns  wrote:
> >> Hmmm. So you say that Cake is creating a SQL query that works, but the 
> >> array that collects the results has empty elements where you would expect 
> >> data? Here's a couple of suggestions.
>
> >> Remove recursive completely - not ideal for production, but a good check 
> >> to see if it is somehow limiting it.
>
> >> Then, immediately after you run the query ($page = $this->find) try this:
>
> >> die(debug($page));
>
> >> What does that show?
>
> >> Jeremy Burns
> >> jeremybu...@me.com
>
> >> On 4 Jun 2010, at 14:39, DragonFlyEye wrote:
>
> >>> I've searched the group a bit and haven't found anything that seems to
> >>> exactly solve my problem. Let me begin with the basics:
>
> >>> This is a website which I am transitioning from an old ASP site into
> >>> CakePHP. The site is driven by an MS-SQL database and being served
> >>> from a Macintosh XServer running Apache2. So I am building Models
> >>> based on the current database table structure and working from there.
> >>> All of the connections seem to be working fine - queries are working
> >>> perfectly - with the exception of my current problem.
>
> >>> The problem is that in some cases, queries seem to work fine but the
> >>> resulting array ends up being empty. There's nothing fancy about the
> >>> query function itself:
>
> >>> public function getPage($id) {
> >>>    $page = $this->find('first', array('conditions'      => array('pageid' 
> >>> =>
> >>> $id, 'Page.default_levelid = Page.levelid'),
> >>>                                                                       
> >>> 'recursive'  => 3
> >>>                                                                       ));
> >>>    return $page;
> >>> }
>
> >>> And the resulting ['Page'] array is fine. The problem is the next
> >>> associated Model, the PageChart model. Here is where I associate it to
> >>> Page:
>
> >>> var $hasMany       = array('PageChart' => array('foreignKey'    => 
> >>> 'pageid',
> >>>                                                                     
> >>> 'order'                => 'line ASC'));
>
> >>> In the CakePHP query table from the debug mode shows a proper query
> >>> returning 6 PageChart results. However, in the returned array, the
> >>> ['PageChart'] sub-array is completely empty. There are currently no
> >>> associated Models for the PageChart model - I've removed them in order
> >>> to limit the scope of the problem.
>
> >>> I stress again that this is only a problem with certain queries for
> >>> certain pages, not others. I am sure that, under the circumstances,
> >>> there must be something about the data that is causing an issue.
> >>> Otherwise, I would expect that the result would be either consistently
> >>> right or consistently wrong, but not a bit of Colu

Re: CakePHP development firm

2010-06-04 Thread calvin
LOL, the CakePHP community is a developers community. If you ask us
for recommendations, (aside from CakeDC, as gmansilla mentioned)
people are going to recommend that you go with them or their own firm.
This isn't like the Magento community, where a lot of the members are
end-users rather than developers (though most of the community edition
users are still generally developers).

CakePHP is pretty easy to work with, so unless you have a highly
complex project, any company which has a few CakePHP CRUD sites in
their portfolio will do. I'd be more focused on cost, overall web
development experience, design ability, and (if it matters to you)
whether they are local (if you live in a big city like LA, NYC,
Chicago, etc.).

And is there a reason why you're looking specifically at Cake? I mean,
if I were going to contract someone to develop a web site/app for me,
I wouldn't care which framework they used. I would find the best
designer/developer in general, and let them choose which framework
they want to develop the site with.

On Jun 2, 1:30 pm, NS  wrote:
> Is there a list of CakePHP development firms? We are looking to engage
> with one for a project and would like to get recommendation from the
> community here.

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

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


Re: Updating One-to-Many Relations

2010-06-04 Thread calvin
I think the exception is when you have a many-to-many relationship and
the 'unique' property is set (by default). Then it will delete all of
the associated records in the join table before performing the add
operations.

On Jun 3, 7:21 am, John Andersen  wrote:
> The saveAll only saves the information that is available, it does not
> remove information not available, so when you uncheck a Day, that
> information is not available and saveAll does nothing with it!
>
> You have to think differently in order to remove an existing Day :)
> Enjoy,
>    John
>
> On Jun 3, 4:18 pm, bowikaxu  wrote:
>
> > Hi, i have a problem with a one to many relations, my models look like
> > this:
>
> > Calendar ( hasMany Days )
> > Day ( belongsTo Calendar )
>
> > The add operation is ok, i select some days from a calendar and they
> > get inserted and related to its calendar.
>
> > But when i edit a calendar the view previously selects the days it
> > has, but if i remove one day and select another one and i do a saveAll
> > operation the Days related to the Calendar remains the same, what
> > could be wrong?
>
> > Thanks in advance to all responses.

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

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


Re: Cookie name problem

2010-06-04 Thread calvin
What do you mean the cookie stops working? Are you not able to store
new cookie data or just forgetting the old data stored before changing
the cookie name? If it's the latter, that's normal. If you were saving
information in $_COOKIE['cakephp'] before, and then you tell CakePHP
to get that information from $_COOKIE['goodprg'], then naturally it
won't find the old information. That is the expected behavior.

On Jun 3, 4:50 am, FandaR  wrote:
> Hi, I have problem with cookies. If I rename the cookie to some name,
> for example I set Configure::write('Session.cookie', 'goodprg'); in
> core.php config file, The cookies stops working.
> I have setup  Configure::write('Session.save', 'cake');
> If I setup the cookies back to original name -
> Configure::write('Session.cookie', 'cakephp');
> Then its working good. What can be wrong?

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

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


Re: No form data

2010-06-04 Thread calvin
1. Controllers are plural. So it would be 'checkouts' not 'checkout'.
2. Read the Cookbook; you're not using $form->input() correctly.

On Jun 4, 6:47 am, Christoph  wrote:
> hi,
>
> i have a little bit trouble because i don't get any form data in $this->data. 
> i only get the data in $this->params['form']. is there a way to
>
> change that? that my form:
>
> print $form->create("Checkout", array(     "url" => array("controller" =>
> "checkout", "action" => "step2"),
>                                                                               
>   "type" => "post"));
>
> print $form->input   ("select", array      (       "options" => array("Herr" 
> =>
> "Herr", "Frau" => "Frau"),
>                                                                               
>           "label" => "Anrede:",
>                                                                               
>           "name" => "anrede",
>                                                                               
>           "id" => "anrede"
>                                                                               
>   )
>                                         );
>
> print $form->input   ("input", array               (       "label" => "Name:",
>                                                                               
>           "name" => "name",
>                                                                               
>           "id" => "name"
>                                                                               
>   )
>                                         );
>
> print $form->input   ("input", array               (       "label" => 
> "Vorname:",
>                                                                               
>           "name" => "vorname",
>                                                                               
>           "id" => "vorname"
>                                                                               
>   )
>                                         );
>
> print $form->input   ("input", array               (       "label" => 
> "Straße, Nr:",
>                                                                               
>           "name" => "strasse",
>                                                                               
>           "id" => "strasse"
>                                                                               
>   )
>                                         );
>
> print $form->input   ("input", array               (       "label" => 
> "Postleitzahl:",
>                                                                               
>           "name" => "plz",
>                                                                               
>           "id" => "plz"
>                                                                               
>   )
>                                         );
>
> print $form->input   ("input", array               (       "label" => 
> "Email:",
>                                                                               
>           "name" => "email",
>                                                                               
>           "id" => "email"
>                                                                               
>   )
>                                         );
>
> print $form->input   ("input", array               (       "label" => 
> "Telefon:",
>                                                                               
>           "name" => "telefon",
>                                                                               
>           "id" => "telefon"
>                                                                               
>   )
>                                         );
>
> print $form->end("buttons/weiter.png");

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

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


Re: Query Results, Empty Array

2010-06-04 Thread calvin
^I'm pretty sure that debug() doesn't have a return value. So I
usually just call debug($page);die;.


DragonFlyEye:
How many queries are in the query table? Are you sure you're looking
at the right one? Is there some kind of command-line client for MS-SQL
that you can use to see exactly what each query returns? And you have
pretty non-standard field names (and probably table names as well).
Did you use Cake Bake to generate all of your models or make sure that
the models are all defined properly?

On Jun 4, 6:46 am, Jeremy Burns  wrote:
> Hmmm. So you say that Cake is creating a SQL query that works, but the array 
> that collects the results has empty elements where you would expect data? 
> Here's a couple of suggestions.
>
> Remove recursive completely - not ideal for production, but a good check to 
> see if it is somehow limiting it.
>
> Then, immediately after you run the query ($page = $this->find) try this:
>
> die(debug($page));
>
> What does that show?
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 4 Jun 2010, at 14:39, DragonFlyEye wrote:
>
> > I've searched the group a bit and haven't found anything that seems to
> > exactly solve my problem. Let me begin with the basics:
>
> > This is a website which I am transitioning from an old ASP site into
> > CakePHP. The site is driven by an MS-SQL database and being served
> > from a Macintosh XServer running Apache2. So I am building Models
> > based on the current database table structure and working from there.
> > All of the connections seem to be working fine - queries are working
> > perfectly - with the exception of my current problem.
>
> > The problem is that in some cases, queries seem to work fine but the
> > resulting array ends up being empty. There's nothing fancy about the
> > query function itself:
>
> > public function getPage($id) {
> >    $page = $this->find('first', array('conditions'      => array('pageid' =>
> > $id, 'Page.default_levelid = Page.levelid'),
> >                                                                       
> > 'recursive'  => 3
> >                                                                       ));
> >    return $page;
> > }
>
> > And the resulting ['Page'] array is fine. The problem is the next
> > associated Model, the PageChart model. Here is where I associate it to
> > Page:
>
> > var $hasMany       = array('PageChart' => array('foreignKey'    => 'pageid',
> >                                                                     'order' 
> >                => 'line ASC'));
>
> > In the CakePHP query table from the debug mode shows a proper query
> > returning 6 PageChart results. However, in the returned array, the
> > ['PageChart'] sub-array is completely empty. There are currently no
> > associated Models for the PageChart model - I've removed them in order
> > to limit the scope of the problem.
>
> > I stress again that this is only a problem with certain queries for
> > certain pages, not others. I am sure that, under the circumstances,
> > there must be something about the data that is causing an issue.
> > Otherwise, I would expect that the result would be either consistently
> > right or consistently wrong, but not a bit of Column A and a bit of
> > Column B.
>
> > What I'm hoping someone can shed some light on is why CakePHP might
> > bork on data but not give an error message. Character encoding
> > problems? Spaces? Something like that?
>
> > I really appreciate the help.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: How to Add/Remove records dyanmically...

2010-06-04 Thread calvin
Is "sample code" a euphemism for "please write the code for me for
free"? Unless this is an open source project (in which case, please
provide a link to the public repository where the codebase is
located), don't expect others to do your work for you. If you're not
going to try and solve a simple problem (and it _is_ simple for anyone
who reads the Cookbook) on your own by reading the Cake manual, then
why should anyone help you?

On Jun 4, 2:37 am, Narendra Padala  wrote:
> Hi i am new to cakephp, here i attached the screen shot off my application
> please see that attachment,
> any one having the related sample code please help me out.
>
>  Naru.png
> 30KViewDownload

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

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


Re: session related query

2010-06-04 Thread calvin
That's a browser caching problem. You can use the pragma, cache-
control, and expires headers: 
http://book.cakephp.org/view/350/Obtaining-Request-Information

If you use all 3, then that should prevent most standards-compliant
browsers (and IE5 and later) from caching the page.

On Jun 4, 12:26 am, vikasphplernter  wrote:
> hai all
> I have facing the problem of session management because once I delete
> or destroy the session in logout page so it will redirect the index
> page and this process is correct but once I click the back button of
> the browser it open the welcome page with login the user and there the
> previous user name also be presented. So please tell me how I create
> the logout page and destroy the session.
>
> its urgent..
> thanking you

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

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


Re: Redirecting from javascript

2010-06-04 Thread calvin
Are you asking how to redirect to a different page in JavaScript?
That's not really Cake-related, but it's window.location = 'your new
page'.

On Jun 3, 9:49 pm, "[-Cheluis-]"  wrote:
> Hi! I was wondering if there is a way to redirect from one action to
> another via javascript. I want to do some validations and then,
> redirect the flow to one specific action.
>
> Any ideas?
>
> thanks

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

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


Re: how to set session variable after render?

2010-06-03 Thread calvin
Does $this->Session->write() not work? I know cookies are sent in the
http header, so they can't be modified after the page content has been
sent to the user (though Cake uses output buffering, so perhaps you
can still modify headers at that point), but session data is kept
server side.

On Jun 3, 4:49 am, Jeremy Burns  wrote:
> Not sure if that exists. If it doesn't, here's another idea...
>
> - Before first page view, session variable doesn't exist, so set it to 1.
> - Check the variable in the view; if it is 1, do the animation.
> - On next page view the variable exists (1), so set it to 0.
> - On page view, variable is not equal to 1, so animations doesn't happen.
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 3 Jun 2010, at 12:44, Anna P wrote:
>
> > Hello.
>
> > Just like in topic: how can I set session variable after page render?
>
> > The issue is: on first visit on home page, I want to display several
> > animations (logo sliding down, some not visible boxes appearing after
> > timeout). But I want to display animations only once, on the first
> > visit.
>
> > I wanted to set function afterRender() in AppController and there set
> > a session variable to switch between showing/not showing animations,
> > but it seems there is no such function in 1.2.X
>
> > How can I accomplish this?
>
> > Many thanks in advance,
> > Anna
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: slider not appearing

2010-06-02 Thread calvin
http://book.cakephp.org/view/1358/AJAX

On Jun 2, 10:05 am, Bryan Lim  wrote:
>  hi all,
>
> I am trying to get jquery works in my cakephp.
> source:http://www.cakephp.bee.pl/
> But i cannot see the slider..What is wrong? I see no error messages.
> As instructed in the site, I placed the helpers under /app/views/
> helpers/
> copied all the js into /app/webroot/js/
> added the following into /app/views/layouts/default.ctp
>
> link('jquery-1.4.2.min');?>
> link('jquery-ui-1.7.2.custom.min');?>
>
> added var $helpers = array('Javascript', 'Ajax'); to my controller.
>
> below is default.ctp
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> 
> 
> link('jquery-1.4.2.min');?>
> link('jquery-ui-1.7.2.custom.min');?>
> link('jquery.autocomplete.min');?>
> link('jquery.jeditable.mini');?>
> 
> 
> 
> 
>     
> 
> 
> 
> 
> 
> 
> 
>
> pasted the below in my view
>
> 
> Donation amount ($50 increments):
> 
> 
>
> 
> slider('slider2', array(
>     'value' => 100,
>     'min' => 0,
>     'max' => 500,
>     'step' => 50,
>         'slide' => '$("#amount").val("$" + ui.value);',
> ))?>
> 
> 
> $(document).ready(function(){
>     $("#amount").val('$' + $("#slider2").slider("value"));})
>
> 

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

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


Re: CakePHP - Auth

2010-06-01 Thread calvin
Or if you don't want to analyze the format of the 'username' field,
you could create a method (perhaps under the User model) that attempts
to log in first using username, then tries with email if that doesn't
work.

On May 31, 8:23 am, John Andersen  wrote:
> The same issue has been discussed in this 
> thread:http://groups.google.com/group/cake-php/browse_thread/thread/728bd1da...
>
> See how the original poster did it, you should be able to do something
> similar.
> Enjoy,
>    John
>
> On May 31, 1:56 pm, Saurav  wrote:
>
> > Hi
>
> > I am using the following code to authenticate a user:
>
> > function beforeFilter() {
> >                 $this->Auth->fields = array('username' => 'email',
> > 'password' => 'password');
>
> >         }
>
> > Its working fine!  But, I want cakephp to validate the auth with
> > username = 'email' OR username = 'username'
>
> > I tried the following but its not working:
>
> > function beforeFilter() {
> >                 $this->Auth->fields = array('username' =>
> > array('email','username'), 'password' => 'password');
>
> >         }
>
> > Can anyone help me with this pls?
>
> > Many Thanks

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

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


Re: Paypal buy now/subscription response

2010-06-01 Thread calvin
I'm not familiar with PayPal integration, but I do have a Magento
store that I'd like to add PayPal as a payment method for (right now
we just do credit card processing through Authorize.net), but there
are like 6 different PayPal payment methods, and most seem to require
a monthly fee instead of just a flat percentage like regular PayPal
transactions. So what PayPal plan are you using for your site and what
does PayPal charge for it, and do you know the differences between
things like PayFlow and PayPal's other plans?

On Jun 1, 4:57 am, Bharadwaj Parthasarathy 
wrote:
> @Jeremy,
>
> Thanks for the quick response. A couple of quick questions
>
> 1. Your thoughts on PDT vs IPN [I have used the wsdl to implement  
> payment integration in the past, but prefer a simpler solution (HTTP)  
> here]
> 2. I believe IPN is tied to a single paypal account. What if I need to  
> use paypal subscriptions on couple of websites? I can pass the  
> domainname as a parameter. Are the variables passed using POST or GET?  
> Is this a weak solution?
>
> Thanks,
> Bharadwaj
>
> On 01-Jun-10, at 6:48 AM, Jeremy Burns wrote:
>
> > IPN will send back transaction confirmation to a page that you  
> > specify. It is then up to your code to process the response back in  
> > your site/database. You can specify custom attributes to go along  
> > with the PayPal message so that you can tie everything back  
> > together. I'd suggest you read the developer section on the PayPal  
> > site - they even have sample code.
>
> > Jeremy Burns
> > jeremybu...@me.com
>
> > On 1 Jun 2010, at 12:44, barbi wrote:
>
> >> Hi,
>
> >> NOT related to CAKEPHP, sorry about that but I thought this question
> >> (and also answers) will help this community.
>
> >> I have built an information portal in PHP [Something like a recipe
> >> book], where the first few recipes are free to access. The advanced
> >> recipes are available only to paid members.
>
> >> I intend to use a simple subscribe now paypal button. When the user
> >> clicks on this button, he is directed to paypal website and upon
> >> payment redirected back to my site.
>
> >> How do I collect the payment information from paypal? I do not want  
> >> to
> >> use a wsdl.
>
> >> I need the information to update my user level field [0 for  
> >> registered
> >> users, 1 for paid users] in the users table.
>
> >> Any pointers? Does IPN do the trick for this? Is there a better
> >> solution for this?
>
> >> Thanks,
>
> >> Bharadwaj
>
> >> Check out the new CakePHP Questions sitehttp://cakeqs.organd help  
> >> others with their CakePHP related questions.
>
> >> You received this message because you are subscribed to the Google  
> >> Groups "CakePHP" group.
> >> To post to this group, send email to cake-php@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> cake-php+unsubscr...@googlegroups.com For more options, visit this  
> >> group athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help  
> > others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google  
> > Groups "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this  
> > group athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: helper to do a sliding animation

2010-05-31 Thread calvin
Having looked at a few of them. They all seem pretty much the same.
Most of them do vertical/horizontal scrolling, circular scrolling,
configurable scrolling intervals, etc.

I used jQuery Scrollable just because it was the first one I came
across. It might be a little better than some of the other scripts
since it preloads the images, but the implementation is kinda weird
(you have a really long fixed width div inside another one with
overflow set to hidden). It can also be integrated with jQuery
Mousewheel (as on the Rotten site), allowing you to scroll through the
gallery with your mousehweel. But that should be fairly easy to do
with any of the other slider scripts as well.

The bradblogging.com article is a nice little comparison of different
slideshow scripts though. Those might be more convenient if you're
trying to display images (jCarousel and Scrollable can be used as a
navigation element for things other than images).

On May 31, 1:47 am, barbi  wrote:
> Jcarousel is one of the earliest plugins, but I have found it to be a
> bit bloated sometimes. Try jcarousellite instead.
> Other alternatives - cycle, cycle light, LoopedSlider, easy slider
>
> http://bradblogging.com/jquery/9-jquery-slideshow-applications-you-ca...
> has a good collection of sliders, roughly arranged by ease of
> implementation and flexibility.
>
> Thanks,
>
> Bharadwajhttp://webhostingangel.com
>
> On May 31, 1:18 am, Bryan Lim  wrote:
>
> > jCarousel is exactly what I am looking for!
>
> > Curious, any alternative to jCarousel ?
>
> > On May 31, 2:14 pm, Bryan Lim  wrote:
>
> > > i see. Thanks guys. Will look into them !!
>
> > > On May 31, 2:01 am, calvin  wrote:
>
> > > > On our site (rottenrecords.com, the "new releases" and "featured
> > > > videos" panels on the homepage) we use the jQuery Scrollable plugin. I
> > > > made a helper for it, but it's not really necessary.
>
> > > > Oh, and that WWF interface is done in flash--that's why it's all
> > > > pixelated and blurry-looking.
>
> > > > On May 30, 4:08 am, Bryan Lim  wrote:
>
> > > > > Hi all,
>
> > > > > I am looking for a helper to do aslidinganimation.
>
> > > > > It is found inhttp://www.worldwildlife.org/undertheyearoftiger
> > > > >animationwhere you can go forward or backward accordingly. if you use
> > > > > firebug, it's under div class="whatsInside"
>
> > > > > What do we call this kinda of widget?
>
> > > > > Thanks!
> > > > > Bryan

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

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


Re: helper to do a sliding animation

2010-05-30 Thread calvin
On our site (rottenrecords.com, the "new releases" and "featured
videos" panels on the homepage) we use the jQuery Scrollable plugin. I
made a helper for it, but it's not really necessary.

Oh, and that WWF interface is done in flash--that's why it's all
pixelated and blurry-looking.

On May 30, 4:08 am, Bryan Lim  wrote:
> Hi all,
>
> I am looking for a helper to do a sliding animation.
>
> It is found inhttp://www.worldwildlife.org/under the year of tiger
> animation where you can go forward or backward accordingly. if you use
> firebug, it's under div class="whatsInside"
>
> What do we call this kinda of widget?
>
> Thanks!
> Bryan

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

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


Re: change action to render on beforeRender()

2010-05-27 Thread calvin
Yea, if you could keep the view files in subdirectories instead of
giving them different filenames, that would be optimal.

On May 27, 3:26 am, "Dr. Loboto"  wrote:
> Just add var like hasRendered, set and check it in beforeRender.
>
> Or keep customized views inside subfolders and just alter $this-
>
> >viewPath in beforeRender. I think it's much better.
>
> On May 26, 8:19 pm, TuteC  wrote:
>
> > Hi all. I'd like to change the default action to render so as to check
> > if a customized one exists (so as to render page.eng.ctp instead of
> > page.ctp. So, if that file exists, I want to render it on
> > beforeRender()

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

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


Re: Facebook fan pages and application

2010-05-27 Thread calvin
That is beyond the scope of this group. I would suggest reading up on
the API docs of Facebook/MySpace/Twitter/etc. and consulting their
respective development communities. If you have specific questions
pertaining to Cake, then you can come here to ask them.

On May 27, 4:32 am, mirfan  wrote:
> Hi,
>
> I am new to cakephp and also to facebook apps but i have no option:
>
> I have to retrieve fan fage and application users (fans) when the user
> provide application ID see the following case
>
> I have to register an application which ID is 1234567890
>
> Now when the user provide this ID its statistics like its fans, users,
> likes etc should be come automatically
>
> Is it possible
>
> and i am not only working with facebook i will also require with the
> following
>
> MySpace
> Twitter
> Bebo
> Hi5
>
> So please guide me, any help will be highly appreciated

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

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


Re: Database representation of meta data tables

2010-05-27 Thread calvin
Aside from join tables, Cake doesn't have specific conventions for
particular table relationships. Just follow the underscore/plural
convention and name it whatever makes the most sense.

On May 27, 7:47 am, Jeremy Burns  wrote:
> Before answering can I clarify. Do you mean (for example):
>
> table: users
> table: user_profiles
>
> ...where each user has a row in the user_profiles table?
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 27 May 2010, at 14:11, Radyon wrote:
>
> > Hey,
>
> > I've just started using cake and was wondering how I would implement
> > tables which contain meta data based on other tables.
>
> > Example: User (table) - UserMeta (table2), with a 1-1 relationship.
>
> > How would I name the user meta table in the database?
> > How would I name the model/controllers?
>
> > Any thoughts would be greatly appreciated.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Server does not support .htaccess files

2010-05-26 Thread calvin
Why not just find a better web host, like DreamHost? They offer more
space/bandwidth/features and for far less than that web host. And,
looking at that site, I'm pretty sure DreamHost's personnel are also
more knowledgeable and technically adept than MicroOhio's.

On May 26, 11:25 am, nurvzy  wrote:
> http://book.cakephp.org/view/44/CakePHP-Core-Configuration-Variables
>
> Look at App.baseUrl configuration.
>
> Hope that helps,
> Nick
>
> On May 26, 2:55 am, "Prof. No Time" 
> wrote:
>
> > Good day,
>
> > I need to install cakePHP on a server that does not support .htaccess
> > files:
> > (http://cp.micronet-ohio.com/psoft/servlet/psoft.hsphere.CP/oandoplc/
> > 223909_0/psoft.hsphere.CP?template_name=quick/quick_view.html)
>
> > 1. How do I go about this?
>
> > 2. What are the implications?
>
> > Thank you.

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

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


Re: change action to render on beforeRender()

2010-05-26 Thread calvin
IMO, you should follow Cake conventions and use the callbacks the way
they're intended (and are named). If the callback is "beforeRender"
then obviously you wouldn't want to render from there. Just like if
you tried to force "beforeRender" code into "afterRender", you're
going to run into problems--and confuse other people who look at the
code.

The most obvious solution IMO, would be just to set a controller
property (e.g. $this->viewFile = $file_path), and then call
render($this->viewFile) at the end of each action. You could also
change $this->action to $file_path, but that may have other unintended
consequences. You can also disable autoRender and then do the
rendering in afterFilter(), but that's also breaking conventions and
confusing. Lastly, you could overload the render() function and just
replace it with the code you're putting in beforeRender(), using
parent::render() to call the original render function.

On May 26, 6:19 am, TuteC  wrote:
> Hi all. I'd like to change the default action to render so as to check
> if a customized one exists (so as to render page.eng.ctp instead of
> page.ctp. So, if that file exists, I want to render it on
> beforeRender(), like so:
>
>         function beforeRender() {
>                 $locale = $this->Session->read('Config.language');
>                 $file_path = VIEWS . $this->viewPath . DS . 
> $this->passedArgs[0] . ".
> $locale.ctp";
>                 if (file_exists($file_path)) {
>                         $this->render($file_path);
>                 }
>         }
>
> Te problem is that render() calls beforeRender, and I begin an
> infinite loop. Is there another way to replicate the behavior I want?
> If not, should we have a render() which doesn't call beforeRender
> (again), or an option so as to avoid it?
>
> My quick-and-dirty fix consisted in a duplicated render() function
> without that call, but I think a better fix would be great for
> CakePHP.
>
> Kind regards,
>
> Eugenio.

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

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


Re: integrating SWF chart with cakephp

2010-05-26 Thread calvin
Yes. It will be possible. You would embed the flash the same as in any
other site, though you could probably create a helper to automate some
of the repetitive tasks.

On May 26, 9:06 am, Bryan Lim  wrote:
> Hi all,
>
> I want to integrate thishttp://www.maani.us/charts/index.phpinto my
> php application.
> Can someone give me a hint on how i can  go about doing it?
>
> There are javascript and swf element. Will it be possible?
>
> Thanks!
> /bryan

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

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


Re: array of objects in the controller

2010-05-26 Thread calvin
What exactly is the problem? If you know how to do that in the view,
then you can do the same thing in the controller. There's nothing
magical about passing find() results to the view using $this->set().
All it does is "set" the variables you specify in the view. If you
don't know the structure of $coupons, just use debug() to view it.

Also, technically those aren't objects, otherwise you'd access the
'title' property by $coupon->title; they're just associative arrays.

On May 26, 10:48 am, sherzo  wrote:
> Hi all
>
> I need to have something like the following code but in the controller not
> view.
> foreach ($coupons as $coupon)
>         $st = $coupon['Coupon']['title'];
> endforeach;
>
> and the $coupons is the result of a find() function.
>
> any idea?
>
> Thanks
> Sherrt
> --
> View this message in 
> context:http://old.nabble.com/array-of-objects-in-the-controller-tp28684091p2...
> Sent from the CakePHP mailing list archive at Nabble.com.

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

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


Re: Validate REST input

2010-05-21 Thread calvin
Use $this->validates()

But why not use Cake's named parameters? (e.g. /test/do/start:
2010-01-01/end:2010-01-01/test:1/super:8)

On May 21, 11:51 am, Henrik Gemal  wrote:
> I have a controller which is being called with different paramters
> like:
> /test/do?start=2010-01-01&end=2011-01-01&test=1&super=8
>
> Now I like to user cake to validate the input parameters. How do I do
> that?
>
> I like to specify that start and end are dates and test is numeric and
> super is also numeric.
>
> Can CakePHP do this?
>
> I'm not saving the parameters into a database so I cant just use $this-
>
> >save($data)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Where do I put the index.ctp for the app_controller?

2010-05-21 Thread calvin
AFAIK, AppController doesn't have any actions or views. It's just used
as a parent class for the other controllers to inherit from. If you're
looking to change the home page of your app, then edit /app/views/
pages/home.ctp --static pages are all served up by the
PagesController.

On May 20, 11:37 pm, Rgh  wrote:
> Right now I have the default view forhttp://localhost/cake/appacl/,
> and I want to change it to my own view.
>
> Its embarrassingly simple - but Im a complete newbie and its a hard
> question to google (web and this group)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: ideas for handling user added images

2010-05-21 Thread calvin
Why don't you move your working directory to separate the live
application from the checkout? That's how we have it set up at work.
Each team member has their own local working directory as well as
their own separate vhost on our test server (though we generally all
share one test database). Transferring files to the test server via
SFTP isn't much of a hassle since it's all local and Aptana has an
auto-upload-on-save script. I honestly don't feel there's that much of
a difference from working right out of the www root directory.

Or you could just do what I do at home--store user-uploaded images in /
app/webroot/files/img and add that path to svn:ignore.

On May 20, 10:27 pm, mikeottinger  wrote:
> Hi All,
>
>   I have a site that allows the user, through an admin section, the
> ability to upload his own images to the site, a very poor man's CMS if
> you will. This has all worked pretty well but for one annoying aspect
> that I finally want to address. Currently all uploaded images are
> placed in app/webroot/img where they're used with the html helpers.
> Why I don't like this approach is that these files get mixed in with
> files under source control. My production server is basically an SVN
> checkout of the application. Everything is perfectly in synch with SVN
> except for these user uploaded images. What I had in mind was setting
> aside a directory outside of the cakephp app instance and have my
> image paths point to there. This doesn't work because this outside
> directory is not a document root to the web server. I suppose I could
> setup a separate host configuration within apache and place them in
> its document root. Long story short, has anyone devised any better
> ways to keep user generated content out of the application's directory
> structure?
>
> Thanks in advance.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Find Question - field()

2010-05-20 Thread calvin
I mean referencing the model object itself, i.e. $this->User->find()
instead of $model->find() or User->find().


On May 20, 10:18 am, bradmaxs  wrote:
> Thanks Calvin.
>
> When you say access models from controllers, do you mean with find().
>
> Trying some different methods as we speak.
>
> On May 20, 4:07 am, calvin  wrote:
>
>
>
> > Assuming that's exactly what your code looks like, the
> > T_OBJECT_OPERATOR error is probably because you're putting a
> > T_OBJECT_OPERATOR ("->") after a constant ("User"). If you want the
> > model, then you need to write $this->User. Likewise, unless you
> > declared a variable previously named $model, calling $model-
>
> > >anything() is going to result in an error.
>
> > Jeremy's recommendations are good, but you should still read up on how
> > to access models from controllers in the Cookbook. That will help you
> > avoid encountering similar errors in the future.
>
> > On May 19, 7:17 pm, bradmaxs  wrote:
>
> > > I want to send an email with the email component.  No problem there.
>
> > > However, I don't want it to be a hidden field in the form so I thought
> > > I could do something in the controller.
>
> > > So I did this line:
>
> > > $email = $this->User->find('first', array('conditions' =>
> > > array('User.id' => $this->data['Friend']['friend_id']), 'fields' =>
> > > 'User.email_address'));
>
> > > Which to my surprise (still learning all of these functions) it did
> > > get the email address but the find function turns the info into an
> > > array and then the email component has an array to deal with rather
> > > than the specific string (email_address).
>
> > > I thought I could use the field() method but I am confused as to how
> > > to get it to work and there isn't much documentation.
>
> > > I tried:
>
> > > $email = User->field('email_address', array('id' => $this-
>
> > > >data['Friend']['friend_id']));
>
> > > and got:
>
> > > Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /var/www/
> > > vhosts/theactorstoolkit.com/httpdocs/app/controllers/
> > > users_controller.php  on line 69
>
> > > which shows up on the screen before I even get to the page.
>
> > > I tried:
>
> > > $email = $model->field('email_address', array('id' => $this-
>
> > > >data['Friend']['friend_id']));
>
> > > and once I submit the form it gives me:
>
> > > Notice (8): Undefined variable: model [APP/controllers/
> > > users_controller.php, line 69]
>
> > > Anyone know how this should be done.
>
> > > Thank you!
>
> > > Brad
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Help with User - Friend HABTM relationship

2010-05-20 Thread calvin
That's a PHP question, not a Cake question.

If you want to combine the arrays, then just combine them like you
would any other array.

If you have:

$friends = array('friend 1', 'friend 2', 'friend 3', ...);
$admirers = array('admirer 1', 'admirer 2', 'admirer 3', ...);

how would you combine them?

Well, the obvious solution is with array_merge():
$friendsAndAdmirers = array_merge($friends, $admirers);

If you want to filter out duplicates (i.e. if a person is both a
friend and an admirer), then use array_unique() on top of
array_merge().

I would suggest bookmarking--or, better yet, installing the Firefox
search tool for--the PHP Manual:
http://us3.php.net/manual/en/index.php

On May 20, 11:31 am, bradmaxs  wrote:
> Anyone able to help me on this?
>
> On May 18, 4:55 pm, bradmaxs  wrote:
>
>
>
> > Hello All,
>
> > In response to the following post:
>
> >http://groups.google.com/group/cake-php/browse_thread/thread/c8ebc209...
>
> > I have come up with my users having friends and admirers, thank you
> > gentlemen for that.
>
> > I am getting the array for both of them in my dump.
>
> >     [friend] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [id] => 3
> >                     [username] => artist
>
> >                     [Friend] => Array
> >                         (
> >                             [id] => 1
> >                             [user_id] => 4
> >                             [friend_id] => 3
> >                             [approved] => 1
> >                         )
>
> >                 )
>
> >             [1] => Array
> >                 (
> >                     [id] => 5
> >                     [username] => testing
>
> >                     [Friend] => Array
> >                         (
> >                             [id] => 2
> >                             [user_id] => 4
> >                             [friend_id] => 5
> >                             [approved] => 1
> >                         )
>
> >                 )
>
> >         )
>
> >     [admirer] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [id] => 5
> >                     [username] => testing
>
> >                     [Friend] => Array
> >                         (
> >                             [id] => 3
> >                             [user_id] => 5
> >                             [friend_id] => 4
> >                             [approved] => 0
>
> > My question, and I think it is simple but I am still a newbie for the
> > most part -
>
> > How do I combine that data in the view to have both friends and
> > admirers as part of the same foreach statement?
>
> > Is that possible?  I have looked at Set::merge and tried that from the
> > controller.  Looked at custom query methods but the data is already
> > there in an array so I am a little stuck.
>
> > Here is what is in my view for the friends array and it is working
> > fine.  Just don't know how to get the admirer as part of it.
>
> > 
> > 
> > 
> > Html->link(__('View', true), array('controller' =>
> > 'friends', 'action' => 'view', $friend['id'])); ?>
> > Html->link(__('Delete', true), array('controller' =>
> > 'friends', 'action' => 'delete', $friend['id']), null, sprintf(__('Are
> > you sure you want to delete # %s?', true), $friend['id'])); ?>
> > 
>
> > Thanks for any help!
>
> > Brad
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Theme Problem

2010-05-20 Thread calvin
You're not following Cake's naming/directory structure conventions for
themes:
http://book.cakephp.org/view/1093/Themes

On May 20, 1:57 pm, Davor Ilic  wrote:
> Hi All,
>
> i have some trobles with the theme.
>
> i get always the default theme from cakePHP.
>
> i used this in my UserController:
>
> var $view = 'Theme';
>
> var $theme = 'wf';
>
> and i also try for some actions $this->theme = 'wf'; it also didnt work.
>
> and the folder i have used "/view/wf/wf.ctp "
>
> what i´ve done wrong?
>
> I use 1.3 stable cakePHP
>
> thanks
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: conditions on how a virtual field is constructed

2010-05-20 Thread calvin
In this case TRIM() is the best solution. But you can also use the
IF(condition, "true value", "false value") function, which acts like a
ternary operator.

On May 19, 7:42 am, fly2279  wrote:
> For anyone else looking for a solution to this, I used mysql's trim
> function to just trim away the trailing comma and space if there isn't
> a first name:
>
> 'last_first' => sprintf('TRIM(TRAILING \', \' FROM
> (CONCAT(%s.last_name, ", ", %s.first_name)))', $this->alias, $this-
>
> >alias)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Find Question - field()

2010-05-20 Thread calvin
Assuming that's exactly what your code looks like, the
T_OBJECT_OPERATOR error is probably because you're putting a
T_OBJECT_OPERATOR ("->") after a constant ("User"). If you want the
model, then you need to write $this->User. Likewise, unless you
declared a variable previously named $model, calling $model-
>anything() is going to result in an error.

Jeremy's recommendations are good, but you should still read up on how
to access models from controllers in the Cookbook. That will help you
avoid encountering similar errors in the future.

On May 19, 7:17 pm, bradmaxs  wrote:
> I want to send an email with the email component.  No problem there.
>
> However, I don't want it to be a hidden field in the form so I thought
> I could do something in the controller.
>
> So I did this line:
>
> $email = $this->User->find('first', array('conditions' =>
> array('User.id' => $this->data['Friend']['friend_id']), 'fields' =>
> 'User.email_address'));
>
> Which to my surprise (still learning all of these functions) it did
> get the email address but the find function turns the info into an
> array and then the email component has an array to deal with rather
> than the specific string (email_address).
>
> I thought I could use the field() method but I am confused as to how
> to get it to work and there isn't much documentation.
>
> I tried:
>
> $email = User->field('email_address', array('id' => $this-
>
> >data['Friend']['friend_id']));
>
> and got:
>
> Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /var/www/
> vhosts/theactorstoolkit.com/httpdocs/app/controllers/
> users_controller.php  on line 69
>
> which shows up on the screen before I even get to the page.
>
> I tried:
>
> $email = $model->field('email_address', array('id' => $this-
>
> >data['Friend']['friend_id']));
>
> and once I submit the form it gives me:
>
> Notice (8): Undefined variable: model [APP/controllers/
> users_controller.php, line 69]
>
> Anyone know how this should be done.
>
> Thank you!
>
> Brad
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: User errors and fat model, skinny controller

2010-05-19 Thread calvin
A lot of times when I'm faced with this issue, my model method already
has a return value, but I suppose the error/success code could just be
passed under a separate key in the return array. I was just curious if
others had found ways to deal with this issue without the use of
return codes, or if some felt that, under certain circumstances, a fat
controller is justifiable. But in the end, using detailed return codes
is probably the most practical solution without breaking MVC.

On May 17, 8:36 pm, Jeremy Burns  wrote:
> A good question, and I guess there are many different ways of handling this. 
> When I do it, I parse the data looking for obvious errors, trap processing 
> errors, react to validation errors etc. within the model then return an error 
> or success code to the controller. The controller then knows what to do.
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 18 May 2010, at 00:27, calvin wrote:
>
>
>
> > So since I've started trying to implement the fat model, skinny
> > controller MVC pattern, I've continuously run into one issue--the
> > problem of dealing with user errors.
>
> > Fat model, skinny controller is great as it predisposes developers
> > towards a top-down development style that produces self-documenting
> > and more maintainable code. But I've found that, the more I try to
> > move the business logic to the model, the harder it is for me to
> > display detailed error messages or otherwise alter the view in
> > response to different use cases.
>
> > For example, if one is trying to write an action that allows the user
> > to upload a sales report, you could write something like:
> > function upload() {
> >    if (!empty($this->data) {
> >         if ($this->Report->upload($this->data) {
> >             $this->Session->flash('Sales report uploaded and
> > processed.');
> >             $this->redirect(...);
> >         } else {
> >             $this->Session->flash('Sales report could not be
> > processed.');
> >         }
> >    }
> > }
>
> > And in Report::upload() you might save the uploaded file and process
> > the sales data it contains.
>
> > But what if the file was successfully uploaded, but could not be
> > processed for some reason? E.g. how do you tell the user that the file
> > uploaded correctly, but its contents are incorrect? Or how do you tell
> > the user that the file uploaded correctly, but one of the products
> > referenced by the sales report is not in the database and must be
> > added first?
>
> > Has anyone else encountered this problem? How have others overcome it?
> > Do you throw lots of exceptions or just return an array that includes
> > error/status info?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: User errors and fat model, skinny controller

2010-05-19 Thread calvin
I generally use validation errors whenever I can. And that's indeed
how I deal with file extension issues. The problem I was trying to get
across is situations where you need to do more than just display a
simple error message.

A more concrete example would be, for instance, if you were trying to
generate a royalty statement for an artist. The user would select the
artist and the accounting period to process data from, and the
application looks up all the sales data and applies the royalty rates
for that artist. But if no royalty rates have been inputted for that
artist, then you want to redirect the user to the rates creation
action or just render a form that allows rates to be created for that
artist.

Another example which I alluded to before would be when trying to
display detailed status messages to the user after processing bulk
data. In my case, I have a model method called process() which returns
the number of sales figures processed or false if a fatal error
occurred. But in addition to reporting the number of sales figures
processed, I also wanted to display information about non-fatal
errors, such as products listed in the spreadsheet that are not in our
product database. If the processing were done in the controller, I
would simply set a view variable containing an array of all the
missing products (and additional info like the artist or album it
belongs to). But after moving the code to my Spreadsheet model, I had
to store that supplementary info in a new model property,
Spreadsheet::missingProducts.

I suppose you could still create fake fields and invalidate them to
send messages from model to controller, but many of these situations
aren't necessarily categorized as form validation per se, and this
would not work well for non-string data.

On May 17, 9:04 pm, "Dr. Loboto"  wrote:
> Validation and validation errors. You always have form on such pages,
> so you can use $form->error(). Existence of field in DB is not
> necessary for validation. You can just call $this->invalidate('file_format') 
> in model, write there appropriate error
>
> message, and output it on page.
>
> On May 18, 6:27 am, calvin  wrote:
>
>
>
> > So since I've started trying to implement the fat model, skinny
> > controller MVC pattern, I've continuously run into one issue--the
> > problem of dealing with user errors.
>
> > Fat model, skinny controller is great as it predisposes developers
> > towards a top-down development style that produces self-documenting
> > and more maintainable code. But I've found that, the more I try to
> > move the business logic to the model, the harder it is for me to
> > display detailed error messages or otherwise alter the view in
> > response to different use cases.
>
> > For example, if one is trying to write an action that allows the user
> > to upload a sales report, you could write something like:
> > function upload() {
> >     if (!empty($this->data) {
> >          if ($this->Report->upload($this->data) {
> >              $this->Session->flash('Sales report uploaded and
> > processed.');
> >              $this->redirect(...);
> >          } else {
> >              $this->Session->flash('Sales report could not be
> > processed.');
> >          }
> >     }
>
> > }
>
> > And in Report::upload() you might save the uploaded file and process
> > the sales data it contains.
>
> > But what if the file was successfully uploaded, but could not be
> > processed for some reason? E.g. how do you tell the user that the file
> > uploaded correctly, but its contents are incorrect? Or how do you tell
> > the user that the file uploaded correctly, but one of the products
> > referenced by the sales report is not in the database and must be
> > added first?
>
> > Has anyone else encountered this problem? How have others overcome it?
> > Do you throw lots of exceptions or just return an array that includes
> > error/status info?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to th

Re: Sanitize::clean breaking file uploads

2010-05-19 Thread calvin
Were the file uploads working before you used Sanitize::clean? Because
cake doesn't handle file uploads automatically. Aside from having to
set array('type'=>'file') in your $form->create() statement, you also
need to move/save the uploaded file yourself.

Unless you're manually moving the file, either to a permanent upload
directory or into a database or something, the web server (and cake)
has no way of knowing what you want to do with the file. It'll just
sit in the temp directory until the script terminates, at which point
the file will be deleted.

On May 19, 3:37 am, Michele Ferri  wrote:
> Hello.
>
> I'm using Sanitize::clean for cleaning the $this->data arrays in the
> controllers before saving them to the db.
>
> example
> if (!empty($this->data))
> {
>         $this->data = Sanitize::clean($this->data);
>         [...]
>
> }
>
> The problem is that if a form contains a file input, the file is not
> uploaded. The file array is correctly populated after the post (with
> tmp_name and everything), but the physical file is not present in the
> upload folder.
>
> Is there any workaround for this?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Front-end for end-users and admins design

2010-05-19 Thread calvin
Due to the reasons explained by WebbedIT, the best thing to do is just
use admin routing. At the minimum, the models used by your admin and
end-user "apps" are going to be nearly identical, if not the behaviors/
views/elements/helper/controllers/components as well. So it just
doesn't make sense building two separate applications, especially when
Cake makes it so easy to build a separate admin area with Auth and
admin routing.

On May 19, 3:55 am, WebbedIT  wrote:
> I am currently developing a large app which needed an area for the
> site owner to administrate the site, another area for organisations to
> administer their content and an area for standard site users to
> register and maintain their profiles.
>
> At first I thought it was sensible to do 3 apps on seperate sub-
> domains but you soon realise that you end up duplicating a lot of code
> and when you make a structural or cosmetic change it becomes a lot
> more work to replicate it across the 3 sites.  Didn;t take me too long
> to integrate all 3 sites into the one app and it's so much better now.
>
> My vote, use routing or whatever other method you want but keep it all
> in the same app.
>
> HTH
>
> Paul.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


User errors and fat model, skinny controller

2010-05-17 Thread calvin
So since I've started trying to implement the fat model, skinny
controller MVC pattern, I've continuously run into one issue--the
problem of dealing with user errors.

Fat model, skinny controller is great as it predisposes developers
towards a top-down development style that produces self-documenting
and more maintainable code. But I've found that, the more I try to
move the business logic to the model, the harder it is for me to
display detailed error messages or otherwise alter the view in
response to different use cases.

For example, if one is trying to write an action that allows the user
to upload a sales report, you could write something like:
function upload() {
if (!empty($this->data) {
 if ($this->Report->upload($this->data) {
 $this->Session->flash('Sales report uploaded and
processed.');
 $this->redirect(...);
 } else {
 $this->Session->flash('Sales report could not be
processed.');
 }
}
}

And in Report::upload() you might save the uploaded file and process
the sales data it contains.

But what if the file was successfully uploaded, but could not be
processed for some reason? E.g. how do you tell the user that the file
uploaded correctly, but its contents are incorrect? Or how do you tell
the user that the file uploaded correctly, but one of the products
referenced by the sales report is not in the database and must be
added first?

Has anyone else encountered this problem? How have others overcome it?
Do you throw lots of exceptions or just return an array that includes
error/status info?

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

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


Re: A little complexed find()

2010-05-16 Thread calvin
That doesn't necessarily break convention. If he is storing additional
data in the join table, then Cake's automatic joins via the HABTM
relationship don't work so well. In that case, he's better off just
manually joining the tables through two sets of hasMany/belongsTo
relationships as per the cookbook (http://book.cakephp.org/view/85/
Saving-Related-Model-Data-HABTM). And in that case, GroupMembership is
a very appropriate model name and is more descriptive than UsersGroup.

Even if you decide to stick with the HABTM relationship, it's still
sometimes appropriate to give the "join model" a natural name. This
makes the functional role of that model (e.g. semantic relationships
to other models) much more obvious and intuitive. Using model names
like UsersGroup or UsersUsers or ContractorsCompany is much less
intuitive than simply naming them Membership or Friendship or
Contract. And if you define your problem domain or business objects
incorrectly, then you're going to end up with much bigger problems
than simply the hassles of manually specifying join tables.

On May 16, 2:28 am, WebbedIT  wrote:
> Surrender to conventions, it will make your life so much easier in the
> long run!  I.e. call your joinModel GroupsUser (table: groups_users)
> rather than GroupsMembership.
>
> Try:
>
> // fetch array of group ids
> $groups = $this->User->GroupsUser->find('list', array(
>   'fields'=>array('GroupsUser.group_id', 'GroupsUser.group_id'),
>   'conditions'=>array('GroupsUser.user_id'=>$user_id)
> ));
>
> // find related posts
> $posts = $this->User->GroupsUser->Group->GroupPost->find('all', array(
>   'conditions'=>array('GroupPost.group_id'=>$groups)
> ));
>
> HTH
>
> Paul
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


  1   2   >