Sunday, October 31, 2010

Problem with deleting cache from app_controller / model

I have a core few functions that add / edit / delete records in app_controller.

 

Now when I add / edit / delete a record it will not delete the cached file. I even tried using the afterSave() afterDelete() in the respective model for each, even hardcoded the

Cache::delete( ‘all_tests’, 'week'); but nothing seems to delete these files.

 

I am able to make a cached record from app_model but cant delete them from app_

 

Is there a reason it will not work in app_? Something I am missing?

 

Dave

Adding new items to a form dynamically

So, here is my situation. I have a form that allows users (only
admins) to upload images for a specific product. What I have created
is a solution that when they load the add form initially it has one
file upload and one caption text box. However, they can click a button
lower down, that dynamically adds another file upload and another
caption box, so they can essentially upload however many images they
want to at a time.

Here is the code that I have:

images_controller.php
function add($productID = NULL)
{
if ($this->RequestHandler->isPost())
{
$slug = $this->Session->read('ProductSlug');

if ($this->Image->saveAll($this->data))
{
$this->Session->setFlash('Images have been added to the product.');

$this->redirect('/product/' . $slug);
$this->exit();
}
}
else
{
$this->Session->write('ProductID', $productID);
$this->Session->write('ImageCounter', 0);
}
}

function moreImages()
{
if ($this->RequestHandler->isAjax())
{
$images = $this->Session->read('ImageCounter');
$images++;
$this->Session->write('ImageCounter', $images);

$this->render('/elements/imageAdd');
}
}

and imageAdd.ctp
$image = $this->Session->read('ImageCounter');

echo $this->Form->input('Image.' . $image . '.product_id',
array('type' => 'hidden', 'default' => $this->Session-
>read('ProductID')));

echo $this->Form->label('Image.' . $image . '.filename', 'Image:');
echo $this->Form->input('Image.' . $image . '.filename',
array('label' => false, 'type' => 'file'));

echo $this->Form->label('Image.' . $image . '.caption', 'Caption:');
echo $this->Form->input('Image.' . $image . '.caption', array('label'
=> false));

and finally the js file that adds the stuff:
$(document).ready(function() {
$('#forms img').click(function() {
$.ajax({
url: someUrl',
dataType: 'html',
success: function(data) {
$('#forms div.formInputs').append(data);
}
});
});
});

Now, what this does. When the user goes to the add form, it renders
the element imageAdd. Which creates 3 form elements, 1 hidden. Each
form element is rendered with Image.0.columnName. Then if they click
the image at the bottom, it renders another element imageAdd, but this
time the elements are all named Image.1.columnName, and so on.

Now for my issue. All of this works fine if they just add one image.
However, that clearly defeats the purpose of this. When they go to add
2 or more images, it goes to a blank screen, where even the view
source is blank. So I have no idea what's going wrong. It goes there
before the timeout that's declared in php.ini, and I've made sure that
the combined filesize is also lower then what's allowed in my php.ini.

Also, if it makes a difference, I am using MeioUpload for the file
upload behaviour. Any help on this is greatly 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Problem with a hasMany relationship

hi guys,

i'm trying to add data to a model wich have a $hasMany relationship but with no luck...

According to the cookbook, i must have in my model something like this

class User extends AppModel {

$hasMany = 'profile';

...

then in my view i use the form helper:

$this->Form->create('user');
$this->Form-Z>input('user.id);
$this->Form->input('user.username');
$this->Form->input('user.password');
$this->Form->input('profile.0.name');
$this->Form->input('profile.0.age');
...etc...

I want to save that user and that profile (in the future i want to add more profiles to one user)

so in my controler I'm doing the following:

if(!empty($this->data) {
  $this->User->saveAll($this->data);
}

...

well, the user is saved, but nothing happens with the profile... I have the models for both defined and in my database i have a foreign key in the profile table which point to user (i'm using mysql with innodb)

I'm missing something?

Hope you can help me,

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

the Form with method GET generate incorrent URL

Hi All:
I look the tutorial that Pagination for custom queries
(http://bakery.cakephp.org/articles/shird10/2010/08/29/pagination-for-
custom-queries
)

I can search the data by use URL (example.com/forums/viewtopic/x/y/
page:2
)
But I want to use Form(method is GET) to generate the url

<!-- ------search------ -->
<?php echo $this->Form-
>create('Order',array('action'=>'index','type'=>'get'));?>
<?php echo $this->Form->input('x'); ?>
<?php echo $this->Form->input('y'); ?>
<?php echo $this->Form->end(__('submit', true));?>
<!-- ------search------ -->

I press the summit button , I get the url is :
example.com/forums/viewtopic?x=AAAAAAA&y=BBBBBB

not example.com/forums/viewtopic/x/y/page:2
How to create the above Url by Form and method is GET

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: need help with form

no the model is result....

The idea is that I have an action called person.... this action takes
url params to find results by the person. So I am trying to create a
form that will direct to that action with the params based on the
input from the form....

On Oct 31, 9:21 pm, cricket <zijn.digi...@gmail.com> wrote:
> On Sun, Oct 31, 2010 at 8:55 PM, Briko03 <nathanrlar...@gmail.com> wrote:
> > Does that mean that I can have a view that does not have a
> > corresponding action?
>
> > How would i get the form to use person and the values from the input?
>
> > Sorry for the newb questions...
>
> I don't understand the question, actually. By "person" do you mean the
> model? You can do:
>
> echo $this->Form->create('Person', array(...));

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: need help with form

On Sun, Oct 31, 2010 at 8:55 PM, Briko03 <nathanrlarkin@gmail.com> wrote:
> Does that mean that I can have a view that does not have a
> corresponding action?
>
> How would i get the form to use person and the values from the input?
>
> Sorry for the newb questions...

I don't understand the question, actually. By "person" do you mean the
model? You can do:

echo $this->Form->create('Person', array(...));

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: need help with form

Does that mean that I can have a view that does not have a
corresponding action?

How would i get the form to use person and the values from the input?

Sorry for the newb questions...

On Oct 31, 8:19 pm, cricket <zijn.digi...@gmail.com> wrote:
> On Sun, Oct 31, 2010 at 5:48 PM, Briko03 <nathanrlar...@gmail.com> wrote:
> > Here is my view:
>
> > <?php
> > echo $form->create('Result', array('action' => 'findperson'));
> > echo $form->input('lname');
> > echo $form->input('fname');
>
> > echo $form->submit();
> > echo $form->end();
> > ?>
>
> > Here is the action:
>
> > function findperson()
> >           {
> >                if (!empty($this->data)) {
> >                        $this->redirect(array('action' => 'person'));
> >                        }
> >                }
> >        //I want to append this to the redirect - $this->data['Result']
> > ['lname']
>
> > I am kind of stuck at the moment and not sure what I am doing
> > wrong....
>
> Don't redirect as that creates an entirely new request. You could use
> setAction() instead.
>
> But I think you need to ask yourself whether this is really the best
> way to do this. findPerson() doesn't seem to do a lot of finding at
> all. So why bother? Couldn't you simply go directly to person()?
>
> > Right now when i click submit i just get a blank white screen.
>
> Probably a fatal error. Set debug to 2 and/or check your server log.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: need help with form

On Sun, Oct 31, 2010 at 5:48 PM, Briko03 <nathanrlarkin@gmail.com> wrote:
> Here is my view:
>
> <?php
> echo $form->create('Result', array('action' => 'findperson'));
> echo $form->input('lname');
> echo $form->input('fname');
>
> echo $form->submit();
> echo $form->end();
> ?>
>
>
> Here is the action:
>
> function findperson()
>           {
>                if (!empty($this->data)) {
>                        $this->redirect(array('action' => 'person'));
>                        }
>                }
>        //I want to append this to the redirect - $this->data['Result']
> ['lname']
>
> I am kind of stuck at the moment and not sure what I am doing
> wrong....

Don't redirect as that creates an entirely new request. You could use
setAction() instead.

But I think you need to ask yourself whether this is really the best
way to do this. findPerson() doesn't seem to do a lot of finding at
all. So why bother? Couldn't you simply go directly to person()?


> Right now when i click submit i just get a blank white screen.

Probably a fatal error. Set debug to 2 and/or check your server log.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: New to MVC

On Sun, Oct 31, 2010 at 6:18 PM, Giorgio <anothernetfellow@gmail.com> wrote:
> Thankyou Cricket for your kind reply! I'll try to give more details about
> the part of my application i'm trying to rewrite with cakephp.
>
> 1 - In a form, an user inserts a youtube link and click on submit
> 2 - My application handles the input and
> 2.1 - Gets, from youtube api, details of that video and stores them in a db
> (get_video_details() + a connection to the DB to store data)
> 2.2 - Creates a short url and saves it into the db (shorten_url() + a
> connection to the db to store data)
> 3 - Outputs a confirmation page with the video embedded in it

So creating the Bit.ly link is just one part of the request. In that
case, go with a component. Save the the shortened URL the component
returns to the controller into the DB and include it with whatever
else you're responding back to the client.

> As you can see, this is very simple. I just need to understand where i have
> to put those "workers", those functions.

It looks like both the YT and Bit.ly stuff should be handled by a
component (but more on that below).

> Do you confirm that a component is a library in the Vendors directory?

No. A component is a class that your controller uses. They can either
be inside the app/controllers/components or the
app/plugin/your_plugin/controllers/components dirs. The latter would
be for a component that is used solely for that plugin, whereas the
former could be loaded by any of your other app's controllers. An
example of that would be your own EmailComponent, an image handler,
submitted html content cleaning, etc. Anything that doesn't require a
full-blown plugin (eg. needs a model, controller, component, etc.) but
that could be used by one or more of your controllers is a good
candidate for a component.

Vendors, OTOH, are classes, or collection of classes, that are not
written with the Cake framework. Things like the YouTube API,
PHPThumb, etc. The way that you load them is with with App::import().
To use a vendor package with your own component you'd do something
like:

-- snip --
App::import('Vendor','HTMLPurifier'
,array('file'=>'htmlpurifier'.DS.'library'.DS.'HTMLPurifier.auto.php'));

class PurifierComponent extends Object
{
-- snip --

Basically, you want to load whatever class is necessary to use the
package. Here, the component acts a wrapper of, or interface to, the
vendor package. So you'd include some methods for accessing the vendor
class' methods with your controller.

> And,
> sorry, i was using the wrong words in the first post. I didn't want to
> create a controller to substitute my 2 functions (shorten_url and
> just_shorten_url), but 2 actions. Right now, the shorten_url function calls
> just_shorten_url, gets the shortened url and puts them in the db. I have a
> basic function, that makes api calls and returns a shorten url and another
> function that uses this basic functions and does more things on its output.
> Can i have something like this with actions?

You certainly could do that. But I think it'd be better to use a
component and have that return the result tothe controller, which
would then save to the DB and set vars for the view. So you could do
something like:

$shortened = $this->Bitly->shorten($this->data['YourModel']['url'];

Where $this->Bitly refers to your own BitlyComponent.

I hope that makes sense. I gotta go stir my chili!

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: New to MVC

Thankyou Cricket for your kind reply! I'll try to give more details about the part of my application i'm trying to rewrite with cakephp.

1 - In a form, an user inserts a youtube link and click on submit
2 - My application handles the input and
2.1 - Gets, from youtube api, details of that video and stores them in a db (get_video_details() + a connection to the DB to store data)
2.2 - Creates a short url and saves it into the db (shorten_url() + a connection to the db to store data)
3 - Outputs a confirmation page with the video embedded in it

As you can see, this is very simple. I just need to understand where i have to put those "workers", those functions.

With Cake, one usually wouldn't echo back a simple string unless it
was an AJAX request, in which case you'd use an AJAX layout, which
simply echoes your value (no html, head, body, etc.) and, possibly, an
AJAX view. But that's not a hard and fast rule (I cheat sometimes and
simply echo).

Yeah right i was saying echo to make things simplier for you, of course i'm using an HTML output in the view.
 

However (and this really depends on what you're trying to do), I think
it'd be simplest to create a component that created the URL. What's
your use case? I mean, would it make sense to provide the URL to be
shortened within some other controller's form? If that were the case,
you could load the component in that controller, pass off the
submitted URL to it, and receive back the shortened version, which
you'd then save with your other data. Unless the only point is to
submit a single URL, and it's not part of some other model's data. If
that's the case, maybe a controller is the correct way forward. But
you wouldn't need 2 controllers. Just create actions for each ...
action you want to provide.

Do you confirm that a component is a library in the Vendors directory? And, sorry, i was using the wrong words in the first post. I didn't want to create a controller to substitute my 2 functions (shorten_url and just_shorten_url), but 2 actions. Right now, the shorten_url function calls just_shorten_url, gets the shortened url and puts them in the db. I have a basic function, that makes api calls and returns a shorten url and another function that uses this basic functions and does more things on its output. Can i have something like this with actions?
 

Googling "cakephp bit.ly" shows there are a few existing components
and at least one helper out there. Perhaps you should take a look at
how those were created for ideas (or just use one of them).

That's really interesting, i'll have a look.
 
Thankyou again!

Giorgio
 



--
--
AnotherNetFellow
Email: anothernetfellow@gmail.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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

need help with form

Here is my view:

<?php
echo $form->create('Result', array('action' => 'findperson'));
echo $form->input('lname');
echo $form->input('fname');

echo $form->submit();
echo $form->end();
?>


Here is the action:

function findperson()
{
if (!empty($this->data)) {
$this->redirect(array('action' => 'person'));
}
}
//I want to append this to the redirect - $this->data['Result']
['lname']

I am kind of stuck at the moment and not sure what I am doing
wrong....

Right now when i click submit i just get a blank white screen. I would
like the form to take the values of fname and lname and append them to
my url.....

for example...

results/person/lname/fname

Any code/help would be 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: New to MVC

On Sun, Oct 31, 2010 at 9:35 AM, AnotherNetFellow
<anothernetfellow@gmail.com> wrote:
> Hi,
>
> i'm a Python developer, and have worked on small PHP projects. A few
> months ago i've started looking at the MVC model, and have used
> CakePHP for some simple database applications (AddressBook and a
> stupid "crawler").
>
> Now i'm working to an application that uses both Facebook, Youtube and
> Bit.ly APIs. I've read your documentation about the "vendors"
> directory, but am still confused, so i'm asking for help in this
> mailing list. I'll really appreciate any type of help. Thanks. Now let
> me explain:
>
> In my old application I have the bit.ly library that has 2 main
> functions: just_shorten_url and shorten_url. The first function
> creates a short URL and saves it in the db (with an indipendent mysql
> connection) and the first one just creates and print a short url,
> given the long one. In that application i simply include_once the
> library file and then use that functions.
>
> With cakephp, if i'm right, using just_shorten_url is not so
> difficult: just create a view with the form where you can insert the
> long one and a controller where, with my library, the short url gets
> created. Now, what about printing the created url to the user's
> screen? I know I can create a new view where the controller will POST
> data to display, but maybe there is a cleaner way to do this (direct
> output from the controller?). Can you help me?
>
> Using shorten_url (the function that also writes to the db) is more
> difficult: yes, of course i can use it as just_shorten_url and work on
> the database "manually" (the library creates a connection and executes
> queries), but, as i'm using such a powerful framework, why not to use
> it also here? I think the best way to do that is completely remove
> database connections and queries from my library and put everything in
> the controller. The controller gets the long url, with shorten_url
> creates a short one then puts it into the DB.
>
> Well, at this point there is the last problem. At this point i will
> have 2 controllers: one, that creates and output a short url and
> another one, that creates a short url, output it and adds it to the
> DB. So i have almost the same code 2 times in my app. How can i make
> controllers interacting between them? I mean: a controller that
> creates and output the short url that, if needed saves it on the db.

With Cake, one usually wouldn't echo back a simple string unless it
was an AJAX request, in which case you'd use an AJAX layout, which
simply echoes your value (no html, head, body, etc.) and, possibly, an
AJAX view. But that's not a hard and fast rule (I cheat sometimes and
simply echo).

If this isn't an AJAX request, you'd probably be best to redirect
somewhere else and, if you wanted to display the bit.ly-ized URL in
/that/ view, you'd fetch it from the DB in that view's controller
before displaying.

However (and this really depends on what you're trying to do), I think
it'd be simplest to create a component that created the URL. What's
your use case? I mean, would it make sense to provide the URL to be
shortened within some other controller's form? If that were the case,
you could load the component in that controller, pass off the
submitted URL to it, and receive back the shortened version, which
you'd then save with your other data. Unless the only point is to
submit a single URL, and it's not part of some other model's data. If
that's the case, maybe a controller is the correct way forward. But
you wouldn't need 2 controllers. Just create actions for each ...
action you want to provide.

Googling "cakephp bit.ly" shows there are a few existing components
and at least one helper out there. Perhaps you should take a look at
how those were created for ideas (or just use one of them).

Bottom line: creating even one controller for this is overkill if the
shortened URL "belongs" to some other model data. Let that model's
controller deal with it (by way of your component).

I suggest you also have a look around for FB & YT components/plugins
for Cake that others may have created, if only to get a good grounding
in how Cake works. And you could always use those as a basis for
creating your own. Beware, though, that Cake has changed somewhat
since 1.2.x (and A LOT since 1.1.x) so pay close attention to dates,
if any, included with anything you read online, as well as the
information on this page:

http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Acl and bindNode

Guess I dont get your point.

Users still must de added on Aro's table, otherwise how would your
system know that an user A belongs to group ALFA ?

On 29 out, 08:23, Jeremy Burns | Class Outfit
<jeremybu...@classoutfit.com> wrote:
> Anybody else got any more ideas on this? Anyone using it with success?
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.com
> (t) +44 (0) 208 123 3822
> (m) +44 (0) 7973 481949
> Skype: jeremy_burnshttp://www.classoutfit.com
>
> On 27 Oct 2010, at 17:10, Jeremy Burns | Class Outfit wrote:
>
>
>
> > I wish that were the case, but the guide then gives an example of the aros table, which only includes groups:http://book.cakephp.org/view/1547/Acts-As-a-Requester
>
> > Jeremy Burns
> > Class Outfit
>
> > jeremybu...@classoutfit.com
> >http://www.classoutfit.com
>
> > On 27 Oct 2010, at 13:41, cricket wrote:
>
> >> On Tue, Oct 26, 2010 at 4:40 PM, Jeremy Burns
> >> <jeremybu...@classoutfit.com> wrote:
> >>> According to the online tutorial:
>
> >>> "
> >>> In case we want simplified per-group only permissions, we need to
> >>> implement bindNode() in User model.
> >>> Code View
>
> >>> function bindNode($user) {
> >>>    return array('Group' => array('id' => $user['User']['group_id']));
> >>> }
>
> >>>   function bindNode($user) {
> >>>      return array('Group' => array('id' => $user['User']
> >>> ['group_id']));
> >>>   }
>
> >>> This method will tell ACL to skip checking User Aro's and to check
> >>> only Group Aro's.
> >>> "
>
> >>> I've done this but I'm still getting users added to the aros table.
> >>> What am I missing?
>
> >> I believe that's normal. Users will still be present in aros but the
> >> point is that ACL won't /check/ User, but 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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: repeated URL

On Sun, Oct 31, 2010 at 8:23 AM, matsakaw <igebaste2@gmail.com> wrote:
> example: say my site is http://abc.domain.com/app
> it has a user's login method in users controller. but when a user logs
> in to the site, the URL becomes http://abc.domain.com/app/http:/abc.domain.com
> producing a Not Found Error : The requested address 'http:/
> abc.domain.com' was not found on this server.
> Nevertheless, all the menus i have can be subsequently called, only
> the initial page after login produces that error.
>
> any ideas how to avoid this?  what term should i google to understand
> what is causing the repeated URL?
>
> i am using cake 1.2. it is web hosted using ISPConfig.

You'll need to provide more info. What does your Auth config look
like? What does your login have in it? Are you using mod_rewrite? Have
you checked what headers the server is returning?

Also, why do you have app in the URL in the first place? Why not set
app to be the webserver's root?

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Choosing CakePHP version

If you are starting from scratch, 1.3 doesn't really offer much new to
learn so I would start from there. Lots of improvements that don't
require you to learn anything made their way into the core of 1.3.

On Oct 30, 10:01 pm, Santiago Basulto <santiago.basu...@gmail.com>
wrote:
> Hello people,
>
> i'm starting a new Project. I've developed a site with CakePHP 1.2 and
> wanted to know if it's worth to use 1.3, due to the imminent release
> of 2.0 in some time.
>
> What i mean with "worth". If i have to learn several new things that
> will change again with 2.0, and the new stuff will not give me too
> much benefits, i don't think it worths.
>
> I can develop it with the 1.2 version with no problems at all.
>
> --
> Santiago Basulto.-

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Joins Question

Hi Dave,

Use this condition where B.a_id!=C.a_id

Enjoy,

Amit

On Sun, Oct 31, 2010 at 6:23 PM, Dave Maharaj <me@davemaharaj.com> wrote:

Can anyone help me with a join that looks like this. Or if it is even possible…..

 

ModelA hasMany ModelB, ModelC

Model B and ModelC belongto ModelA

 

So ModelB is related by a_id and ModelC by a_id pretty standard stuff.

 

So records in B or C are optional and can be in both B and C or none or eiter one, but if in C then exclude it from the record…..nasty.

 

So get all A records when in B.a_id but not if also in C.a_id (never get B.a_id if its also in C.a_id)

 

Please no contain answers as that's what I am doing now but because of getting empty array keys and unsetting and paging I would like to see if the joins would be best.

 

Thanks guys.

 

Dave

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

New to MVC

Hi,

i'm a Python developer, and have worked on small PHP projects. A few
months ago i've started looking at the MVC model, and have used
CakePHP for some simple database applications (AddressBook and a
stupid "crawler").

Now i'm working to an application that uses both Facebook, Youtube and
Bit.ly APIs. I've read your documentation about the "vendors"
directory, but am still confused, so i'm asking for help in this
mailing list. I'll really appreciate any type of help. Thanks. Now let
me explain:

In my old application I have the bit.ly library that has 2 main
functions: just_shorten_url and shorten_url. The first function
creates a short URL and saves it in the db (with an indipendent mysql
connection) and the first one just creates and print a short url,
given the long one. In that application i simply include_once the
library file and then use that functions.

With cakephp, if i'm right, using just_shorten_url is not so
difficult: just create a view with the form where you can insert the
long one and a controller where, with my library, the short url gets
created. Now, what about printing the created url to the user's
screen? I know I can create a new view where the controller will POST
data to display, but maybe there is a cleaner way to do this (direct
output from the controller?). Can you help me?

Using shorten_url (the function that also writes to the db) is more
difficult: yes, of course i can use it as just_shorten_url and work on
the database "manually" (the library creates a connection and executes
queries), but, as i'm using such a powerful framework, why not to use
it also here? I think the best way to do that is completely remove
database connections and queries from my library and put everything in
the controller. The controller gets the long url, with shorten_url
creates a short one then puts it into the DB.

Well, at this point there is the last problem. At this point i will
have 2 controllers: one, that creates and output a short url and
another one, that creates a short url, output it and adds it to the
DB. So i have almost the same code 2 times in my app. How can i make
controllers interacting between them? I mean: a controller that
creates and output the short url that, if needed saves it on the db.

Thanks so much.

Giorgio

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Joins Question

Can anyone help me with a join that looks like this. Or if it is even possible…..

 

ModelA hasMany ModelB, ModelC

Model B and ModelC belongto ModelA

 

So ModelB is related by a_id and ModelC by a_id pretty standard stuff.

 

So records in B or C are optional and can be in both B and C or none or eiter one, but if in C then exclude it from the record…..nasty.

 

So get all A records when in B.a_id but not if also in C.a_id (never get B.a_id if its also in C.a_id)

 

Please no contain answers as that’s what I am doing now but because of getting empty array keys and unsetting and paging I would like to see if the joins would be best.

 

Thanks guys.

 

Dave

repeated URL

example: say my site is http://abc.domain.com/app
it has a user's login method in users controller. but when a user logs
in to the site, the URL becomes http://abc.domain.com/app/http:/abc.domain.com
producing a Not Found Error : The requested address 'http:/
abc.domain.com' was not found on this server.
Nevertheless, all the menus i have can be subsequently called, only
the initial page after login produces that error.

any ideas how to avoid this? what term should i google to understand
what is causing the repeated URL?

i am using cake 1.2. it is web hosted using ISPConfig.

thanks for any leads

matsakaw

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Saturday, October 30, 2010

Re: current page info

you can create links in elements and do some checking to identify the
current controller and action. it's $this->params variable

On Oct 31, 6:49 am, grandioso <something.like.a.phenome...@gmail.com>
wrote:
> I feel really stupid for asking this, but I'm just noob baker, so...
> How do I add a "selected" class to a menu item that points to the
> current page and how do I create a title for the current page ?
>
> I created a default layout, and all the pages. Then I created the
> routes in 'app/config/routes.php' like "Router::connect('/contact',
> array('controller' => 'pages', 'action' => 'display', 'contact'));".
> It works just fine, but I have no idea how to add "selected" to the
> currently selected menu item and how to create a custom title for the
> page.
>
> It would be great if I could just pass the "title" and "selected"
> string in this array.
> Is it possible t

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Choosing CakePHP version

Hello people,

i'm starting a new Project. I've developed a site with CakePHP 1.2 and
wanted to know if it's worth to use 1.3, due to the imminent release
of 2.0 in some time.

What i mean with "worth". If i have to learn several new things that
will change again with 2.0, and the new stuff will not give me too
much benefits, i don't think it worths.

I can develop it with the 1.2 version with no problems at all.

--
Santiago Basulto.-

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: current page info

On Sat, Oct 30, 2010 at 8:16 PM, cricket <zijn.digital@gmail.com> wrote:
> On Sat, Oct 30, 2010 at 6:49 PM, grandioso
> <something.like.a.phenomenon@gmail.com> wrote:
>> I feel really stupid for asking this, but I'm just noob baker, so...
>> How do I add a "selected" class to a menu item that points to the
>> current page and how do I create a title for the current page ?
>>
>> I created a default layout, and all the pages. Then I created the
>> routes in 'app/config/routes.php' like "Router::connect('/contact',
>> array('controller' => 'pages', 'action' => 'display', 'contact'));".
>> It works just fine, but I have no idea how to add "selected" to the
>> currently selected menu item and how to create a custom title for the
>> page.
>>
>> It would be great if I could just pass the "title" and "selected"
>> string in this array.
>> Is it possible ?
>
> $this->set('title_for_layout', 'some title');
>
> I have this in AppController:
>
> protected function _setPageTitle($title)
> {
>        $title = 'some default text' . (!empty($title) ? " &bull; ${title}" : null);
>        $this->set('title_for_layout', $title);
> }

I forgot to add that this is also in AppController:

function beforeRender()
{
parent::beforeRender();

if (!isset($this->viewVars['title_for_layout']))
{
/* set default title
*/
$this->_setPageTitle();
}
}

and it's:

protected function _setPageTitle($title = null) { ... }

That way, I get the default if I forget to call the method inside some
action. Cake will set the var if you don't, based on the model name,
but that's not always what you might want.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: current page info

On Sat, Oct 30, 2010 at 6:49 PM, grandioso
<something.like.a.phenomenon@gmail.com> wrote:
> I feel really stupid for asking this, but I'm just noob baker, so...
> How do I add a "selected" class to a menu item that points to the
> current page and how do I create a title for the current page ?
>
> I created a default layout, and all the pages. Then I created the
> routes in 'app/config/routes.php' like "Router::connect('/contact',
> array('controller' => 'pages', 'action' => 'display', 'contact'));".
> It works just fine, but I have no idea how to add "selected" to the
> currently selected menu item and how to create a custom title for the
> page.
>
> It would be great if I could just pass the "title" and "selected"
> string in this array.
> Is it possible ?

$this->set('title_for_layout', 'some title');

I have this in AppController:

protected function _setPageTitle($title)
{
$title = 'some default text' . (!empty($title) ? " &bull; ${title}" : null);
$this->set('title_for_layout', $title);
}

And, inside any action:

$this->_setPageTitle('whatever');

Of course, it'd be simple enough to replace the default text with
whatever is passed in, if you'd rather that.

For the nav, there are probably dozens of ways to do it, including on
the client side. Here's one example that I've used a couple of times,
both Cake and non-Cake:

<div id="nav">
<ul>
<?php
$links = array(
'news' => array(
'text' => 'news',
'route' => array('controller' => 'news', 'action' => 'index', 'admin' => 0),
'attr' => array('title' => 'news')
),
'catalog' => array(
'text' => 'catalog',
'route' => array('controller' => 'parts', 'action' => 'index', 'admin' => 0),
'attr' => array('title' => 'parts catalog')
),
'contact' => array(
'text' => 'contact',
'route' => array('controller' => 'pages', 'action' => 'display',
'slug' => 'contact', 'admin' => 0),
'attr' => array('title' => 'contact us')
)
);

foreach($links as $key => $link)
{
if ($this->here == "/${key}")
{
?>
<li id="<?= "nav_${key}" ?>" class="Selected"><?= $link['text'] ?></li>
<?php
}
else
{
?>
<li id="<?= "nav_${key}" ?>"><?= $html->link($link['text'],
$link['route'], $link['attr']) ?></li>
<?php
}
}
?>
</ul>
</div>

This is only suitable, of course, if your nav isn't likely to change
too much. You could dispense with the 'text' entry and simply use the
array key, except that the link text would need to be a single word.
Either that, or use an underscore, eg. 'my_key', and use
Inflector::humanize() for the link text.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: cakephp 1.3.5 and jquery - what am i missing?

On Sat, Oct 30, 2010 at 1:10 PM, Jeff T <jeff@pre23.com> wrote:
> Hi All,
>
> I'm new to cakephp and it's clear there's something very basic that
> I'm missing.  I'm trying get jquery to work within cakephp.  I don't
> see any errors in firebug but it's clear that the js file is not
> processing, however the css file does.

Use Firebug to see if the javascript has even been loaded.

> I'm trying to get jquery working on my homepage.
>
> I have this in my default.ctp found at /vars/www/app/views/layout/
> default.ctp
>
> <link rel="stylesheet" type="text/css" href="/css/
> siteFeature.style_screen.css" />
> <?php echo $javascript->link(array('jquery-1.3.2.min.js',
> 'jquery.siteFeature.pack.js')); ?>
>
> the js files are found at:
>
> /vars/www/app/webroot/js/
>
> This is in my page_controller.php found at /vars/www/cake/libs/
> controller/pages_controller.php
>
> var $helpers = array('Html', 'Ajax', 'Session', 'Form', 'Html',
> 'Javascript', 'Time');
>
> Thank you and I hope someone can help me with this.
>
> Jeff

JavascriptHelper has been deprecated in 1.3.x so use
$this->Html->script(array('jquery-1.3.2.min',
'jquery.siteFeature.pack'));

Note that you do not include the .js extension.

Also, if you're loading the JS in your layout, you should include
HtmlHelper in AppController so it's available to all controllers. And
you have Html listed twice above, btw.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

current page info

I feel really stupid for asking this, but I'm just noob baker, so...
How do I add a "selected" class to a menu item that points to the
current page and how do I create a title for the current page ?

I created a default layout, and all the pages. Then I created the
routes in 'app/config/routes.php' like "Router::connect('/contact',
array('controller' => 'pages', 'action' => 'display', 'contact'));".
It works just fine, but I have no idea how to add "selected" to the
currently selected menu item and how to create a custom title for the
page.

It would be great if I could just pass the "title" and "selected"
string in this array.
Is it possible ?

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Empty records in database

On Sat, Oct 30, 2010 at 4:42 PM, ervin <ervin.hoxha@gmail.com> wrote:
> Ok, i think i found the origin of the problem, but not the reason or
> the solution.
>
> As i said this is an online car selling site, so every time the
> someone is viewing a car i was updating an database field calld 'view'
> to increment the number of views for this car. To do this i was using,
> in the view method of the controller :
>
> $this->Post->saveField('view', $view+1);
>
> I tried to remove this line and im not getting anymore those empty
> posts, but as i said i still have to understand why this was
> happening.

You hadn't set the model's id, so a new record is being inserted.

$this->Post->id = $id;
$this->saveField(...);

Another (I think better) way:
$this->Post->updateAll(
array('Post.view' => 'Post.view + 1'),
array('Post.id' => $id)
);

Better still:

$this->Post->increment();

function increment($id = null)
{
if (!$id) $id = $this->id;

$this->updateAll(
array('Post.view' => 'Post.view + 1'),
array('Post.id' => $id)
);
}

Even better again would be to put the updateAll() in afterFind(), so
it's done automatically. But I've yet to figure out a decent way to
differentiate between a find('first') from find('all'), as $results
are unfortunately formatted the same in either case.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Learn CakePHP

I think Adam's approach is actually a very wise one if you're not
familiar with MVC.
I only seldom work on web development projects and had tried for a
couple of times to learn cakephp without success. Then tried
CodeIgniter and it's so much easier to learn. Eventually I tried cake
again and suddenly everything made sense...

On Oct 30, 7:27 am, Adam <adamcbre...@gmail.com> wrote:
> I had only been working with PHP for a month before I started with
> frameworks. CakePHP was a little heavy to grasp at first (MVC & OOP),
> but I built a project using CodeIgniter. After that I had to do
> another one using Cake, so I had to learn and it only took a week
> before I couldn't get enough. Basically, like most have said here,
> just start, because once you learn the cool stuff you'll want to learn
> more!
>
> On Oct 28, 10:58 am, sonam <ahuja.sona...@gmail.com> wrote:
>
> > How much time is required to learn cakephp?

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: cakephp 1.3.5 and jquery - what am i missing?

instead of $javascript->link use $html->script("jquery.js");

and jquery.js should be inside app/webroot/js/ folder

--
Tilen Majerle


2010/10/30 Jeff T <jeff@pre23.com>
Hi All,

I'm new to cakephp and it's clear there's something very basic that
I'm missing.  I'm trying get jquery to work within cakephp.  I don't
see any errors in firebug but it's clear that the js file is not
processing, however the css file does.

I'm trying to get jquery working on my homepage.

I have this in my default.ctp found at /vars/www/app/views/layout/
default.ctp

<link rel="stylesheet" type="text/css" href="/css/
siteFeature.style_screen.css" />
<?php echo $javascript->link(array('jquery-1.3.2.min.js',
'jquery.siteFeature.pack.js')); ?>

the js files are found at:

/vars/www/app/webroot/js/

This is in my page_controller.php found at /vars/www/cake/libs/
controller/pages_controller.php

var $helpers = array('Html', 'Ajax', 'Session', 'Form', 'Html',
'Javascript', 'Time');

Thank you and I hope someone can help me with this.

Jeff

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Empty records in database

Ok, i think i found the origin of the problem, but not the reason or
the solution.

As i said this is an online car selling site, so every time the
someone is viewing a car i was updating an database field calld 'view'
to increment the number of views for this car. To do this i was using,
in the view method of the controller :

$this->Post->saveField('view', $view+1);

I tried to remove this line and im not getting anymore those empty
posts, but as i said i still have to understand why this was
happening.


On Oct 28, 12:54 pm, AD7six <andydawso...@gmail.com> wrote:
> On Oct 25, 11:56 pm, ervin <ervin.ho...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > i've used cake for several websites and i never had such a problem.
>
> > Now one of my websites is an online car selling website when users can
> > signup and post their cars for sale.
>
> > It's about a couple of weeks that every day i find some empty posts
> > (empty DB records) in my web site. Normally this should not be
> > possible as, of course, i have an ACL control over the methods that
> > are accessible to the users. Also when a user posts something this is
> > stored in th DB along with the user id and for those posts the user id
> > is set to 0.
> > I have also tried to log the ip of the user that inserts a post
> > through the add action but for those posts the ip is empty.
> > So im quite sure that those records are not coming through the add
> > method
>
> why don't you put your tracking in the model. e.g.
>
> function beforeSave() {
>  if (!array_filter($this->data[$this->alias])) {
>   $this->log($_SERVER);
>   $this->log(Debugger::trace());
>  }
>  return true;
>
> }
>
> Most likely the symptoms you describe stem from an application error.
>
> AD

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

cakephp 1.3.5 and jquery - what am i missing?

Hi All,

I'm new to cakephp and it's clear there's something very basic that
I'm missing. I'm trying get jquery to work within cakephp. I don't
see any errors in firebug but it's clear that the js file is not
processing, however the css file does.

I'm trying to get jquery working on my homepage.

I have this in my default.ctp found at /vars/www/app/views/layout/
default.ctp

<link rel="stylesheet" type="text/css" href="/css/
siteFeature.style_screen.css" />
<?php echo $javascript->link(array('jquery-1.3.2.min.js',
'jquery.siteFeature.pack.js')); ?>

the js files are found at:

/vars/www/app/webroot/js/

This is in my page_controller.php found at /vars/www/cake/libs/
controller/pages_controller.php

var $helpers = array('Html', 'Ajax', 'Session', 'Form', 'Html',
'Javascript', 'Time');

Thank you and I hope someone can help me with this.

Jeff

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: 2 database, 1 models and controllers, many views

Assuming both sites are on the same server you could bootstrap your
controller and model paths so that you only need to maintain one
version of your logic:

for cake 1.2.x by using $controllerPaths and $modelPaths settings
for cake 1.3.x by using
App::build(array(
'models' => array('/full/path/to/models/', '/next/full/path/to/
models/'),
'controllers' => array('/full/path/to/controllers/', '/next/full/
path/to/controllers/')
));


You should probably also keep your cake core files in one location for
both sites by updating your CAKE_CORE_INCLUDE_PATH constant in webroot/
index.php see the advanced installation docs:
http://book.cakephp.org/view/915/Advanced-Installation

hope this helps

On Oct 29, 4:06 am, Zaky Katalan-Ezra <procsh...@gmail.com> wrote:
> 1. Use themes for two different designs
> 2. Use some sync software like rsync to update one of the sites controllers,
> models.
> 2.1 if both sites on the same server you can use symlink/hardlink (in linux)
> for controller and models in on of the sites
> 3. Set each site with its default theme.
>
> Another idea is to use some prefix for one of the sites like admin prefix.
> In the controller call in each prefix action for the default action .
> function site2_edit()
> {
>    edit();
>
> }
>
> I am not sure but I think you can change the domain name for each prefix in
> the apache level.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Friday, October 29, 2010

Using the same validation method for create and update modes

Hello, I thought I was being clever by defining a custom validation
method called validateUploadedFileExtensions which accepts a couple or
parameters. In my Image model's validation I would then reuse this
method for two rules for a model's field, like this:
'image' => array(
'imageExtension' => array(
'rule' => array('validateUploadedFileExtensions', 'image', true),
'message' => 'Invalid image extension',
'last' => false,
'on' => 'create'
),
'imageExtension' => array(
'rule' => array('validateUploadedFileExtensions', 'image', false),
'message' => 'Invalid image extension',
'last' => false,
'on' => 'update'
),
...

But, if I'm validating a collection of Image models as children to a
parent object, and some of the images are new (validating by create)
and some are updates (validating by update), only the validation for
creates are called. Is this a bug, or did they never intend for the
same validation method to be re-used like this?

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Learn CakePHP

I had only been working with PHP for a month before I started with
frameworks. CakePHP was a little heavy to grasp at first (MVC & OOP),
but I built a project using CodeIgniter. After that I had to do
another one using Cake, so I had to learn and it only took a week
before I couldn't get enough. Basically, like most have said here,
just start, because once you learn the cool stuff you'll want to learn
more!

On Oct 28, 10:58 am, sonam <ahuja.sona...@gmail.com> wrote:
> How much time is required to learn cakephp?

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: The Biggest Social Network site...

skype?


Atenciosamente,

Alexsandro André
Joinville - SC
47-8825-0133


2010/10/29 Alok Mishra <aloksoft2004@gmail.com>
Very intersting work in social networking site

On Fri, Oct 29, 2010 at 10:57 PM, chris69m@yahoo.com <chris69m@yahoo.com> wrote:
Hello all,...

I have a beautiful START with a this BIGGEST Social site I have
dreamed of. Half way thru,... can't finish it. I'm just a beginner,
and have plans to create the BIGGEST ever social site on the Net...
lol, with plans and strategies that CAN bring more Business to your
pocket. ... Looking for 3-4 motivated coders to join a Network,... and
work on this OPEN project. Each one of us will have a access to same
server, same TESTING domain,... we will share the ideas and feature
development... Here is the testing site URL http://www.zippopeople.com

please send me an email if you are interested in... and we will
contact in skype.

Thanks
Salute
Chris

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en



--
Alok Mishra
Software Engg.
A1 Technology Inc Chandigarh Mohali.
Mobile@9569881400
aloksoft2004@gmail.xom



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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Sent mails don't arrive in Outlook Exchange mailboxes!

From my experience in dealing with our Exchange administrator, any
emails that are dynamically created and "faked" (send an email from
someone@business.com when the domain the message is sent is not from
the business.com network) is automatically blocked and marked as spam.
This is a huge spam preventative measure. Unfortunately it works well.
They typically refuse to disable this, and also typically refuse to
allow an external domain access to send to them.

An alternative solution would be to send the email as
"donotreply@example.com" (replace "example.com" with your own domain)
and try setting the "Reply To" header so that a reply will go to the
intended party that created the email from your service.

I haven't personally tried this yet, but as long as Exchange will
honor the "reply to" header (I don't see why not), then it should be
OK.


On Oct 29, 8:13 am, Joshua Muheim <psybea...@gmail.com> wrote:
> OK, thanks for your feedback, Jeremy.
>
> On Fri, Oct 29, 2010 at 1:08 PM, Jeremy Burns | Class Outfit
>
> <jeremybu...@classoutfit.com> wrote:
> > I have had a similar experience where emails are generally sent perfectly, but are not received by staff who work for the client company (those who share the same email address domain as the address used to send the emails). I know they are sent because I am bcc'd, but they don't get them. It seems as if it is a problem outside of Cake/PHP and more likely an internal mail server issue. We are trying to track this one down at the moment and I will feedback anything we discover.
>
> > Jeremy Burns
> > Class Outfit
>
> > jeremybu...@classoutfit.com
> >http://www.classoutfit.com
>
> > On 29 Oct 2010, at 07:04, psybear83 wrote:
>
> >> Hey everybody
>
> >> I noticed that mails sent using the Email component (without using
> >> SMTP or stuff) don't arrive at my office's email, which is run using
> >> Outlook Exchange. When sending to my private email provider, it works
> >> flawlessly.
>
> >> I guess it could have something to do that Outlook has a stricter
> >> policy or something and thinks my mails are automatically generated
> >> spam or something. How can I track this down?
>
> >> Thanks a lot for advice
> >> Josh
>
> >> 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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: character encoding woes

On Fri, Oct 29, 2010 at 2:31 AM, jsalonen <joni.salonen@gmail.com> wrote:
> Most likely the mysql client is set to use latin-1. To change it from
> Cake add the encoding setting to the config/database.php:
>
>        var $default = array(
>                'encoding' => 'utf8',      // Convert all character data to UTF-8
>                'driver' => 'mysql',
>                'persistent' => false,
>                'host' => 'localhost',
>                'login' => 'user',
>                'password' => 'password',
>                'database' => 'database_name',
>                'prefix' => '',
>        );
>
> The MySQL client converts strings read from the server into the
> encoding used locally. This makes sense because you can mix several
> different storage encodings in a table, but you still want something
> like select * from books return readable data for every column.

I was just about to reply, "Thanks, I just forgot to add that to my
checklist." And then, uh ... realised that encoding is missing from
the DB config. {face-palm} How /very/ embarrassing. It's not like I'm
a beginner to all this. Must be old age, then. ;-)

Thanks for the tip!

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: form to create/redirect to a url

Thanks mate!

On Oct 29, 12:02 pm, Tilen Majerle <tilen.maje...@gmail.com> wrote:
> make a form action to some method in controller...then in this method get
> firstname and lastname from $this->params["url"]["firstname"]
> and $this->params["url"]["lastname"] and make a redirect to
> controller/action/firstname/lastname
> --
> Tilen Majerlehttp://majerle.eu
>
> 2010/10/29 Briko03 <nathanrlar...@gmail.com>
>
> > I want to create a form that redirects to a url based on input from
> > the user.
>
> > For example:
>
> > First Name:-----------
> > Last Name: ------------
>
> > Would redirect to domain.com/controller/action/lastname/firstname
>
> > There would be no information saved.
>
> > I also want to have a select box populated by table values for
> > example:
>
> > I have a column called Year and in contains years obviously. I would
> > like to return only the unique values from that column in a select
> > box.
>
> > Thanks in advance for any help and FYI i am new to cake...
>
> > 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+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

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

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

Re: The Biggest Social Network site...

Very intersting work in social networking site

On Fri, Oct 29, 2010 at 10:57 PM, chris69m@yahoo.com <chris69m@yahoo.com> wrote:
Hello all,...

I have a beautiful START with a this BIGGEST Social site I have
dreamed of. Half way thru,... can't finish it. I'm just a beginner,
and have plans to create the BIGGEST ever social site on the Net...
lol, with plans and strategies that CAN bring more Business to your
pocket. ... Looking for 3-4 motivated coders to join a Network,... and
work on this OPEN project. Each one of us will have a access to same
server, same TESTING domain,... we will share the ideas and feature
development... Here is the testing site URL http://www.zippopeople.com

please send me an email if you are interested in... and we will
contact in skype.

Thanks
Salute
Chris

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en



--
Alok Mishra
Software Engg.
A1 Technology Inc Chandigarh Mohali.
Mobile@9569881400
aloksoft2004@gmail.xom


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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

The Biggest Social Network site...

Hello all,...

I have a beautiful START with a this BIGGEST Social site I have
dreamed of. Half way thru,... can't finish it. I'm just a beginner,
and have plans to create the BIGGEST ever social site on the Net...
lol, with plans and strategies that CAN bring more Business to your
pocket. ... Looking for 3-4 motivated coders to join a Network,... and
work on this OPEN project. Each one of us will have a access to same
server, same TESTING domain,... we will share the ideas and feature
development... Here is the testing site URL http://www.zippopeople.com

please send me an email if you are interested in... and we will
contact in skype.

Thanks
Salute
Chris

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en