Re: ClassRegistry('init') more than once returns same Model id

2010-03-01 Thread AD7six


On Feb 27, 5:12 pm, Greg Marra greg.ma...@gmail.com wrote:
 Hello,

 I have a site where I am using ClassRegistry('init') to create
 multiple new objects inside of a component. I want to save each one
 into the database. Unfortunately, it seems that each time I call
 ClassRegistry('init') I appear to get the same instance of the Model.
 The net result is that instead of having two or three objects in my
 database, it gets overwritten and overwritten and I end up with just
 the most-recently-saved one.

 Here is my code:
 foreach ($new_badges as $new_badge){
                         if ($new_badge){
                                 $UserBadge = ClassRegistry::init('UserBadge');
                                 $UserBadge-set('user_id', 
 $check_in[User][id]);
                                 $UserBadge-set('check_in_id', 
 $check_in[CheckIn][id]);
                                 $UserBadge-set('badge_id', $new_badge);
                                 $UserBadge-save();
                                 $awarded_badges[]=$UserBadge;
                                 unset($UserBadge);
                         }
                 }

 Any idea why this isn't working as expected?

To me your code is working as expected - becuase ClassRegistry::init
is supposed to do exactly what you've found.

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


(view) possible to select only one group of data inside the table?

2010-03-01 Thread sebb86
Hello,
in my view, i have a table with data inside. For example, one column
is named hardware_groups and the content of the cells is something
like: printer, notebook, workstation, and so on.

Is there a simple way to select, for example, only the notebooks?

Hope my problem is understandable.
Thanks if someone can help.

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

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


Pagination and named parameters - routing

2010-03-01 Thread Aurimas
Hello,

Have problem with named parameters in pagination.
I want to make it possible create url that look like

http:///eng/parts/index/named:param/named:param/

my route:
Router::connect('/:language/parts/index/*', array('controller' =
'parts', 'action' = 'index'), array('language' = '[a-z]{2}'));

Paginator helper options:
[1] $paginator-options(array('url' = array(
   'controller' = 'parts',
   'action' = 'index',
   'language' = 'eng'
 )));

and paginator url is generated http:///eng/parts/index/page:2
thats ok it is what i expected

but if i add any parameters
[2] $paginator-options(array('url' = array(
   'controller' = 'parts',
   'action' = 'index',
   'language' = 'eng',
   'another' = 'value'
 )));

i am getting http:///parts/index/page:2/language:eng/another:value
that is wrong

As i read in manual to use custom named parameters i must add with
Router::connectNamed(array('another'));
but is not working i am getting same url, also if i try add any
parameters with
Router::connectNamed now not working without another value [1]
getting http:///parts/index/page:2/language:eng

All other url's is generating correctly, except pagination.

Can anyone please explain what i am doing 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: simple question about CakePHP syntax

2010-03-01 Thread sebb86
WebbedIT, Cristian, majna

Thanks a lot! :-)

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

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


Httpsocket - from https to https

2010-03-01 Thread robmcvey
Hi, having a strange problem with the server config it would appear.
(My code works fine on another host, but unfortunalty I need to make
this work where it is now!)

I am using cakePHP Httpsocket class. The app is on https:// and the
URL I am POST'ing to is also https://.

If I use the same code to POST to an non-SSL domain, i.e just http://somewhere,
I get a response just fine.

However any attempt to POST to https:// has no result whatsover. I
have moved the app to another server and it works as you would expect
with both http and https.

I dont really know where to start with the server config (as it is
obviosully the host begin the issue here).

Please help!

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

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


Re: (views) Redirect where i came from

2010-03-01 Thread sebb86
Well, i forgot a problem.

Now, i have my global add-function in my appController.
But some add-views have drop-down fields to show the available
foreign-
keys. They additional use this code:

[code]
$this-set('foreignKey', $this-Model1-Model2-find('list'));
[/code]

So, can i extend the concerning controllers with this code or must i
copy the complete add function (with additional code) to this
controllers?
Greetings.

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: (views) Redirect where i came from

2010-03-01 Thread John Andersen
You implement the add function in the controller, that requires
additional information, then just make sure that you call the parent
add function ( using parent::add(...) ) in the app controller.
Enjoy,
   John

On Mar 1, 2:36 pm, sebb86 kahlc...@googlemail.com wrote:
 Well, i forgot a problem.

 Now, i have my global add-function in my appController.
 But some add-views have drop-down fields to show the available
 foreign-
 keys. They additional use this code:

 [code]
     $this-set('foreignKey', $this-Model1-Model2-find('list'));
 [/code]

 So, can i extend the concerning controllers with this code or must i
 copy the complete add function (with additional code) to this
 controllers?
 Greetings.

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: (views) Redirect where i came from

2010-03-01 Thread sebb86
John

Thanks again!!!
You solved it. :)

Here is the code from one of my add-functions, which has a drop-down
field with foreign-key elements.

[code]
function add()
{
parent::add();
$this-set('staffs', $this-HardwareUnit-Staff-find('list'));
$this-set('rooms', $this-HardwareUnit-Room-find('list'));
$this-set('hardwareGroups', $this-HardwareUnit-HardwareGroup-
find('list'));
$this-set('hardwareTypes', $this-HardwareUnit-HardwareType-
find('list'));
}
[/code]

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

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


Jquery thick box closing problem

2010-03-01 Thread DAM
I integrated cakephp  jquery thickbox It's working properly but after
submitting form data thickbox not close. I want to close that after
submitted form data. How to do it?

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 dynamically create validation rules

2010-03-01 Thread LunarDraco
You could also take a look at this example which shows how to have
different validation based on which action was called for the
controller. So you can have a validation based on the 'add' action
which is completely different from the validation you might use on
'edit' or 'update'. It also shows how to implement custom/dynamic
validation that executes code which means you would be able to do some
other Model lookups to verify against.

I was headed down the same path and have come to realize that most of
what I thought I was going to need custom code validation for was
dealt with nicely by the the different action validations.

This is an article by Jonathan Snook well written and easy to
implement.
http://snook.ca/archives/cakephp/multiple_validation_sets_cakephp/

Lunar Draco

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

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


CakePHP 1.2.5 and Mysql 5.0.51a

2010-03-01 Thread Michiel Rensen
Far into the development-process of a project I noticed a discrepancy
in MySQL-database servers between my test-server and the clients test-
server (local test-server - client's test-server - clients live-
server). [I know it's a major mistake, but I didn't notice any
problems until now]. They run MySQL 5.0.51a and I run 5.0.67. When I
run a query using the same cake-code on the same data-set results in
different results (there: nothing, here: expected result).
Does anyone know why queries in this configuration (CakePHP 1.2.5 and
MySQL 5.0.51a) result in unexpected results and more importantly does
anyone know a quick fix (i.e. changing server configuration is sadly
but logically not an option)?

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: cakephp shell not validating before entering into db?

2010-03-01 Thread LunarDraco
My guess would be that not all the supporting imports are being
loaded. The shell by default does not load much more than is necessary
to run the shell commands. So I've found that most of the time you
need to build up the shell environment to support what you will be
using.
I would try adding this to the top of your shell

App::import('Core', array('Controller','Component',
'View','Model','Router','Validation', 'Behavior'));

Also in my shells I've had to instantiate many of the objects. In
other words the cake magic just doesn't exists. So in my shell's
Initialize I have the following: (this shell deals with a controller a
couple models and a view to send some emails on a cron job.

function initialize() {
//$this-Controller = new Controller();
//$this-Component = new Component();
$this-ProfileController = new ProfilesController();
$this-ProfileController-uses = array('Profile','User');
$this-ProfileController-Profile = new Profile();
$this-ProfileController-Project = new Project();
$this-ProfileController-Email = new EmailComponent();
$this-ProfileController-Email-initialize($this-
ProfileController);
$this-_loadModels();
}


You could also verify that the Behaviors are loaded by dumping $this-
Issue-Behaviors or checking to see if it is null. If it is null then
you will not have any validation available.

In the Model class the chunk of code that does the check your
referring to follows the following stack You could add some debug code
to these functions to identify what is different in the environment
between accessing via the web vs the shell.
save(), validation(), invalidFields(), exists()

You might also want to take a look at this page in the manual as the
path environment is also important especially to the imports. Your
shell may not know where to find the right path to import the
behaviors etc.
http://book.cakephp.org/view/846/Running-Shells-as-cronjobs

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


Routing first parameter in URL to an action

2010-03-01 Thread jbov
I have set up a blog using URL slugs. Say my domain is darn.it and the
title for my first post is I lost my shoe. My blog posts are
displaying at darn.it/posts/i-lost-my-shoe. Easy as pie, er, cake.

I want to route it so the first parameter in the url is the slug. So
darn.it/i-lost-my-shoe would map to controller = posts, action =
view. Below is my routing, but I'm missing something because it's not
passing the slug to the view method properly. Or maybe it's not
calling the view method. Any advice?

Router::connect(
 '/:slug',
 array('controller' = 'posts', 'action' = 'view'),
 array('slug' = '^[a-zA-Z0-9_]{1,}$')
);

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: Routing first parameter in URL to an action

2010-03-01 Thread Lucca Mordente
if its not calling the view method, try to add  \- to your regex as
follows:

 '^[a-zA-Z0-9_\-]{1,}$'


else if the parameter just isn't being passed, add the 'pass' option
to route:

Router::connect(
 '/:slug',
 array('controller' = 'posts', 'action' = 'view'),
 array('slug' = '^[a-zA-Z0-9_]{1,}$', 'pass'=array('slug'))
);


hope it helps (:


On 1 mar, 12:39, jbov jonathan.li...@gmail.com wrote:
 I have set up a blog using URL slugs. Say my domain is darn.it and the
 title for my first post is I lost my shoe. My blog posts are
 displaying at darn.it/posts/i-lost-my-shoe. Easy as pie, er, cake.

 I want to route it so the first parameter in the url is the slug. So
 darn.it/i-lost-my-shoe would map to controller = posts, action =
 view. Below is my routing, but I'm missing something because it's not
 passing the slug to the view method properly. Or maybe it's not
 calling the view method. Any advice?

 Router::connect(
      '/:slug',
      array('controller' = 'posts', 'action' = 'view'),
      array('slug' = '^[a-zA-Z0-9_]{1,}$')
 );

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: Different logic and view for each group

2010-03-01 Thread LunarDraco
Control what is displayed to the end user in your views as mentioned
before. Control user auth and access in the controller via the ACL or
other User auth implementations

You'll also want to make sure your Controllers are very user aware.
Just because the link doesn't show up in the view doesn't mean someone
isn't going to try and visit the link. Especially after seeing the
simple human readable structure of the url /product/28.

Never try to secure your site via the view or by simply hiding the
available actions from the user. The controller should be the place
you verify that the user is authorized to call it.

Even more important is remove the parameter data from the url and add
it to post data when the call is destructive. Like in a delete. don't
request product/delete/28, post product/delete with post data so your
controller can verify $this-data['Product']['id'] and also some other
hashed hidden field which gets changed and verified. Security
Component handles this hash for you and can verify that the field data
provided matches what was given. 
http://book.cakephp.org/view/175/Security-Component

I prematurely deployed a site which was not properly secure and woke
up one morning to an empty database. I know others have posted the
same thing and found that search robots had traversed the site and
stumbled on the many fascinating delete request. Now a day this is the
first thing I take care of when building a new site. Nothing like
learning the hard way to really make the lesson stick ;)

Lunar Darco

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

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


Re: CakePHP 1.2.5 and Mysql 5.0.51a

2010-03-01 Thread John Andersen
Have you positive proof that it is a CakePHP issue and not a data
issue? Have you taken the offending SQL statement(s) and executed
them in both environments outside of CakePHP?
Can you show the SQL code which is the issue?
Enjoy,
   John

On Mar 1, 12:11 pm, Michiel Rensen mjren...@gmail.com wrote:
 Far into the development-process of a project I noticed a discrepancy
 in MySQL-database servers between my test-server and the clients test-
 server (local test-server - client's test-server - clients live-
 server). [I know it's a major mistake, but I didn't notice any
 problems until now]. They run MySQL 5.0.51a and I run 5.0.67. When I
 run a query using the same cake-code on the same data-set results in
 different results (there: nothing, here: expected result).
 Does anyone know why queries in this configuration (CakePHP 1.2.5 and
 MySQL 5.0.51a) result in unexpected results and more importantly does
 anyone know a quick fix (i.e. changing server configuration is sadly
 but logically not an option)?

 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: (view) possible to select only one group of data inside the table?

2010-03-01 Thread John Andersen
Yes and no, it all depends on what do you want to do, if you could
choose a cell?
F.eks. you could make the cell content a link, and then do something,
when the user clicks on the link!
Enjoy,
   John

On Mar 1, 11:25 am, sebb86 kahlc...@googlemail.com wrote:
 Hello,
 in my view, i have a table with data inside. For example, one column
 is named hardware_groups and the content of the cells is something
 like: printer, notebook, workstation, and so on.

 Is there a simple way to select, for example, only the notebooks?

 Hope my problem is understandable.
 Thanks if someone can help.

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

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


Re: falsefalse

2010-03-01 Thread LunarDraco
Which vs of cake are you both using?

Also you may want to read this post which talks a little bit about
containable and hasmany relations. Breaks down when it will work and
when it won't work. Maybe that will give you some ideas about what
might be wrong with your setup or how your making the calls to get the
data your looking for.

http://stackoverflow.com/questions/1497358/containable-on-hasmany-relationship


On Feb 28, 8:40 pm, Arak Tai'Roth nielsen.dus...@gmail.com wrote:
 Okay, well, I'm still not sure, because everything you did is the same
 as me from what I can tell, except you didn't specify fields grabbed
 in your models. I removed that info in mine, but that didn't change
 anything.

 I'm not sure, but I have a feeling this all relates to the fact that
 contain doesn't seem to be grabbing anything that is two levels deep,
 it grabs a model fine and it's associations fine, but it is not
 grabbing the associations of the associations. This seems like a
 recursive problem to me, but I tried setting the recursive property of
 the model and that didn't help, but I might have done it wrong, I
 haven't been able to find an example of doing it.

 On Feb 28, 3:29 am, John Andersen j.andersen...@gmail.com wrote:

  Ok, have recreated your situation - and it just works!

  My result:
  [result]
  Array
  (
      [Permit] = Array
          (
              [id] = 1
              [created] = 2010-02-28 10:55:16
              [user_id] = 1
              [leader_id] = 1
              [registration_location_id] = 1
          )
      [User] = Array
          (
              [id] = 1
              [name] = user1
          )
      [Leader] = Array
          (
              [id] = 1
              [name] = leader 1
              [created] = 2010-02-27 10:53:57
              [country_id] = 1
              [prov_state_id] = 1
              [user_id] = 1
              [Country] = Array
                  (
                      [id] = 1
                      [name] = country 1
                  )
              [ProvState] = Array
                  (
                      [id] = 1
                      [name] = prov state 1
                  )
          )
      [RegistrationLocation] = Array
          (
              [id] = 1
              [name] = location 1
          )
  )
  [/result]

  based on the Permit controllers find:
  [code]
        $permits = $this-Permit-find(
           'first', array(
              'conditions' = array(
                 'Permit.id' = 1
              ),
              'contain' = array(
                 'Leader' = array('Country','ProvState'),
                 'User',
                 'RegistrationLocation'
              )
           )
        );
        debug($permits);
  [/code]

  Using only the following models:
  user.php
  leader.php
  permit.php

  Thus RegistrationLocation, Country and ProvState uses the AppModel as
  base.

  My models are defined as:
  [UserModel]
  class User extends AppModel {
      var $name = 'User';
      var $hasMany = array('Leader','Permit');}

  [/UserModel]

  [LeaderModel]
  class Leader extends AppModel {
      var $name = 'Leader';
      var $hasMany = array('Permit');
      var $belongsTo = array('User','Country','ProvState');}

  [/LeaderModel]

  [PermitModel]
  class Permit extends AppModel {
      var $name = 'Permit';
      var $belongsTo = array('User','Leader','RegistrationLocation');}

  [/PermitModel]

  Please compare with your situation, maybe the above will help you on
  the way.
  Enjoy,
     John
  On Feb 28, 10:46 am, John Andersen j.andersen...@gmail.com wrote:

   Could be! I am trying to recreate your situation here at my place, to
   confirm that I too can't retrieve the Country.
   Will be back shortly :)
      John

   On Feb 28, 10:40 am, Arak Tai'Roth nielsen.dus...@gmail.com wrote:

This is the only thing that is even remotely relevant in app_model:

var $actsAs = array(
                        'Containable'
                );

Other then that, there are only 2 functions, one for validating phone
numbers, and one for changing dates to a format I want.

Like I have said previously, this is all working when I do the search
on the model Leader, just not when I do the search on the model Permit
and have a contain with Leader in it, and then a contain with the
country data.

So because it works for something, just not quite as deep, I have a
feeling we are looking in the entirely wrong area.

   [snip]

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


.htaccess problems

2010-03-01 Thread k...@coppcomm.ca
Hi all,

I'm trying to configure a default Cake 1.3 installation (www.site.com/
projadmin, where projadmin is the cake dir) and have been running into
trouble with our webhost. We're on a shared server, and no matter what
I try, I cannot get the paths working properly. I have duplicated the
cake installation on my personal dreamhost server (which is shared)
and it works automatically without having to change any .htaccess
rules.

Our webhost says mod_rewrite is enabled, but the site throws a 404
error with /c/o/our site/public/projadmin/app/webroot/

I sent them an email asking about this, and they responded Please be
advised that you need to use the following path: /services/webpages/c/
o/our site/

Now, I've tried lots of different RewriteBase rules in all 3 .htaccess
files, including the new path they replied with, but I always get a
404.

Please help! This has been bothering me for days!

-- Ken

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: Routing first parameter in URL to an action

2010-03-01 Thread jbov
No dice :-(

Here's my view method:

function view($slug) {
$post = $this-Post-findBySlug($slug);
$postTitle = $post['Post']['title'];
$this-set(array(
'post'=$post,
'pageheader'=$postTitle
));
}

Anything I'm missing?




On Mar 1, 5:55 pm, Lucca Mordente luccamorde...@gmail.com wrote:
 if its not calling the view method, try to add  \- to your regex as
 follows:

  '^[a-zA-Z0-9_\-]{1,}$'

 else if the parameter just isn't being passed, add the 'pass' option
 to route:

 Router::connect(
      '/:slug',
      array('controller' = 'posts', 'action' = 'view'),
      array('slug' = '^[a-zA-Z0-9_]{1,}$', 'pass'=array('slug'))
 );

 hope it helps (:

 On 1 mar, 12:39, jbov jonathan.li...@gmail.com wrote:



  I have set up a blog using URL slugs. Say my domain is darn.it and the
  title for my first post is I lost my shoe. My blog posts are
  displaying at darn.it/posts/i-lost-my-shoe. Easy as pie, er, cake.

  I want to route it so the first parameter in the url is the slug. So
  darn.it/i-lost-my-shoe would map to controller = posts, action =
  view. Below is my routing, but I'm missing something because it's not
  passing the slug to the view method properly. Or maybe it's not
  calling the view method. Any advice?

  Router::connect(
       '/:slug',
       array('controller' = 'posts', 'action' = 'view'),
       array('slug' = '^[a-zA-Z0-9_]{1,}$')
  );

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


Why Doesn't Anyone Know how to drop in a new URL in a cake framework

2010-03-01 Thread APD
I hired someone to add a blog to our website.  I have noticed that
there are always php errors anytime a new page is created.  In my job
description, I said Cake knowledge would be necessary.  This was not
heeded. Those hired dropped in the new url and this is what the page
reads:



Notice (8): Undefined index:  here [CORE/cake/libs/router.php, line
763]
Notice (8): Undefined index:  controller [CORE/app/views/elements/
steps.ctp, line 2]

Notice (8): Undefined index:  controller [CORE/app/views/elements/
steps.ctp, line 4]
Notice (8): Undefined index:  controller [CORE/app/views/elements/
steps.ctp, line 6]
Notice (8): Undefined index:  controller [CORE/app/views/elements/
steps.ctp, line 8]

Missing controller

You are seeing this error because controller
HawaiitravelblogController could not be found.

Notice: If you want to customize this error message, create app/views/
errors/missing_controller.ctp

Fatal: Create the class below in file: app/controllers/
hawaiitravelblog_controller.php

?php
class HawaiitravelblogController extends AppController {
   var $name = 'Hawaiitravelblog';
}
?




I unfortunately do not have any specific coding training in Cake or
php but would like to know what the above means to see if 1) I can fix
it myself or 2) describe it better to someone who may actually be able
to fix it.

Thanks for the help.

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

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


Re: Routing first parameter in URL to an action

2010-03-01 Thread Lucca Mordente
what do you get?
missing view or something like this?


On 1 mar, 13:34, jbov jonathan.li...@gmail.com wrote:
 No dice :-(

 Here's my view method:

         function view($slug) {
                 $post = $this-Post-findBySlug($slug);
                 $postTitle = $post['Post']['title'];
                 $this-set(array(
                                 'post'=$post,
                                 'pageheader'=$postTitle
                 ));
         }

 Anything I'm missing?

 On Mar 1, 5:55 pm, Lucca Mordente luccamorde...@gmail.com wrote:



  if its not calling the view method, try to add  \- to your regex as
  follows:

   '^[a-zA-Z0-9_\-]{1,}$'

  else if the parameter just isn't being passed, add the 'pass' option
  to route:

  Router::connect(
       '/:slug',
       array('controller' = 'posts', 'action' = 'view'),
       array('slug' = '^[a-zA-Z0-9_]{1,}$', 'pass'=array('slug'))
  );

  hope it helps (:

  On 1 mar, 12:39, jbov jonathan.li...@gmail.com wrote:

   I have set up a blog using URL slugs. Say my domain is darn.it and the
   title for my first post is I lost my shoe. My blog posts are
   displaying at darn.it/posts/i-lost-my-shoe. Easy as pie, er, cake.

   I want to route it so the first parameter in the url is the slug. So
   darn.it/i-lost-my-shoe would map to controller = posts, action =
   view. Below is my routing, but I'm missing something because it's not
   passing the slug to the view method properly. Or maybe it's not
   calling the view method. Any advice?

   Router::connect(
        '/:slug',
        array('controller' = 'posts', 'action' = 'view'),
        array('slug' = '^[a-zA-Z0-9_]{1,}$')
   );

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: Why Doesn't Anyone Know how to drop in a new URL in a cake framework

2010-03-01 Thread Foroct
I'm a bit of a n00b but I would suggest you look at the cakephp blog
tutorial http://book.cakephp.org/view/219/Blog as it might help you.
Also a subject title that doesn't defame cake programmers might help
your cause.

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: Routing first parameter in URL to an action

2010-03-01 Thread jbov
Notice (8): Undefined variable: javascript [APP/views/layouts/
default.ctp, line 35]

Fatal error: Call to a member function link() on a non-object in /
private/var/web/localhost/www.jonathanlibov.com/app/views/layouts/
default.ctp on line 35

Same thing I would get if I tried localhost/www.jonathanlibov.com/
foobar or localhost/www.jonathanlibov.com/posts/foobar

(i.e., the same thing I get if I try a controller or a view that
doesn't exist)




On Mar 1, 6:54 pm, Lucca Mordente luccamorde...@gmail.com wrote:
 what do you get?
 missing view or something like this?

 On 1 mar, 13:34, jbov jonathan.li...@gmail.com wrote:



  No dice :-(

  Here's my view method:

          function view($slug) {
                  $post = $this-Post-findBySlug($slug);
                  $postTitle = $post['Post']['title'];
                  $this-set(array(
                                  'post'=$post,
                                  'pageheader'=$postTitle
                  ));
          }

  Anything I'm missing?

  On Mar 1, 5:55 pm, Lucca Mordente luccamorde...@gmail.com wrote:

   if its not calling the view method, try to add  \- to your regex as
   follows:

    '^[a-zA-Z0-9_\-]{1,}$'

   else if the parameter just isn't being passed, add the 'pass' option
   to route:

   Router::connect(
        '/:slug',
        array('controller' = 'posts', 'action' = 'view'),
        array('slug' = '^[a-zA-Z0-9_]{1,}$', 'pass'=array('slug'))
   );

   hope it helps (:

   On 1 mar, 12:39, jbov jonathan.li...@gmail.com wrote:

I have set up a blog using URL slugs. Say my domain is darn.it and the
title for my first post is I lost my shoe. My blog posts are
displaying at darn.it/posts/i-lost-my-shoe. Easy as pie, er, cake.

I want to route it so the first parameter in the url is the slug. So
darn.it/i-lost-my-shoe would map to controller = posts, action =
view. Below is my routing, but I'm missing something because it's not
passing the slug to the view method properly. Or maybe it's not
calling the view method. Any advice?

Router::connect(
     '/:slug',
     array('controller' = 'posts', 'action' = 'view'),
     array('slug' = '^[a-zA-Z0-9_]{1,}$')
);

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: Why Doesn't Anyone Know how to drop in a new URL in a cake framework

2010-03-01 Thread Jeremy Burns
Can you publish the contents of this file:

/app/views/elements/steps.ctp

... to this forum?

Jeremy Burns


On 1 Mar 2010, at 16:33, APD wrote:

 I hired someone to add a blog to our website.  I have noticed that
 there are always php errors anytime a new page is created.  In my job
 description, I said Cake knowledge would be necessary.  This was not
 heeded. Those hired dropped in the new url and this is what the page
 reads:
 
 
 
 Notice (8): Undefined index:  here [CORE/cake/libs/router.php, line
 763]
 Notice (8): Undefined index:  controller [CORE/app/views/elements/
 steps.ctp, line 2]
 
 Notice (8): Undefined index:  controller [CORE/app/views/elements/
 steps.ctp, line 4]
 Notice (8): Undefined index:  controller [CORE/app/views/elements/
 steps.ctp, line 6]
 Notice (8): Undefined index:  controller [CORE/app/views/elements/
 steps.ctp, line 8]
 
 Missing controller
 
 You are seeing this error because controller
 HawaiitravelblogController could not be found.
 
 Notice: If you want to customize this error message, create app/views/
 errors/missing_controller.ctp
 
 Fatal: Create the class below in file: app/controllers/
 hawaiitravelblog_controller.php
 
 ?php
 class HawaiitravelblogController extends AppController {
   var $name = 'Hawaiitravelblog';
 }
 ?
 
 
 
 
 I unfortunately do not have any specific coding training in Cake or
 php but would like to know what the above means to see if 1) I can fix
 it myself or 2) describe it better to someone who may actually be able
 to fix it.
 
 Thanks for the help.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

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: Routing first parameter in URL to an action

2010-03-01 Thread cricket
Assuming your slugs are already lowercased, try '[-_a-z0-9]+' instead.

On Mar 1, 11:34 am, jbov jonathan.li...@gmail.com wrote:
 No dice :-(

 Here's my view method:

         function view($slug) {
                 $post = $this-Post-findBySlug($slug);
                 $postTitle = $post['Post']['title'];
                 $this-set(array(
                                 'post'=$post,
                                 'pageheader'=$postTitle
                 ));
         }

 Anything I'm missing?

 On Mar 1, 5:55 pm, Lucca Mordente luccamorde...@gmail.com wrote:

  if its not calling the view method, try to add  \- to your regex as
  follows:

   '^[a-zA-Z0-9_\-]{1,}$'

  else if the parameter just isn't being passed, add the 'pass' option
  to route:

  Router::connect(
       '/:slug',
       array('controller' = 'posts', 'action' = 'view'),
       array('slug' = '^[a-zA-Z0-9_]{1,}$', 'pass'=array('slug'))
  );

  hope it helps (:

  On 1 mar, 12:39, jbov jonathan.li...@gmail.com wrote:

   I have set up a blog using URL slugs. Say my domain is darn.it and the
   title for my first post is I lost my shoe. My blog posts are
   displaying at darn.it/posts/i-lost-my-shoe. Easy as pie, er, cake.

   I want to route it so the first parameter in the url is the slug. So
   darn.it/i-lost-my-shoe would map to controller = posts, action =
   view. Below is my routing, but I'm missing something because it's not
   passing the slug to the view method properly. Or maybe it's not
   calling the view method. Any advice?

   Router::connect(
        '/:slug',
        array('controller' = 'posts', 'action' = 'view'),
        array('slug' = '^[a-zA-Z0-9_]{1,}$')
   );



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


Searchable behavior on two models

2010-03-01 Thread Foroct
I am using this behavior (http://code.google.com/p/searchable-
behaviour-for-cakephp/) on two different models (User and Post).
Searchable is working fine when I add a new user and search for a
user.  I manually populated a few rows of Post data and my search for
a post function works fine. However when I try to add a new post I get
the following errors.

Undefined index: User [APP/models/behaviors/searchable.php, line 77]
Invalid argument supplied for foreach() [APP/models/behaviors/
searchable.php, line 78] SQL Error: 1048: Column 'association_key'
cannot be null [CORE/cake/libs/model/datasources/dbo_source.php, line
525] Query: INSERT INTO `search_index` (`model`, `association_key`,
`data`, `modified`, `created`) VALUES ('User', NULL, '', '2010-02-28
12:04:11', '2010-02-28 12:04:11')

Query: INSERT INTO `search_index` (`model`, `association_key`, `data`,
`modified`, `created`) VALUES ('User', NULL, '', '2010-02-28
12:04:11', '2010-02-28 12:04:11')

Cannot modify header information - headers already sent by (output
started at /home/xxx/example.com/cake/basics.php:307) [CORE/cake/libs/
controller/controller.php, line 644]

So from what I can tell when I add a post something with the user
model is conflicting with my add posts function, as the Query stats
the model value is user and not post.  I would expect to see the
query values start with the 'Post' model then the post id and then
some data.

Is there something I need to do when using this behavior on two
different models?  Is there any reason that the behavior thinks I am
inserting User data when in fact I am inserting Post data?

Any help or suggestions would be 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: SSL and https

2010-03-01 Thread Jeremy Burns
I've only just got around to trying this - and it fits the bill really nicely 
thanks.

Jeremy Burns


On 18 Feb 2010, at 09:29, jperras wrote:

 http://github.com/plank/secured
 
 -jperras.
 
 On Feb 17, 12:54 am, Jeremy Burns jeremybu...@me.com wrote:
 Any takers on this please?
 
 Jeremy Burns
 jeremybu...@me.com
 
 On 12 Feb 2010, at 05:00, Jeremy Burns wrote:
 
 
 
 I am using the security component from app_controller. In some
 controllers I have this in my beforeFilter:
 
if (in_array($this-params['action'], $action)):
$this-Security-blackHoleCallback = 'forceSSL';
$this-Security-requireSecure();
else:
$this-Security-blackHoleCallback = 'unforceSSL';
endif;
 
 I have these two functions in app_controller:
 
function forceSSL() {
 
$this-redirect('https://' . env('SERVER_NAME') . $this-here);
 
}
 
function unforceSSL() {
 
$this-redirect('http://' . env('SERVER_NAME') . $this-here);
 
}
 
 This is working in the sense that the right actions in the right
 controllers are being redirected to https. But once I am in https, I
 stay there.
 
 My question is: how do I get the site to go back to http for those
 controller actions that do not require https?
 
 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

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: Jquery thick box closing problem

2010-03-01 Thread Miles J
Sorry but this is a CakePHP forum, not a Thickbox forum. It would be
best to ask this question in a Javascript forum or on the official
Thickbox site.

On Mar 1, 6:42 am, DAM damit...@gmail.com wrote:
 I integrated cakephp  jquery thickbox It's working properly but after
 submitting form data thickbox not close. I want to close that after
 submitted form data. How to do it?

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

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


CakePHP 1.3-RC1 freshly sliced

2010-03-01 Thread mark_story
The CakePHP development team is happy to announce the release the
CakePHP 1.3.0-RC1. Since 1.3-beta was released we've been hard at work
implementing new features and fixing issues in existing features in
the 1.3 branch. There have been over 165 commits, and more than 75
tickets resolved. All methods previously issuing deprecation errors
have since been removed, and will cause fatal errors in non-updated
code.

There have been no major features added since the beta as the codebase
stabilizes. 1.3.0-RC1 is the first of 4 Release candidate releases.
Moving forward, there will be no further enhancements applied to the
1.3 branch and only issues with the existing features will be done. We
are hoping this will afford a rapid series of releases building toward
the 1.3 stable release.

In other project news, all of the 1.3 related wiki pages have been
migrated to the new 1.3 book[1]. During the release candidate process,
we will be focusing on updating the documentation pages as well as
expanding any holes in the API documentation. Your help in these areas
would be greatly appreciated, as the more eyes and brains we have
looking at the documentation the better we can make it. Please edit
the book directly, and submit patches/tickets for the API.

We'd like to thank you the community for the their ongoing support and
contributions. Without the community surrounding CakePHP this project
wouldn't be as vibrant and energetic as it is.

Download a packaged release [2]
View the changelog [3]


[1] http://book.cakephp.org/view/876/The-Manual
[2] http://github.com/cakephp/cakephp1x/downloads
[3] http://cakephp.lighthouseapp.com/projects/42648/changelog-1-3-0-rc1

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: Routing first parameter in URL to an action

2010-03-01 Thread Lucca Mordente
does your PostsController or AppController has the Javascript and Html
helpers?


On 1 mar, 14:11, jbov jonathan.li...@gmail.com wrote:
 Notice (8): Undefined variable: javascript [APP/views/layouts/
 default.ctp, line 35]

 Fatal error: Call to a member function link() on a non-object in /
 private/var/web/localhost/www.jonathanlibov.com/app/views/layouts/
 default.ctp on line 35

 Same thing I would get if I tried localhost/www.jonathanlibov.com/
 foobar or localhost/www.jonathanlibov.com/posts/foobar

 (i.e., the same thing I get if I try a controller or a view that
 doesn't exist)

 On Mar 1, 6:54 pm, Lucca Mordente luccamorde...@gmail.com wrote:



  what do you get?
  missing view or something like this?

  On 1 mar, 13:34, jbov jonathan.li...@gmail.com wrote:

   No dice :-(

   Here's my view method:

           function view($slug) {
                   $post = $this-Post-findBySlug($slug);
                   $postTitle = $post['Post']['title'];
                   $this-set(array(
                                   'post'=$post,
                                   'pageheader'=$postTitle
                   ));
           }

   Anything I'm missing?

   On Mar 1, 5:55 pm, Lucca Mordente luccamorde...@gmail.com wrote:

if its not calling the view method, try to add  \- to your regex as
follows:

 '^[a-zA-Z0-9_\-]{1,}$'

else if the parameter just isn't being passed, add the 'pass' option
to route:

Router::connect(
     '/:slug',
     array('controller' = 'posts', 'action' = 'view'),
     array('slug' = '^[a-zA-Z0-9_]{1,}$', 'pass'=array('slug'))
);

hope it helps (:

On 1 mar, 12:39, jbov jonathan.li...@gmail.com wrote:

 I have set up a blog using URL slugs. Say my domain is darn.it and the
 title for my first post is I lost my shoe. My blog posts are
 displaying at darn.it/posts/i-lost-my-shoe. Easy as pie, er, cake.

 I want to route it so the first parameter in the url is the slug. So
 darn.it/i-lost-my-shoe would map to controller = posts, action =
 view. Below is my routing, but I'm missing something because it's not
 passing the slug to the view method properly. Or maybe it's not
 calling the view method. Any advice?

 Router::connect(
      '/:slug',
      array('controller' = 'posts', 'action' = 'view'),
      array('slug' = '^[a-zA-Z0-9_]{1,}$')
 );

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: Why Doesn't Anyone Know how to drop in a new URL in a cake framework

2010-03-01 Thread APD
It's not cake programmers that don't know how to drop in urls - it's
everyone else.



On Mar 1, 12:09 pm, Foroct forrestfraz...@gmail.com wrote:
 I'm a bit of a n00b but I would suggest you look at the cakephp blog
 tutorialhttp://book.cakephp.org/view/219/Blogas it might help you.
 Also a subject title that doesn't defame cake programmers might help
 your cause.

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: Why Doesn't Anyone Know how to drop in a new URL in a cake framework

2010-03-01 Thread APD
?php
if($this-params['controller'] == islands  sizeof($this-
params['pass']) == 0) {
echo $html-image('step01_5.gif', array('alt'='Step 1: Select 
an
Area', 'style'='display:block; margin:auto;'));
} else if($this-params['controller'] == islands  sizeof($this-
params['pass'])  0) {
echo $html-image('step02.gif', array('alt'='Step 2: Select a
Property', 'style'='display:block; margin:auto;'));
} else if($this-params['controller'] == properties  $this-
params['action'] == details) {
echo $html-image('step03.gif', array('alt'='Step 3: Speak to
Hawaii Hideaways', 'style'='display:block; margin:auto;'));
} else if($this-params['controller'] == properties  $this-
params['action'] != details) {
echo $html-image('step02.gif', array('alt'='Step 2: Select a
Property', 'style'='display:block; margin:auto;'));
} else {
echo $html-image('step01.gif', array('alt'='Step 1: Select an
Island', 'style'='display:block; margin:auto;'));
}
?

On Mar 1, 12:13 pm, Jeremy Burns jeremybu...@me.com wrote:
 Can you publish the contents of this file:

 /app/views/elements/steps.ctp

 ... to this forum?

 Jeremy Burns

 On 1 Mar 2010, at 16:33, APD wrote:

  I hired someone to add a blog to our website.  I have noticed that
  there are always php errors anytime a new page is created.  In my job
  description, I said Cake knowledge would be necessary.  This was not
  heeded. Those hired dropped in the new url and this is what the page
  reads:

  

  Notice (8): Undefined index:  here [CORE/cake/libs/router.php, line
  763]
  Notice (8): Undefined index:  controller [CORE/app/views/elements/
  steps.ctp, line 2]

  Notice (8): Undefined index:  controller [CORE/app/views/elements/
  steps.ctp, line 4]
  Notice (8): Undefined index:  controller [CORE/app/views/elements/
  steps.ctp, line 6]
  Notice (8): Undefined index:  controller [CORE/app/views/elements/
  steps.ctp, line 8]

  Missing controller

  You are seeing this error because controller
  HawaiitravelblogController could not be found.

  Notice: If you want to customize this error message, create app/views/
  errors/missing_controller.ctp

  Fatal: Create the class below in file: app/controllers/
  hawaiitravelblog_controller.php

  ?php
  class HawaiitravelblogController extends AppController {
    var $name = 'Hawaiitravelblog';
  }
  ?

  

  I unfortunately do not have any specific coding training in Cake or
  php but would like to know what the above means to see if 1) I can fix
  it myself or 2) describe it better to someone who may actually be able
  to fix it.

  Thanks for 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


Login Redirects

2010-03-01 Thread JoHN
Hi..

I have currently set autoRedirect to false in app_controller ($this-
Auth-autoRedirect = false;).. and made a redirection upon logging
in..

here the codes for login function:

Function login() {

if ($this-Session-read('Auth.User')) {
$this-Session-setFlash('You are logged in!');
$this-redirect('/announcements/home', null, false);
}

}


When the user logs in, it redirects to announcements/home instead of
the last page where he was when he last logged out.. the problem is,
that the page doesn't seem to update and would still seem like the
user has not logged in until the user refresh the page. the
controlpanel will not appear as it supposed to.

how can i solve this problem?

been stuck in this situation for more than 5 hours now. :(

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: Routing first parameter in URL to an action

2010-03-01 Thread jbov
Jiminy cricket that did the trick! I've been working on this on-and-
off for days and didn't suspect that it was the Regex.




On Mar 1, 7:14 pm, cricket zijn.digi...@gmail.com wrote:
 Assuming your slugs are already lowercased, try '[-_a-z0-9]+' instead.

 On Mar 1, 11:34 am, jbov jonathan.li...@gmail.com wrote:



  No dice :-(

  Here's my view method:

          function view($slug) {
                  $post = $this-Post-findBySlug($slug);
                  $postTitle = $post['Post']['title'];
                  $this-set(array(
                                  'post'=$post,
                                  'pageheader'=$postTitle
                  ));
          }

  Anything I'm missing?

  On Mar 1, 5:55 pm, Lucca Mordente luccamorde...@gmail.com wrote:

   if its not calling the view method, try to add  \- to your regex as
   follows:

    '^[a-zA-Z0-9_\-]{1,}$'

   else if the parameter just isn't being passed, add the 'pass' option
   to route:

   Router::connect(
        '/:slug',
        array('controller' = 'posts', 'action' = 'view'),
        array('slug' = '^[a-zA-Z0-9_]{1,}$', 'pass'=array('slug'))
   );

   hope it helps (:

   On 1 mar, 12:39, jbov jonathan.li...@gmail.com wrote:

I have set up a blog using URL slugs. Say my domain is darn.it and the
title for my first post is I lost my shoe. My blog posts are
displaying at darn.it/posts/i-lost-my-shoe. Easy as pie, er, cake.

I want to route it so the first parameter in the url is the slug. So
darn.it/i-lost-my-shoe would map to controller = posts, action =
view. Below is my routing, but I'm missing something because it's not
passing the slug to the view method properly. Or maybe it's not
calling the view method. Any advice?

Router::connect(
     '/:slug',
     array('controller' = 'posts', 'action' = 'view'),
     array('slug' = '^[a-zA-Z0-9_]{1,}$')
);

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: Jquery thick box closing problem

2010-03-01 Thread DAM
I know how to close thickbox.


$(document).ready(function(){
 function tb_remove() {
   $(#TB_imageOff).unbind(click);
  $(#TB_closeWindowButton).unbind(click);
  $(#TB_window).fadeOut(fast,function(){$
('#TB_window,#TB_overlay,#TB_HideSelect').trigger(unload).unbind().remove();});
  $(#TB_load).remove();
  if (typeof document.body.style.maxHeight == undefined) {if IE 6
$(body,html).css({height: auto, width: auto});
$(html).css(overflow,);
  }
  document.onkeydown = ;
  document.onkeyup = ;
  return false;
}
})

now I want to after submit data run above jquery.

function admin_add() {
$this-layout = 'ajax';

if (!empty($this-data)) {
 if($this-data['User']['password'] == $this-Auth-
password($this-data['User']['password_confirm'])){
$this-User-create();
 if ($this-User-save($this-data)) {
#after save user data
$this-data['UserProfile']['user_id'] = $this-
User-id;
#save userprofile data
if($this-User-UserProfile-save($this-data)){

$this-flashSuccess('The user has been
saved',array('controller'='users','action'='index'));

}else{
$this-flashWarning('The user could not be
saved. Please, try again.');
}
 }else {
$this-flashWarning('The user could not 
be saved. Please,
try again.');
 }
}

I want to run only when user save only. how to run javascript code
inside cakephp controller?
}
#set branch list
$branches = $this-User-Branch-find('list');
$this-set(compact('branches'));

}

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: Routing first parameter in URL to an action

2010-03-01 Thread jbov
I just added the Javascript helper to the AppController and that took
care of the Notice (8) issue. Thanks!



On Mar 1, 8:02 pm, Lucca Mordente luccamorde...@gmail.com wrote:
 does your PostsController or AppController has the Javascript and Html
 helpers?

 On 1 mar, 14:11, jbov jonathan.li...@gmail.com wrote:



  Notice (8): Undefined variable: javascript [APP/views/layouts/
  default.ctp, line 35]

  Fatal error: Call to a member function link() on a non-object in /
  private/var/web/localhost/www.jonathanlibov.com/app/views/layouts/
  default.ctp on line 35

  Same thing I would get if I tried localhost/www.jonathanlibov.com/
  foobar or localhost/www.jonathanlibov.com/posts/foobar

  (i.e., the same thing I get if I try a controller or a view that
  doesn't exist)

  On Mar 1, 6:54 pm, Lucca Mordente luccamorde...@gmail.com wrote:

   what do you get?
   missing view or something like this?

   On 1 mar, 13:34, jbov jonathan.li...@gmail.com wrote:

No dice :-(

Here's my view method:

        function view($slug) {
                $post = $this-Post-findBySlug($slug);
                $postTitle = $post['Post']['title'];
                $this-set(array(
                                'post'=$post,
                                'pageheader'=$postTitle
                ));
        }

Anything I'm missing?

On Mar 1, 5:55 pm, Lucca Mordente luccamorde...@gmail.com wrote:

 if its not calling the view method, try to add  \- to your regex as
 follows:

  '^[a-zA-Z0-9_\-]{1,}$'

 else if the parameter just isn't being passed, add the 'pass' option
 to route:

 Router::connect(
      '/:slug',
      array('controller' = 'posts', 'action' = 'view'),
      array('slug' = '^[a-zA-Z0-9_]{1,}$', 'pass'=array('slug'))
 );

 hope it helps (:

 On 1 mar, 12:39, jbov jonathan.li...@gmail.com wrote:

  I have set up a blog using URL slugs. Say my domain is darn.it and 
  the
  title for my first post is I lost my shoe. My blog posts are
  displaying at darn.it/posts/i-lost-my-shoe. Easy as pie, er, cake.

  I want to route it so the first parameter in the url is the slug. So
  darn.it/i-lost-my-shoe would map to controller = posts, action =
  view. Below is my routing, but I'm missing something because it's 
  not
  passing the slug to the view method properly. Or maybe it's not
  calling the view method. Any advice?

  Router::connect(
       '/:slug',
       array('controller' = 'posts', 'action' = 'view'),
       array('slug' = '^[a-zA-Z0-9_]{1,}$')
  );

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: falsefalse

2010-03-01 Thread John Andersen
I am using 1.2.5
   John

On Mar 1, 6:18 pm, LunarDraco mdc...@gmail.com wrote:
 Which vs of cake are you both using?

 Also you may want to read this post which talks a little bit about
 containable and hasmany relations. Breaks down when it will work and
 when it won't work. Maybe that will give you some ideas about what
 might be wrong with your setup or how your making the calls to get the
 data your looking for.

 http://stackoverflow.com/questions/1497358/containable-on-hasmany-rel...

[snip]

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


Ajax Pagination

2010-03-01 Thread DAM
I implemented 
http://bakery.cakephp.org/articles/view/easy-ajax-pagination-using-jquery
ajax pagination using jquery.It's working but I wont to search
features I tried but not support ajax how to do it?

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 send a pingback?

2010-03-01 Thread Oliver
Just wanted to second this question.
There doesn't seem to be very much documentation on how to enable
pingbacks in CakePHP... I guess because it's a pretty complex piece of
functionality.

I personally haven't tried setting up such a system, however it would
be interesting to know if anybody has had any luck with pingbacks.
Maybe in the future we will see a pingback behaviour/component/
helper...

On Jan 23, 2:59 am, 5942marine jluken...@gmail.com wrote:
 Has anyone had any success setting cakephp up to send a pingback?

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 send a pingback?

2010-03-01 Thread Graham Weldon


On 02/03/2010, at 8:24 AM, Oliver wrote:

 Just wanted to second this question.
 There doesn't seem to be very much documentation on how to enable
 pingbacks in CakePHP... I guess because it's a pretty complex piece of
 functionality.
 
 I personally haven't tried setting up such a system, however it would
 be interesting to know if anybody has had any luck with pingbacks.
 Maybe in the future we will see a pingback behaviour/component/
 helper...
 
 On Jan 23, 2:59 am, 5942marine jluken...@gmail.com wrote:
 Has anyone had any success setting cakephp up to send a pingback?
 
 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


This post is actually a very good description of the process: 
http://www.quietearth.us/articles/2006/10/30/Coding-your-own-blog-Pingback-in-php
And it links the specification for Pingback too: 
http://www.hixie.ch/specs/pingback/pingback

Essentially, adding either (or both) a X-Pingback header, or html head link 
indicating your pingback url, then implementing that route to a controller that 
handles your pingbacks would do the trick.
In terms of handling the pingbacks, the code you need is spelt out in the first 
article linked above.

This is probably best done as a Component, and could be implemented very easily 
in a non-obtrusive manner.
Let me know if you have any other questions.

Cheers,

Graham Weldon
e. gra...@grahamweldon.com
p. +61 407 017 293
w. http://grahamweldon.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


Miles J Uploader

2010-03-01 Thread Dave
I cant resize an image and just not sure where im going wrong since it seems
pretty clear. I canupload animage but after that when I add the resize I get
nothing.

Ideas?
 
My function:
 
function admin_add() {
  
if (!empty($this-data)) {
   
if ($data = $this-Uploader-upload('image')) {

  $resized_path = $this-Uploader-resize(array('width' =
100));
 
}
  }
 }
 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Intermittent Routing Problems

2010-03-01 Thread JDRopp
Every so often, I find that valid links or redirects from the
controller seems to fail.

In these cases, the user is redirected to the root (which means they
see my login page).

Has anyone else had this sort of 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: Miles J Uploader

2010-03-01 Thread Miles J
Does $resized_path output an actual path? And does the image exist in
the upload directory?

On Mar 1, 3:54 pm, Dave make.cake.b...@gmail.com wrote:
 I cant resize an image and just not sure where im going wrong since it seems
 pretty clear. I canupload animage but after that when I add the resize I get
 nothing.

 Ideas?

 My function:

 function admin_add() {

         if (!empty($this-data)) {

                 if ($data = $this-Uploader-upload('image')) {

               $resized_path = $this-Uploader-resize(array('width' =
 100));

         }
       }
  }

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


Re: Intermittent Routing Problems

2010-03-01 Thread WebRenovator
That is very unusual. What are the conditions on which it fails? Can
you reproduce the problem?


On Mar 2, 2:03 am, JDRopp jeffreyr...@gmail.com wrote:
 Every so often, I find that valid links or redirects from the
 controller seems to fail.

 In these cases, the user is redirected to the root (which means they
 see my login page).

 Has anyone else had this sort of 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: Why Doesn't Anyone Know how to drop in a new URL in a cake framework

2010-03-01 Thread WebRenovator
Hi APD

The reason for this error is two fold:

First, cake is looking for the HawaiitravelblogController which
doesn't exists. This could well be be because there's a routing
problem (the first error you posted) and so it can't find the right
url.

The second problem comes in because of the first. The element expects
to be called from a valid controller. Since the controller failed to
load, the element complains since no controller has been specified.

My guess is that when you solve the routing problem with the
controller, the element will sort itself out.

Nico

On Mar 1, 7:35 pm, APD a...@pawsat.com wrote:
 ?php
         if($this-params['controller'] == islands  
 sizeof($this-params['pass']) == 0) {

                 echo $html-image('step01_5.gif', array('alt'='Step 1: 
 Select an
 Area', 'style'='display:block; margin:auto;'));
         } else if($this-params['controller'] == islands  
 sizeof($this-params['pass'])  0) {

                 echo $html-image('step02.gif', array('alt'='Step 2: Select a
 Property', 'style'='display:block; margin:auto;'));
         } else if($this-params['controller'] == properties  
 $this-params['action'] == details) {

                 echo $html-image('step03.gif', array('alt'='Step 3: Speak to
 Hawaii Hideaways', 'style'='display:block; margin:auto;'));
         } else if($this-params['controller'] == properties  
 $this-params['action'] != details) {

                 echo $html-image('step02.gif', array('alt'='Step 2: Select a
 Property', 'style'='display:block; margin:auto;'));
         } else {
                 echo $html-image('step01.gif', array('alt'='Step 1: Select 
 an
 Island', 'style'='display:block; margin:auto;'));
         }
 ?

 On Mar 1, 12:13 pm, Jeremy Burns jeremybu...@me.com wrote:

  Can you publish the contents of this file:

  /app/views/elements/steps.ctp

  ... to this forum?

  Jeremy Burns

  On 1 Mar 2010, at 16:33, APD wrote:

   I hired someone to add a blog to our website.  I have noticed that
   there are always php errors anytime a new page is created.  In my job
   description, I said Cake knowledge would be necessary.  This was not
   heeded. Those hired dropped in the new url and this is what the page
   reads:

   

   Notice (8): Undefined index:  here [CORE/cake/libs/router.php, line
   763]
   Notice (8): Undefined index:  controller [CORE/app/views/elements/
   steps.ctp, line 2]

   Notice (8): Undefined index:  controller [CORE/app/views/elements/
   steps.ctp, line 4]
   Notice (8): Undefined index:  controller [CORE/app/views/elements/
   steps.ctp, line 6]
   Notice (8): Undefined index:  controller [CORE/app/views/elements/
   steps.ctp, line 8]

   Missing controller

   You are seeing this error because controller
   HawaiitravelblogController could not be found.

   Notice: If you want to customize this error message, create app/views/
   errors/missing_controller.ctp

   Fatal: Create the class below in file: app/controllers/
   hawaiitravelblog_controller.php

   ?php
   class HawaiitravelblogController extends AppController {
     var $name = 'Hawaiitravelblog';
   }
   ?

   

   I unfortunately do not have any specific coding training in Cake or
   php but would like to know what the above means to see if 1) I can fix
   it myself or 2) describe it better to someone who may actually be able
   to fix it.

   Thanks for the help.

   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: .htaccess problems

2010-03-01 Thread WebRenovator
Hi

have a look at 
http://bakery.cakephp.org/articles/view/installing-cakephp-on-shared-hosting

On Mar 1, 6:22 pm, k...@coppcomm.ca k...@coppcomm.ca wrote:
 Hi all,

 I'm trying to configure a default Cake 1.3 installation (www.site.com/
 projadmin, where projadmin is the cake dir) and have been running into
 trouble with our webhost. We're on a shared server, and no matter what
 I try, I cannot get the paths working properly. I have duplicated the
 cake installation on my personal dreamhost server (which is shared)
 and it works automatically without having to change any .htaccess
 rules.

 Our webhost says mod_rewrite is enabled, but the site throws a 404
 error with /c/o/our site/public/projadmin/app/webroot/

 I sent them an email asking about this, and they responded Please be
 advised that you need to use the following path: /services/webpages/c/
 o/our site/

 Now, I've tried lots of different RewriteBase rules in all 3 .htaccess
 files, including the new path they replied with, but I always get a
 404.

 Please help! This has been bothering me for days!

 -- Ken

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