Re: Warning (512)

2011-01-07 Thread Andy Dirnberger
What version of Cake are you using? findAll() was replaced by
find('all') in 1.2.

>From the 1.3 docs: 
>http://book.cakephp.org/view/1017/Retrieving-Your-Data#find-all-1021

On Jan 6, 7:22 pm, AndreGuerreiro  wrote:
> Hi, I got this message callingwww.bodoquemkt.com.br/users/knownusers
> .
>
> This knownusers was created as described 
> onhttp://www.ibm.com/developerworks/opensource/tutorials/os-php-cake1/s...
> .
>
> Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
> check the manual that corresponds to your MySQL server version for the
> right syntax to use near 'findAll' at line 1 [CORE/cake/libs/model/
> datasources/dbo_source.php, line 681]
>
> I wasn´t able to find where to set the MySQL server version.
>
> I´ll apreciate any help. Thank´s.

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: Common Punctuation

2010-11-29 Thread Andy Dirnberger
The 'i' means case insensitive, so you don't need the A-Z anymore:
'/^[\-\'\.\sa-z]+$/i'

On Nov 29, 3:54 am, Stephen  wrote:
> My mistake, "i" goes after the forward slash.
>
> *'rule' => array('custom', '/^[\-\'\.\sa-zA-Z]+$/i'),*
>
> On 29 November 2010 08:53, Stephen  wrote:
>
>
>
>
>
>
>
>
>
> > Try adding an "i" to the end, this worked for me.
>
> > *'rule' => array('custom', '/^[\-\'\.\sa-zA-Z]+$i/'),*
>
> > On 29 November 2010 00:25, Dave Maharaj  wrote:
>
> >> Thanks,
>
> >> I have 'rule' => array('custom', '/^[\-\'\.\sa-zA-Z]+$/'),
>
> >> But the ' will not go thru.
>
> >> I know im an idiot..lol
>
> >> Dave
>
> >> -Original Message-
> >> From: Miles J [mailto:mileswjohn...@gmail.com]
> >> Sent: November-28-10 8:42 PM
> >> To: CakePHP
> >> Subject: Re: Common Punctuation
>
> >> Forgot spaces:
>
> >> /^[\-\.\sa-zA-Z]+$/
>
> >> On Nov 28, 4:08 pm, Miles J  wrote:
> >> > Off the top of my head:
>
> >> > /^[\-\.a-zA-Z]+$/
>
> >> > Regex is probably the easiest approach. Just set it as a custom
> >> > validation rule.
>
> >> > On Nov 28, 1:30 pm, "Dave Maharaj"  wrote:
>
> >> > > I know its not so much Cake question so forgive me ahead of time.
>
> >> > > But does anyone know a regex for common punctuation? I want to put
> >> > > validation on my "City" field where it's a-z and also allow ' - and .
> >> City
> >> > > should not have any numbers. Open to any other ideas that you have
> >> used
> >> also
> >> > > as I hate regex. I do not want people putting in crazy fake names.
> >> Almost
> >> > > impossible to verify the name they enter (imagine that db table of
> >> every
> >> > > possible name of every city / town in the world) so I would like to
> >> ensure
> >> > > its within the realm of being real.
>
> >> > > St.Louis has (.)
>
> >> > > St.John's (.  And ' )
>
> >> > > And other have the - separating words of the name. Cant think of any
> >> else?
> >> > > Any help would be great.
>
> >> > > Thanks,
>
> >> > > Dave
>
> >> 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 >>  om>For more options, visit this group at
> >>http://groups.google.com/group/cake-php?hl=en
>
> >> Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> >> others with their CakePHP related questions.
>
> >> You received this message because you are subscribed to the Google Groups
> >> "CakePHP" group.
> >> To post to this group, send email to cake-php@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> cake-php+unsubscr...@googlegroups.com >>  om>For more options, visit this group at
> >>http://groups.google.com/group/cake-php?hl=en
>
> > --
> > Kind Regards
> >  Stephen @ NinjaCoderMonkey
>
> >  www.ninjacodermonkey.co.uk
>
> --
> Kind Regards
>  Stephen @ NinjaCoderMonkey
>
>  www.ninjacodermonkey.co.uk

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 use CURRENT_TIMESTAMP in find conditions array

2010-09-20 Thread Andy Dirnberger
Did you try array(..., 'ClubsPlayer.start_datetime <=
CURRENT_TIMESTAMP')?

On Sep 19, 5:38 pm, DerBjörn  wrote:
> Hi Zaky,
>
> yes with time() it works like that: ClubsPlayer.start_datetime <=' =>
> date('Y-m-d H:i:s', time()) but i thought there is a easilier way :)
> Thanks anyway!

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 are there no logs?!

2010-09-10 Thread Andy Dirnberger
Which is not what I asked. From core.php:

/**
 * CakePHP Log Level:
 *
 * In case of Production Mode CakePHP gives you the possibility to
continue logging errors.
 *
 * The following parameters can be used:
 *  Boolean: Set true/false to activate/deactivate logging
 *Configure::write('log', true);
 *
 *  Integer: Use built-in PHP constants to set the error level (see
error_reporting)
 *Configure::write('log', E_ERROR | E_WARNING);
 *Configure::write('log', E_ALL ^ E_NOTICE);
 */
Configure::write('log', true);

On Sep 10, 9:30 am, Joshua Muheim  wrote:
> as mentioned above i use
>
> define('LOG_ERROR', 2);
>
> On Fri, Sep 10, 2010 at 3:11 PM, Andy Dirnberger
>
>
>
>  wrote:
> > What are you using for the log setting in core.php?
>
> > On Sep 10, 7:52 am, psybear83  wrote:
> >> Hi everybody
>
> >> From Ruby On Rails I'm used that while developing my log files are
> >> full of informations about what pages were rendered etc.
>
> >> In CakePHP I'm missing this - I don't even seem to have a log file in
> >> my app/tmp/logs directory? Is this normal? I have set
>
> >> define('LOG_ERROR', 2);
>
> >> is this OK? Am I missing anything else?
>
> >> Thanks a lot
> >> 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+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: Why are there no logs?!

2010-09-10 Thread Andy Dirnberger
What are you using for the log setting in core.php?

On Sep 10, 7:52 am, psybear83  wrote:
> Hi everybody
>
> From Ruby On Rails I'm used that while developing my log files are
> full of informations about what pages were rendered etc.
>
> In CakePHP I'm missing this - I don't even seem to have a log file in
> my app/tmp/logs directory? Is this normal? I have set
>
> define('LOG_ERROR', 2);
>
> is this OK? Am I missing anything else?
>
> Thanks a lot
> Josh

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: Need help from a routing "expert"

2010-08-30 Thread Andy Dirnberger
Router::connect('/threads/*', array('controller' => 'threads',
'action' => 'index'));

On Aug 30, 7:52 am, Greg Skerman  wrote:
> Ok so this should be fairly easy right?
>
> I have a few controllers (forums, threads and posts)
>
> The index of the forums controller shows the list of available forums
> The index of the threads controller shows the list of threads for a forum
> (so an ID is passed to the index method)
> The index of the posts controller shows the list of posts within a thread
> (so a forumID and a threadID is passed to the index method).
>
> So my URL's look somewhat awefuli have /threads/index/1 etc
>
> what i'd really like is /threads/1
>
> so i tried Router::connect('/threads/:id', array('controller' => 'threads',
> 'action' => 'index'); to no avail... i tried playing with named arguments
> (which I would prefer to avoid) and still no luck.
>
> Surely it can't be hard to route out the action..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: CakePHP Tags Plugin Question 2

2010-08-02 Thread Andy Dirnberger
There's an error in your syntax. The line should be $filter =
array('Event.postcode' => '4883');

On Aug 2, 11:24 pm, "#2Will"  wrote:
> Sorry but i seem to be struggling today.  Ive got my index page
> showing my paginated list and filtering by tag, but what if i want to
> add in more filters?
>
> so  $filter = array( 'Event.postcode' = '4883')
>
> $this->paginate['Tagged'] = array(
>                         'model' => 'Event',
>                         'tagged',
>                         'by' => $this->passedArgs['by']);
>                 $recipes = $this->paginate('Tagged', $filter);
>
> the filter is just ignored.
>
> Surely im just doing something silly? You must be able to add more
> conditions right?
>
> Thanks,
>
> a confused will.

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: Link with image and text

2010-07-25 Thread Andy Dirnberger
Things will be different if you're using Cake 1.3, but it will be
along the lines of:

$this->Html->link($this->Html->image('folio/thumb/' . $feature['Entry']
[0]['image'], array('alt' => __($feature['Portfolio']['title'], true),
'border' => 0)) . '' . $feature['Portfolio']['title'] . '',
URL_HERE, array('escape' => false));

You can see an example here http://book.cakephp.org/view/1442/link

On Jul 25, 9:32 pm, "Dave Maharaj"  wrote:
> I am trying to place an link which is an html image then text after the
> image.
>
> But all I get is the actual image source in the screen, not the image.
>
> link(
>
> $html->image('folio/thumb/'.$feature['Entry']['0']['image'] , array(
>
> 'alt'=> __($feature['Portfolio']['title'], true), 'border'=>"0")),
>
> ''.$feature['Portfolio']['title'] .'');?>
>
> Thanks
>
> 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: 404 Error in Debug Mode

2010-07-07 Thread Andy Dirnberger
The 404 page is the same. When an error occurs in production mode, the
site will return a 404 instead of the actual error. That's the only
difference in how 404s are handled.

The difference that may be tripping you up is that when debug is set
to 1+ there is an HTML comment appended to the end of your output with
how long it took to build the page. This causes problems with requests
through things like Ajax and Flash. You can see an example of how to
handle the debug setting for Ajax here:
http://book.cakephp.org/view/1292/Obtaining-Request-Information. While
this doesn't directly address your Java applet, hopefully it can get
you started on the right path.

On Jul 7, 12:33 am, jonathan  wrote:
> Hi All,
>
> Working in CakePHP 1.3 and really digging it.  I am having one
> particular issue and I am hoping someone could point me in the right
> direction.
>
> I have a third-party Java applet in my view and as long as the debug
> level is 0 in core.php, it runs fine.  If I set debug to 1 or higher,
> it fails to load.  All things point to the 404 error being different
> for the different debug levels (i.e. 0 gives one type of 404 error, 1+
> gives another).
>
> Is there a way to simulate the non-debug mode 404 error while debug
> mode is set to 1+?  I tried messing with custom error404 files but
> didn't get very far.
>
> Thanks much for any assistance,
>
> Jonathan

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: admin routing.prefix

2010-06-13 Thread Andy Dirnberger
Sounds like you have "private function admin_login()" in
UsersController. Try "public function admin_login()" instead.

On Jun 13, 7:05 pm, Davor Ilic  wrote:
> with this i mean this 
> link:http://groups.google.com/group/cake-php/browse_thread/thread/4a445f48...
>
> 2010/6/14 Davor Ilic 
>
>
>
> > i´ve forgot to say i´ve try this but i only get this issue to ad an method
> > with : admin_admin_login()
>
> > and if i comment  Configure::write('Routing.prefixes', array('admin')); it
> > works but when it try to login it gives me back the login site again i do
> > not know what i am doing wrong...
>
> > 2010/6/14 Davor Ilic 
>
> > Hi caker,
>
> >> i try to use the Prefix Route from cake to say which of my root the admin
> >> is but i have some issue to get to the right site because i do not wanna 
> >> for
> >> the user to say them the hole root where they have to go like this
> >> /admin/users/login
>
> >> i just wanna say add in the after .com/  admin.
>
> >> i ask this because Route.prefix don´t allow me if i use this url:
> >>http://mysite.com/admin
>
> >> it gives me an error back:
>
> >> Private Method in UsersController
>
> >> *Error: **UsersController::**admin_login()* cannot be accessed directly.
> >> what i have to do to make it work?
>
> >> i also have this in my route :
>
> >>  *Router::connect('/admin', array('controller' => 'users', 'action' =>
> >> 'admin_login'));*
>
> >>  be accessed directly.

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

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


Re: can i use html5 in cakephp?

2010-06-10 Thread Andy Dirnberger
I realize that they've fallen behind, but you originally said 2022,
which is a bit further away than 2012.

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

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

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


Re: can i use html5 in cakephp?

2010-06-09 Thread Andy Dirnberger
According to the W3C, they expect to reach the recommendation
milestone for HTML5 in Q3 2010. 
http://www.w3.org/2007/03/HTML-WG-charter.html#deliverables

On Jun 9, 11:11 pm, calvin  wrote:
> You can "use" whatever you want, but HTML5 is nowhere near completion.
> It's not even expected to become a W3C recommendation until 2022, and
> few browsers besides Chrome and Safari even support half of the
> specification.
>
> On Jun 9, 6:40 am, ytbryan  wrote:
>
>
>
> > how do I render html element in cakephp?
>
> > Thanks!
>
> > /Bryan

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

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


Re: Getting .htpasswd protection to work

2010-06-01 Thread Andy Dirnberger
While that may be your FTP user's full path, it most likely isn't your
server's full path. Try putting a file in webroot with the line:
echo __FILE__;

For example, putting that line in a file called path.php will probably
give you /full/path/to/app/webroot/path.php rather than just /app/
webroot/path.php.

On Jun 1, 11:16 pm, Jeff  wrote:
> Hi Andy,
>
> Actually that is my full path.  At least when I FTP to my server,
> immediately in the root directory "/" is the app folder.  Is there
> anything else that could be wrong?
>
> Thanks
>
> On May 12, 9:20 pm, Andy Dirnberger  wrote:
>
>
>
> > You need to use /the/full/path/to/app/.htpasswd.
>
> > On May 12, 11:17 pm, Jeff  wrote:
>
> > > Hi, I have the following in my /app/webroot/.htaccess file, as well as
> > > a matching .htpasswd file in the correct directory per multiple online
> > > how-to's, but my password protection is not working.  Can someone tell
> > > me what I am doing wrong?
>
> > > /app/webroot/.htaccess
>
> > > AuthUserFile /app/.htpasswd
> > > AuthName "Restricted Area"
> > > AuthType Basic
> > > require valid-user
>
> > > 
>
> > >         RewriteEngine On
> > >         RewriteCond %{REQUEST_FILENAME} !-d
> > >         RewriteCond %{REQUEST_FILENAME} !-f
> > >         RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
>
> > > 
>
> > > I saw one tutorial that said I needed to find httpd.conf or something
> > > to that effect, but I don't see anything.  Maybe this config file
> > > doesn't exist with the Cake setup
>
> > > Any help is GREATLY appreciated.
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions 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: $pageTitle not working

2010-06-01 Thread Andy Dirnberger
I got around this by adding the following to
AppController::beforeRender until I was able to clean up the
controllers.

if (!empty($this->pageTitle)) {
  $this->set('title_for_layout', $this->pageTitle);
}

On May 31, 11:27 pm, Miles J  wrote:
> This was the one thing I hated that they changed. Took me the longest
> to go through and update every controller.
>
> The time spent changing this was greater than the time spent upgrading
> to 1.3 as a whole.
>
> On May 31, 6:03 pm, Sergei  wrote:
>
>
>
> > $this->pageTitle was removed in 1.3. Use only $this-
>
> > >set( "title_for_layout", "First Page" ) in controller or template.
>
> > On Jun 1, 8:21 am, SeeVik  wrote:
>
> > > Hello all
>
> > > I just started with CakePHP 1.3.1. I am trying to set the title of a
> > > page. I have defined the title_for_layout in the default layout as
> > > well, still the view does not get the title I want. Instead it
> > > displays the name of controller. Although setting the title_for_layout
> > > in the view template works fine. Here's what I am doing
>
> > > // /app/controllers/nodes_controller.php
> > > class NodesController {
> > >   $name = "Nodes";
> > >   $uses = array();
> > >   $helpers = array( "Html" );
> > >   function index() {
> > >      $this->pageTitle = "First Page"; // This does not work
> > >   }
>
> > > }
>
> > > // /app/views/nodes/index.ctp
> > > set( "title_for_layout", "First Page" ); // This works ?>
>
> > > What am I doing wrong here? Can somebody help me out.
>
> > > Thanks and Regards
> > > ShiVik

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

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


Re: 1.3 prefix routing.

2010-05-28 Thread Andy Dirnberger
In your controller, the current prefix is stored in $this-
>params['prefix']. It's also available through Router::currentRoute()-
>defaults['prefix'].

On May 27, 6:45 pm, aleph1  wrote:
> I can't see how to retrieve the current prefix that is being used for
> routing purposes.
>
> For example, if I configure Routing.prefixes as follows:
>
> Configure::write('Routing.prefixes', array('admin','moderator'));
>
> How do I retrieve the current prefix when a page is viewed?
>
> In 1.2 this was Configure::read('Routing.admin');, but I can't seem to
> find an equivalent for 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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: case sensitivity on certain hosting

2010-05-27 Thread Andy Dirnberger
Does that host have a "users" folder at ..users?

On May 27, 11:37 am, leo  wrote:
> I'm having a problem on one of our hostings with case sensitivity.
> Strangely, it is only on the 'users' controller.
>
> If I do '..users/login' it doesn't work. If I do '..Users/login' it
> does.
> If I move the application to a subfolder, it works for both upper and
> lower cases.
> No other controllers are affected.
> It leads to problems downstream when auth starts writing urls in
> lowercase.
>
> Anybody seen this before and/or have a solution?
>
> Thanks.

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

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


Re: How can I consolidate conditions that I will use for every find?

2010-05-22 Thread Andy Dirnberger
This is just a rough idea and will need to be completed (and probably
improved some), but hopefully it can get you started.

In AppModel:

var $schedule_id;

function find($conditions = null, $fields = array(), $order = null,
$recursive = null) {
  if (is_array($conditions)) {
if (!array_key_exists('conditions', $conditions))
$conditions['conditions'] = array();
$conditions['conditions']['schedule_id'] = $this->schedule_id;
  }
  else if (is_array($fields)) {
if (!array_key_exists('conditions', $fields))
$fields['conditions'] = array();
$fields['conditions']['schedule_id'] = $this->schedule_id;
  }

  return parent::find($conditions, $fields, $order, $recursive);
}

And then in your controller:

$this->Model->schedule_id = $schedule_id;
$result = $this->Model->find(...);

On May 22, 10:07 am, shantamg  wrote:
> @Andrel: I'd love to be able to set the conditions in the model, but
> the model can't know what's in the session!
>
> @Paul:
>
> > > $this->Person->contain('Hobby', 'Job');
>
> > I've never seen anyone set containable options like above, I thought
> > they had to be within the find options array
>
> http://book.cakephp.org/view/857/Containing-deeper-associations
>
> > I don't see how your conditions array can be set the same for every
> > model within your schema as I doubt every model is directly associated
> > to People for the conditions People.schedule_id to work.
>
> Every model is related to the Schedule model. So I was thinking of
> something like this in the appController:
>
> $this->{$model}->conditions->array('schedule_id' => $schedule_id);
>
> but i don't think that will work...
> Also, every related model has to be given those conditions in the
> containable:
>
> $this->[$model}->contain(
>     "{$related_model1}.schedule_id = $schedule_id",
>     "{$related_model2}.schedule_id = $schedule_id"
> );
>
> > And what about the finds where a user is not logged in/has not created
> > a session, they can't have a schedule_id set?
>
> No user has to be logged in. I am doing this in the appController:
>
> function beforeFilter() {
>     // put the latest published schedule into the session
>     if (!$this->Session->check('Schedule')) {
>         $schedule = ClassRegistry::init('Schedule')->find('first',
>                 array('order' => 'id desc')
>         );
>         $this->Session->write('Schedule', $schedule['Schedule']);
>     }
>
> }
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


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

2010-05-18 Thread Andy Dirnberger
You may want to take a look at prefix routing (admin routing prior to
1.3) http://book.cakephp.org/view/950/Prefix-Routing.

On May 18, 9:58 am, Andrei Mita  wrote:
> Thank Renato. Actually I was thinking to develop two separate cake apps: one
> to run the website for the end-users and one, nested inside the main cake
> app, to run the administration panel.
>
> for instance: mywebsite.com for end-users and mywebsite.com/oven for admins
>
> Any other suggestions?
>
> On Tue, May 18, 2010 at 4:27 PM, Renato de Freitas Freire <
>
>
>
>
>
> renat...@gmail.com> wrote:
> > I like to do all the client system first, then I do another system,
> > completly diferent to admin stuff.
> > Even cake having the admin route, I dont like to use it.
> > That way, I can put it in another url, so, guessing my admins urls is not a
> > trivial thing...
> > so, if one day, someone find a bug in cake admin route, my systems will be
> > safe.
>
> > I just heard that there is some robots scanning cake's urls for an open
> > scafold. So, I just want to prevent this things.
> > I dont know if it is the better way, but the work is the same.
>
> > sry my bad english.
>
> > --
> > Renato de Freitas Freire
> > ren...@morfer.org
>
> > On Tue, May 18, 2010 at 5:38 AM, Andrei Mita wrote:
>
> >> Hello,
>
> >> I'm getting ready to start a real project using Cake and the first
> >> question is: how to separate controllers, actions and views for end-users
> >> and admins.
>
> >> I mean, is there a recommended way of doing the splitting or is it enough
> >> to create separate actions for end-users and for admins?
>
> >> For instance is it OK to have in Articles controller index() and
> >> admin_index() ?
>
> >> Thanks
>
> >> Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> >> others with their CakePHP related questions.
>
> >> You received this message because you are subscribed to the Google Groups
> >> "CakePHP" group.
> >> To post to this group, send email to cake-php@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> cake-php+unsubscr...@googlegroups.com >>  om>For more options, visit this group at
> >>http://groups.google.com/group/cake-php?hl=en
>
> >  Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> > others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Problems with URLs causing flash too break

2010-05-18 Thread Andy Dirnberger
Do you have a crossdomain.xml file?

On May 17, 8:21 pm, Cycling_Joe  wrote:
> Can anyone guide me to what I am doing wrong.
> If the www is omitted in my url's it causes my flash  files to break.
> If I go tohttp://www.mysite.comeverything is fine.
> If I go tohttp://mysite.comall my flash files show "undefined"
>
> Or is there an easy way to redirect any request missing the 
> wwwhttp://mysite.com/somepage tohttp://www.mysite.com/somepage
>
> Any ideas/links would be helpful.
> Sorry, brand new to Cake and need to fix this quick.
> Thanks
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Getting .htpasswd protection to work

2010-05-12 Thread Andy Dirnberger
You need to use /the/full/path/to/app/.htpasswd.

On May 12, 11:17 pm, Jeff  wrote:
> Hi, I have the following in my /app/webroot/.htaccess file, as well as
> a matching .htpasswd file in the correct directory per multiple online
> how-to's, but my password protection is not working.  Can someone tell
> me what I am doing wrong?
>
> /app/webroot/.htaccess
>
> AuthUserFile /app/.htpasswd
> AuthName "Restricted Area"
> AuthType Basic
> require valid-user
>
> 
>
>         RewriteEngine On
>         RewriteCond %{REQUEST_FILENAME} !-d
>         RewriteCond %{REQUEST_FILENAME} !-f
>         RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
>
> 
>
> I saw one tutorial that said I needed to find httpd.conf or something
> to that effect, but I don't see anything.  Maybe this config file
> doesn't exist with the Cake setup
>
> Any help is GREATLY appreciated.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: array dump

2010-05-10 Thread Andy Dirnberger
http://book.cakephp.org/view/1128/debug

On May 10, 9:06 pm, bradmaxs  wrote:
> Can anyone tell me how to get:
>
> Array
> (
>     [0] => Array
>         (
>             [Portfolio] => Array
>                 (
>                     [id] => 1
>                     [user_id] => 0
>                     [url] => 29thstreetrep.com
>                     [description] => Off-Broadway New York City
> theater company known for its brutal play selections.
>                     [domain_start] => 1999-08-02
>                     [domain_expire] => 2011-08-02
>                     [domain_owner] => David Mogentale
>                     [host] => BMCO
>                     [category] => theatre
>                     [status] => current
>                     [img] => portfolio_29thstreetrep.gif
>                     [created] =>
>                     [modified] =>
>                 )
>
> IN MY VIEW??
>
> I have done it in the past and somehow didn't keep the code snippet
> around.
>
> Has it changed in 1.3 now that debug 3 is gone?
>
> I do have the echo $this->element('sql_dump'); but it does not have
> the array data.
>
> thanks
>
> Brad
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: 1.3 omit attribute

2010-05-09 Thread Andy Dirnberger
I agree. While the for attribute is optional, Cake assigns an id
attribute to your inputs so it only makes sense that it would assign a
for attribute to the associated label.

You said you aren't using the label with an input field, which is the
purpose of the label element. If that really is the case then you need
to find a different element for your table column header. Since you
said you are using th elements, I'm not really sure why you need the
label. What is your desired HTML output?

On May 9, 3:32 pm, euromark  wrote:
> i dont think the "for" element should be omitted for labels
> as it is part of it - there are lots of other xhtml elements that
> would be more appropriate if there is no id to refer to
>
> On 9 Mai, 20:21, Zaky Katalan-Ezra  wrote:
>
>
>
>
>
> > I use  for column headers, thank you.
> > But this wasn't my question.
> > How do I omit the automated 'for'  attribute for the $this->Html->label.
>
> > On Sun, May 9, 2010 at 1:01 AM, Andy Dirnberger
> > wrote:
>
> > > Labels are supposed to be used with input fields. You should be using
> > >  for table column headers.
>
> > > On May 8, 4:13 pm, ZAky  wrote:
> > > > I am trying to omit the auto generated  'for' attribute for
> > > $this->Html->label with no success.
>
> > > > I tried:
> > > > $this->Form->label('status','Status',array('for'=>false [or] null));
>
> > > > and this
>
> > > > $this->Form->label('status','Status',array('label'=>array('for'=>false
> > > > [or] null)));
>
> > > > Just using Form->label('status');?> produce
> > > > Status
> > > > When I use it for table columns header I have no element with
> > > > id="status".
> > > > The W3C Validation Service also arise a warning about it.
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>For more options, visit this group athttp://
> > > groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com > >  om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> > --
> > Regards,
> > Zaky Katalan-Ezra
> > QA Administratorwww.IGeneriX.com
> > Sites.IGeneriX.com
> > 054-7762312
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: 1.3 omit attribute

2010-05-08 Thread Andy Dirnberger
Labels are supposed to be used with input fields. You should be using
 for table column headers.

On May 8, 4:13 pm, ZAky  wrote:
> I am trying to omit the auto generated  'for' attribute for 
> $this->Html->label with no success.
>
> I tried:
> $this->Form->label('status','Status',array('for'=>false [or] null));
>
> and this
>
> $this->Form->label('status','Status',array('label'=>array('for'=>false
> [or] null)));
>
> Just using Form->label('status');?> produce
> Status
> When I use it for table columns header I have no element with
> id="status".
> The W3C Validation Service also arise a warning about it.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: how to select from subquery result

2010-05-07 Thread Andy Dirnberger
So you want the block_ids that have the most recent date, not the most
recent date for each block_id?

On May 7, 1:23 pm, Eleazar  wrote:
> unfortunately that query does not produce the rusult I want. The
> HAVING MAX() seems logical but it doesn't change the results. Problem
> is that the group function groups by seemingly random record, not the
> latest one. If I could sort by date then group that would work, but
> sql does not allow this. Therefore my subquery to fix the problem.
>
> See this article of what I want to 
> do:http://dev.mysql.com/doc/refman/4.1/en/example-maximum-column-group-r...
> If you look in the comments section you will see the query I'm trying
> to implement.
>
> A very strange thing occurred. I called my custom query with some
> joins (basically the one generated by a find, and wrapped with a
> select statement as in my first post) model->query(sql). It works fine
> on my localhost but on the online server the array returned from the
> query is in the form of the alias from the query eg
> [0] -> [alias] -> "all values listed here from all tables joined in
> query"
> [1] -> etc.
>
> On the localhost it keeps the format of
> [0]->[Original table name]->values,
>        [original table name 2]->values
> [1]-> etc.
>
> What on earth could cause this? I have no idea where to begin! Why is
> the returned array not formatted  in the usual way? Why would it work
> on the localhost but not on the online server? Any ideas will be
> appreciated!
>
> On May 7, 4:08 pm, Andy Dirnberger  wrote:
>
>
>
>
>
> > Why use the subquery?
>
> > SELECT * FROM mytable WHERE some_id = 1 GROUP BY block_id HAVING
> > MAX(date)
>
> > or:
>
> > $Model->find('all', array(
> >   'conditions' => array('Model.some_id' => 1),
> >   'group' => ('Model.block_id HAVING MAX(date)'),
> > );
>
> > On May 7, 6:16 am, Eleazar  wrote:
>
> > > Hello
> > > for the life of me I coudn't find an example of how to do the
> > > following:
> > > SELECT * FROM (SELECT * FROM mytable WHERE some_id=1 ORDER BY DATE
> > > DESC) t1 GROUP BY block_id
>
> > > The query needs to select the latest entries for each block_id in the
> > > table (like selecting the latest comment for each blog post would be
> > > an equivalent scenario).
>
> > > I would need to implement this with pagination, but I would just like
> > > to get it to work with find() for now.
>
> > > Is a custom query maybe the only way to do this?
>
> > > Thanks!
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: how to select from subquery result

2010-05-07 Thread Andy Dirnberger
Why use the subquery?

SELECT * FROM mytable WHERE some_id = 1 GROUP BY block_id HAVING
MAX(date)

or:

$Model->find('all', array(
  'conditions' => array('Model.some_id' => 1),
  'group' => ('Model.block_id HAVING MAX(date)'),
);

On May 7, 6:16 am, Eleazar  wrote:
> Hello
> for the life of me I coudn't find an example of how to do the
> following:
> SELECT * FROM (SELECT * FROM mytable WHERE some_id=1 ORDER BY DATE
> DESC) t1 GROUP BY block_id
>
> The query needs to select the latest entries for each block_id in the
> table (like selecting the latest comment for each blog post would be
> an equivalent scenario).
>
> I would need to implement this with pagination, but I would just like
> to get it to work with find() for now.
>
> Is a custom query maybe the only way to do this?
>
> Thanks!
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Cakephp Ajax is not including the javascripts in the view

2010-04-30 Thread Andy Dirnberger
I believe the src attribute of any script tag loaded through an Ajax
call is ignored; all JavaScript needs to be included in the original
page load or embedded directly in the response.

On Apr 30, 3:23 am, Vijay  wrote:
> Thanks for reply andrei.
>
> I am calling the normal javascript functions or any javascript file.
> I have some jquery effects for the text boxes & drop downs. That are
> not including when the ctp get called.
>
> my code is,
>
>  echo $html->css('mycss);
>
> echo $html->script(array('jquery', 'another script'));?>
>
> rest my html code
>
> It is including the css but no js is included.
> here i am using jquery with prototype.
>
> On Apr 30, 12:10 pm, Andrei Mita  wrote:
>
>
>
>
>
> > What type of js do you have in the loaded ctp?
>
> > Maybe you forgot to include something in the layout.
>
> > It's a blind guess without seeing the actual code. At least for me.
>
> > On Fri, Apr 30, 2010 at 9:23 AM, Vijay  wrote:
> > > Hello All,
>
> > > I am using the ajax for the internal links in my site.
>
> > > When i click on the link & the new ctp loads, it is not including the
> > > javascripts that are included in that ctp.
> > > So the effects are not working.
>
> > > It includes the css but not including the javascript.
>
> > > Any idea.
>
> > > Thanks,
>
> > > Vijay Kumbhar,
> > > CTO, Weboniselab.
> > > 9766251100
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com > >  om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: wordpress integration without seperate url

2010-04-29 Thread Andy Dirnberger
I think mex is talking about dropping WordPress right into the webroot
folder with the ultimate goal being to have http://www.example.com/users
going to UsersController in Cake and http://www.examples.com/some-post/
going to WordPress. The problem is, .htaccess would have no easy way
of knowing for which system to rewrite the URL. There needs to be
something in the URL to trigger one system over the other.

The only solution I can think of that isn't a complete nightmare of
rewrite rules is to not use mod_rewrite with WordPress, and put in
rewrite rules for things like p= and s=. And if you wanted to use
WordPress's home page you'd need to add a rule for /.

On Apr 29, 10:18 am, Andrei Mita  wrote:
> What do you mean by "dont want it to be on a seperate url like /blog"?
>
> You don't want it to be domain.com/blog ?
>
>
>
>
>
> On Thu, Apr 29, 2010 at 4:35 PM, meximex  wrote:
> > no solutions
>
> > On 23 Apr., 09:19, meximex  wrote:
> > > hi,
> > > i would like to include wordpress into my cakephp application but i
> > > dont want it to be on a seperate url like /blog.
>
> > > reasons for that are that the users looses his session inside the
> > > site, looses the usermenu (i know i could do that by ajax..)
>
> > > isnt there a way to just "include" the blog files?
>
> > > btw. i am looking for a forum that can be "included" very easy
> > > too... ;-)
>
> > > regards,
> > > mex
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com > >  om>For more options, visit this group athttp://
> > groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions 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: Checking multiple columns for duplication checking in model

2010-04-22 Thread Andy Dirnberger
My example does not compare field1 and field2 for uniqueness against
each other, it compares field1 and field2 against the database. When
creating a new record, it will check that the combination of
field1+field2 doesn't already exist in the database. When updating a
record it will check that the combination of field1+field2 doesn't
exist in the database unless the primary key of the submitted data
matches the primary key of the record in the database.

On Apr 22, 3:02 pm, John Andersen  wrote:
> Thanks Euromark,
>
> I actually don't think that PHP code is the correct solution to this
> check :) I think that the correct solution is to let the database
> handle the unique check. The model will then be passed back the error
> and will take action on it (by the code we write). Probably there
> should be a translation of the error codes in between the database and
> the model (datasource?).
>
> The code that Andy D. (sample) and you posted will, as far as I
> understand, only handle the case of ensuring uniqueness in the
> submitted data, not in both the submitted data and the existing data
> in the table. Correct me if I am wrong :)
>
> Enjoy,
>    John
>
> On Apr 22, 6:08 pm, euromark  wrote:
> [snipped code from euromark]
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Validate on

2010-04-22 Thread Andy Dirnberger
Check the Cookbook http://book.cakephp.org/view/127/One-Rule-Per-Field

On Apr 22, 10:10 am, Angelo  wrote:
> Hello,
>
> I juste discover ina blog article that we can use a "on" value in
> $validate array.
>
> Is there somewehere documentation about all value we can put in
> $validate array?
>
> Thanks!
>
> Angelo
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: Checking multiple columns for duplication checking in model

2010-04-21 Thread Andy Dirnberger
Here's a stripped down example of how I do it:

app_model.php
class AppModel extends Model {

  ...

  function isUniqueMulti($data, $fields) {
if (!is_array($fields)) {
  $fields = array($fields);
}

foreach ($fields as $key) {
  $tmp[$key] = $this->data[$this->name][$key];
}

return $this->isUnique($tmp, FALSE);
   }
}

some_model.php
class SomeModel extends AppModel {
  var $validate = array(
'field1' => array(
  'rule' => array('isUniqueMulti', array('field1', 'field2')),
  'required' => TRUE,
  'message' => 'Error Message',
),
'field2' => array(
  'rule' => 'notEmpty',
  'required' => TRUE,
  'message' => 'Error Message',
),
  );
}

On Apr 21, 8:40 am, Swanny  wrote:
> Is there a way in a model to verify that a record does not exist
> already that matches a certain criteria. In the database table are
> three columns: id, list_id and product_id. I would like to be able to
> tell if there already exists a record with the same list_id AND
> product_id as the one being added using the form which would then
> produce an error as this would be a duplicate.
>
> Example: I try to add a product with product_id 23 and list_id 12 but
> the table already contains a record with this information.
>
> Thanks
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


Re: is it advisable to use jquery on cakephp?

2010-04-19 Thread Andy Dirnberger
Check out JsHelper in 1.3 
http://book.cakephp.org/view/1594/Using-a-specific-Javascript-engine

On Apr 19, 10:17 am, Bryan Lim  wrote:
> question as above.
> I also want to ask if there's an official jquery helper for cakephp?
> The one at the bakery is kinda outdated.
>
> thanks!
> Bryan
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.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: Can I stop the page from re-rendering after a form submission?

2010-04-14 Thread Andy Dirnberger
Cake doesn't insist on anything. The nature of clicking a submit
button in a form is to submit the form. That means the browser sends
the post/get request to the server and loads the response. If you want
different behavior, you need to catch the submit event through
JavaScript and cancel it.

The most basic way is , although
this would block all submissions. You can do onsubmit="return
someFunction();" and have someFunction return true if you want to
submit the form, and return false if you don't. Or you can use a
library, like jQuery, and do something along the lines of $
('form').submit(function(e) { ... }); and conditionally call
e.preventDefault() if you don't want to submit the form.

You can also look into Cake's JavaScript helper.

On Apr 14, 7:02 am, WhyNotSmile 
wrote:
> I have a question which may be very basic - I'm not sure whether I've
> just tied my brain in knots from thinking about it!  Apologies if so.
>
> I have a form which has various buttons.  One of them is a 'Preview',
> which pops up a new window (well, a PDF) when clicked.  At the moment,
> there is some javascript going on, which enables and disables various
> buttons when the page is loaded.  However, if the Preview button is
> clicked, I don't want the page to reload afterwards, because it will
> then apply these changes to the buttons, which I don't want...
>
> Cake seems to insist that I have to go somewhere after form submission
> (and for all the other buttons it does a reload of the current page,
> which is fine), so is there a way to stop this from happening?
>
> I hope that makes sense; I'm not sure I've explained it very well, but
> as I say, my brain is confused!
>
> 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

To unsubscribe, reply using "remove me" as the subject.


Re: Allowing access to plugin pages

2010-04-09 Thread Andy Dirnberger
Try $this->Auth->allow('*'). I think the addition of array() is what's
tripping you up.

On Apr 9, 4:48 pm, TobyG  wrote:
> Hi there,
>
> Just wondering how to grant access to a plugin page using Auth.
>
> Have tried using...
>
> $this->Auth->allow(array('*'));
>
> in the before filter for the controller app, which is being called,
> but it doesn't seem to make a difference.
>
> Any ideas?
>
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.


Re: Yet another HABTM multiple checkbox query, cakePHP 1.3 RC3

2010-04-05 Thread Andy Dirnberger
Why are you trying to save to the relationship table? Cake will do
that for you automatically.

What does your view look like (at least the part that creates the
form)? Provided your HABTM is set up correctly in the models and view,
calling $this->Model->save($this->data) in the controller should be
sufficient.

On Apr 5, 9:12 am, tricky999  wrote:
> I'll apologise now! There seems to be loads of advice about HABTM in
> cake, but I still can't quite get the answer to my particular problem.
>
> I have two tables and a join_table.  On my view, I have created a
> form, which has a multiple checkbox.  The problem I am having is that
> this is not returned in a format that I can save it in.
>
> Using debug($this->data), I get this returned to my edit action:
>
> Array
> (
>     [PortfolioEntry] => Array
>         (
>             [id] => 78
>             [when] => Array
>                 (
>                     [day] => 04
>                     [month] => 04
>                     [year] => 2010
>                 )
>
>             [title] => Another test
>             [description] => H, will this work I wonder?  It
> might, although if you do not include full stops it doesn't!
>             [benefit] => Hello mucker.
>             [activity_id] => 2
>         )
>
>     [KsfDimensionsPortfolioEntry] => Array
>         (
>             [portfolio_entry_id] => 78
>             [ksf_dimension_id] => Array
>                 (
>                     [0] => 36
>                     [1] => 37
>                     [2] => 38
>                     [3] => 39
>                 )
>
>         )
>
> )
>
> The PortfolioEntry bit is saved absolutely fine, however, when I try
> to update the join_table with the KsfDimensionsPortfolioEntry part, I
> get an SQL error, since the ksf_dimension_id is an array.
> I am pretty sure that this array should be something like:
>
> [KsfDimensionsPortfolioEntry] => Array
>         (
>            [0] => array(
>                       [portfolio_entry_id] => 78
>                       [ksf_dimension_id] => 36
>             (
>             [1] => array(
>                       [portfolio_entry_id] => 78
>                       [ksf_dimension_id] => 36
>             )
>       etc
>
> but I can't for the life of me come up with a 'cake' way of doing it!
> Any assistance would be gratefully received.
>
> Cheers.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Retrieving objects from the DB instead of arrays

2010-03-30 Thread Andy Dirnberger
Why not perform your manipulations in afterFind? 
http://book.cakephp.org/view/681/afterFind

If you add an 'age' key to the result in the callback (my guess is you
store the date of birth in the database, not the current age), you can
then use $person['Person']['age'] in your view.

On Mar 30, 11:31 pm, paws_galuten  wrote:
> I'm new to cakePHP and it seems like the only way to retrieve data
> from the data source is as an array. I'm finding that I am using a lot
> of code in my controller to prepare the arrays for display in the
> view, when I would rather be able to send an object to the view and
> get data from that object.
>
> For example, if I had a person object, I could have an attribute that
> was their birthdate and in the view I could easily get their age with
> something like $person->getAge(). If I only have the person as an
> array, then I have to do the calculating of the age before I can
> display it.
>
> Does this make sense? It is a simplistic example, but I can see myself
> having to write a lot of code to manipulate arrays before the raw
> database data is usable.
>
> Thanks for your insights,
> Jason

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

To unsubscribe, reply using "remove me" as the subject.


Re: How use __consruct in model

2010-03-09 Thread Andy Dirnberger
You need to do two things:
1. Accept all of the parent constructor's parameters
2. Call the parent constructor

function __construct($id = false, $table = null, $ds = null) {
  parent::__construct($id, $table, $ds);

  ...

}

That said, I'm not exactly sure what you're doing with parent::$this-
>VAR. You don't need "parent::," and, if all you're doing to do in the
constructor is assign a few values, you can skip the constructor
altogether:
class TypeDeal extends AppModel {
  var $useTable = null;
  var $general = true;

  ...

}

On Mar 9, 1:10 am, Jets  wrote:
> Hi,  i am trying to use constructor in models. my code is that
>
>  class TypeDeal extends AppModel {
>         var $name ='TypeDeal';
>
>         var $validate =array(
>         'id' => array('rule' => 'notEmpty', 'message' => 'Not Empty')
>         );
>         function __construct(){
>         //      parent::$this->useTable=null;
>                 //set the $generic variable for enabling the functions 
> defined in
> AppModel
>                 parent::$this->generic=true;
>         }
>
> }
>
> but its not working. can anyone tell me , how we can use this...

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: Calling custom methods in related models

2010-03-07 Thread Andy Dirnberger
> > What happens if you change SisField::$hasMany to var $hasMany =
> > array('SisQueue');?
>
> pardon for my dumbness but I did not understand what you are asking me
> to do...in the model hasMany is already var hasMany=
>

I'm asking you to change $hasMany from what you have to the shorter
version I posted.

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: Calling custom methods in related models

2010-03-06 Thread Andy Dirnberger
What happens if you change SisField::$hasMany to var $hasMany =
array('SisQueue');?

On Mar 6, 9:02 pm, mathaios  wrote:
> yes Paul this is the problem!
>
> $this->SisField->SisQueue->belongsTo does return an empty array
> instead of the real one. Clearly Cake is auto-creating the model.
> I have tested all other model related to SisField and none of them is
> the "real one": all are re-created by Cake.
>
> Maybe it's related of this being a plug-in and could be a bug ?
>
> On Mar 6, 8:41 am, WebbedIT  wrote:
>
>
>
> > That looks correct to me, to test if the problem is with the function
> > name put() I just added a method to one of my models and called it via
> > another model from a controller without issue so that's not the
> > problem.
>
> > Can you access any of that models attributes/methods?  how about :
>
> > echo debug($this->SisField->SisQueue->belongsTo);
>
> > I think that cake is not finding the model for some reason and is
> > therefore creating it's own auto-model which obviously will not
> > include the put() method.  Confusing as your model's filename seems to
> > be correct, but the above should test this.
>
> > HTH
>
> > Paul.

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

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


Re: Calling custom methods in related models

2010-03-04 Thread Andy Dirnberger
What is the actual name of model2 and what is its filename? If the
file isn't being found, model2 is of type AppModel and not model2,
which would explain why you can't access a method defined in model2.

On Mar 4, 12:36 pm, mathaios  wrote:
> Hallo all bakers! I hope someone can help me...
>
> I have two models related trough a "to many-belongs to" relationships.
> I've set in model2 a method called "put" that do some db manipulation.
>
> But when I call the "put" method from the related model1 controller
> (as $this->model1->model2->put() ) the method name get's executed like
> an SQL query!
> But if I call something like e.g. $this->model1->model2->find('all')
> records are correctly fetched.
>
> What can be the problem? I'm getting mad on this !
> Thanks for any advice

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: file upload with ajax

2010-03-03 Thread Andy Dirnberger
XMLHttpRequest cannot upload files. The two ways to give the
appearance of Ajax are with Flash (e.g., Uploadify, SWFUpload, etc.)
and with an iframe.

Either way, only the data from $_POST ends up in $this->data. To
access any uploaded files, you need to use $_FILES.

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: Question about relationships, extending the blog tutorial

2010-02-25 Thread Andy Dirnberger
Glad to hear you were able to get that resolved.

Check out the documentation for the Auth component
http://book.cakephp.org/view/172/Authentication, in particular the
user method http://book.cakephp.org/view/387/user.

On Feb 24, 3:04 pm, deek  wrote:
> Andy,
>
> It looks like the debug issue was the problem and everything is now
> working properly.
>
> My final question is this.  Once a user is logged on (through the
> built-in Auth of CakePHP), what built-in functions should I use to
> determine that user's id number? For that matter what is a good way to
> test of a user is logged on or not? I ask because I would like some
> options/posts to be shown only to logged in (Admin) users.
>
> Currently this is my form for creating an new post:
> Add Post
>  echo $form->create('Post');
> echo $form->input('title');
> echo $form->input('category');
> echo $form->input('body', array('rows' => '10', 'columns' => '40'));
> echo $form->radio('frontpage', array('1'=>'Yes','0'=>'No'));
> echo $form->end('Save Post');
> ?>
>
> I want to thank everyone who has helped out with my questions.
>
> On Feb 24, 7:21 am, Andy Dirnberger  wrote:
>
>
>
> > If you have debug set to 0 in core.php and added displayname to the
> > user table after Cake first saw the it, you need to update the cache
> > of the table's layout. (Either set debug to 1, reload the page, and
> > set it back to 0 or delete the file in tmp.)
>
> > On Feb 24, 2:36 am, deek  wrote:
>
> > > Also when I try and add a user with this form
> > > Add User
> > >  > >     echo $form->create('User', array('action' => 'register'));
> > >     echo $form->input('username');
> > >     echo $form->input('displayname');
> > >     echo $form->input('password');
> > >     echo $form->end('Add User');
> > > ?>
>
> > > the displayname never makes it to the MySQL database. I have no idea
> > > why not
>
> > > On Feb 23, 11:27 pm, deek  wrote:
>
> > > > Well everything seems to be working now with "var $belongsTo =
> > > > array('User');" but I have tried putting " > > > ['displayname']; ?>" in my index.ctp and the it does not output any of
> > > > the information.  If I put  or  > > > echo $post['User']['username']; ?> those values will output just fine
> > > > but not displayname, what might cause this?
>
> > > > On Feb 23, 8:36 pm, Andy Dirnberger  wrote:
>
> > > > > Did you try just using "var $belongsTo = array('User');"? The values
> > > > > you are supplying for className and foreignKey should be the defaults.
>
> > > > > If you remove the $belongsTo piece, do your posts show up again? If
> > > > > not, what else did you change? What code do you currently have in your
> > > > > controller? No special code is needed in your controller to handle
> > > > > relationships, and you'd only need to add code to your User model
> > > > > (e.g., var $hasMany = array('Post');) if you wanted posts to be
> > > > > retrieved every time you query your user table, which you probably
> > > > > don't.
>
> > > > > Once you have it working, 'User'] will be added as an index alongside
> > > > > 'Post' (e.g., $post['User']['displayname']).
>
> > > > > On Feb 23, 5:16 pm, deek  wrote:
>
> > > > > > So I updated my post model to what you see below and now when I go 
> > > > > > to
> > > > > > my index (index.ctp) view that I have listed on my first post 
> > > > > > nothing
> > > > > > shows up. Do I need to add anything in the controllers or the user
> > > > > > model?  Once get it to show properly how would I call the the User
> > > > > > displayname in my foreach loop in the index.ctp?
>
> > > > > > class Post extends AppModel {
> > > > > >     var $name = 'Post';
> > > > > >     var $belongsTo = array (
> > > > > >         'User' => array(
> > > > > >             'className' => 'User',
> > > > > >  

Re: Question about relationships, extending the blog tutorial

2010-02-24 Thread Andy Dirnberger
If you have debug set to 0 in core.php and added displayname to the
user table after Cake first saw the it, you need to update the cache
of the table's layout. (Either set debug to 1, reload the page, and
set it back to 0 or delete the file in tmp.)

On Feb 24, 2:36 am, deek  wrote:
> Also when I try and add a user with this form
> Add User
>      echo $form->create('User', array('action' => 'register'));
>     echo $form->input('username');
>     echo $form->input('displayname');
>     echo $form->input('password');
>     echo $form->end('Add User');
> ?>
>
> the displayname never makes it to the MySQL database. I have no idea
> why not
>
> On Feb 23, 11:27 pm, deek  wrote:
>
>
>
> > Well everything seems to be working now with "var $belongsTo =
> > array('User');" but I have tried putting " > ['displayname']; ?>" in my index.ctp and the it does not output any of
> > the information.  If I put  or  > echo $post['User']['username']; ?> those values will output just fine
> > but not displayname, what might cause this?
>
> > On Feb 23, 8:36 pm, Andy Dirnberger  wrote:
>
> > > Did you try just using "var $belongsTo = array('User');"? The values
> > > you are supplying for className and foreignKey should be the defaults.
>
> > > If you remove the $belongsTo piece, do your posts show up again? If
> > > not, what else did you change? What code do you currently have in your
> > > controller? No special code is needed in your controller to handle
> > > relationships, and you'd only need to add code to your User model
> > > (e.g., var $hasMany = array('Post');) if you wanted posts to be
> > > retrieved every time you query your user table, which you probably
> > > don't.
>
> > > Once you have it working, 'User'] will be added as an index alongside
> > > 'Post' (e.g., $post['User']['displayname']).
>
> > > On Feb 23, 5:16 pm, deek  wrote:
>
> > > > So I updated my post model to what you see below and now when I go to
> > > > my index (index.ctp) view that I have listed on my first post nothing
> > > > shows up. Do I need to add anything in the controllers or the user
> > > > model?  Once get it to show properly how would I call the the User
> > > > displayname in my foreach loop in the index.ctp?
>
> > > > class Post extends AppModel {
> > > >     var $name = 'Post';
> > > >     var $belongsTo = array (
> > > >         'User' => array(
> > > >             'className' => 'User',
> > > >             'foreignKey' => 'user_id'
> > > >         )
> > > >     );
> > > >     var $validate = array (
> > > >         'title' => array(
> > > >             'rule' => 'notEmpty'
> > > >         ),
> > > >         'category' => array(
> > > >             'rule' => 'notEmpty'
> > > >         ),
> > > >         'body' => array(
> > > >             'rule' => 'notEmpty'
> > > >         ),
> > > >         'frontpage' => array(
> > > >             'rule' => 'numeric'
> > > >         )
> > > >     );}
>
> > > > On Feb 23, 12:01 am, WebbedIT  wrote:
>
> > > > > ^^ What @Andy says is right.
>
> > > > > Simple rule of thumb for hasMany/hasOne <-> belongsTo
> > > > > relationships ... whichever model your foreign_key is in, it belongs
> > > > > to the other model.
>
> > > > > Welcome to CakePHP, it should make learning complex PHP a lot easier
> > > > > for you.  I sometimes wish I hadn't taught myself a lot of bad habits
> > > > > by learning raw PHP first :)

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: Question about relationships, extending the blog tutorial

2010-02-23 Thread Andy Dirnberger
Did you try just using "var $belongsTo = array('User');"? The values
you are supplying for className and foreignKey should be the defaults.

If you remove the $belongsTo piece, do your posts show up again? If
not, what else did you change? What code do you currently have in your
controller? No special code is needed in your controller to handle
relationships, and you'd only need to add code to your User model
(e.g., var $hasMany = array('Post');) if you wanted posts to be
retrieved every time you query your user table, which you probably
don't.

Once you have it working, 'User'] will be added as an index alongside
'Post' (e.g., $post['User']['displayname']).

On Feb 23, 5:16 pm, deek  wrote:
> So I updated my post model to what you see below and now when I go to
> my index (index.ctp) view that I have listed on my first post nothing
> shows up. Do I need to add anything in the controllers or the user
> model?  Once get it to show properly how would I call the the User
> displayname in my foreach loop in the index.ctp?
>
> class Post extends AppModel {
>     var $name = 'Post';
>     var $belongsTo = array (
>         'User' => array(
>             'className' => 'User',
>             'foreignKey' => 'user_id'
>         )
>     );
>     var $validate = array (
>         'title' => array(
>             'rule' => 'notEmpty'
>         ),
>         'category' => array(
>             'rule' => 'notEmpty'
>         ),
>         'body' => array(
>             'rule' => 'notEmpty'
>         ),
>         'frontpage' => array(
>             'rule' => 'numeric'
>         )
>     );}
>
> On Feb 23, 12:01 am, WebbedIT  wrote:
>
>
>
> > ^^ What @Andy says is right.
>
> > Simple rule of thumb for hasMany/hasOne <-> belongsTo
> > relationships ... whichever model your foreign_key is in, it belongs
> > to the other model.
>
> > Welcome to CakePHP, it should make learning complex PHP a lot easier
> > for you.  I sometimes wish I hadn't taught myself a lot of bad habits
> > by learning raw PHP first :)

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: Keeping State

2010-02-22 Thread Andy Dirnberger
It's still sessions: http://book.cakephp.org/view/173/Sessions

On Feb 22, 9:01 pm, Josh LaMar  wrote:
> Hi all,
>
> This is my first post. I am new to CakePHP but I have experience
> programming in PHP and Python/CGI. Anyways I want to get comfortable
> switching over to CakePHP by developing a simple program that keeps
> state - let's say a counter. The counter can be a button that
> increases the state variable each time it's clicked. From this I want
> to be able to make an addition calculator that adds to input
> variables. Eventually I would be able to be comfortable enough to
> create a hangman program. How would I go about keeping state on the
> server side? In PHP it was with Sessions.

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: Question about relationships, extending the blog tutorial

2010-02-22 Thread Andy Dirnberger
Try $belongsTo instead of $hasOne.

$belongsTo = array('User');

On Feb 22, 7:03 pm, deek  wrote:
> First of all let me say I'm very new to CakePHP and complex PHP in
> general.  I based the blog I am working on off the tutorial on the
> CakePHP website. I skipped creating ACL or a more complex management
> of permissions because as of now the only people who will be posting
> content will be Authorized users so using the Auth component in both
> of my controllers with an appropriate beforeFilter() function has done
> exactly what I needed.  What I am trying to do is in my display of
> posted articles have $post['Post']['user_id']; look up the in the
> users post table the display name, I haven't found a simple answer for
> this so that is why I am posting.
>
> I've looked through the cakePHP book online and thought I might need
> to do something to link models together but I didn't have any success
> with that.  I tried having the Post model include var $hasOne = User
> but that ended up breaking everything.  Any suggestions would be
> greatly appreciated.
>
> Below are my table structures, models, and view I am working with
>
> -- Table structure for table `posts`
>
> CREATE TABLE IF NOT EXISTS `posts` (
>   `id` int(10) unsigned NOT NULL auto_increment,
>   `user_id` int(11) NOT NULL,
>   `title` varchar(50) default NULL,
>   `category` varchar(50) default NULL,
>   `body` text,
>   `frontpage` tinyint(1) NOT NULL,
>   `created` datetime default NULL,
>   `modified` datetime default NULL,
>   PRIMARY KEY  (`id`)
> )
> -- Table structure for table `users`
>
> CREATE TABLE IF NOT EXISTS `users` (
>   `id` int(11) NOT NULL auto_increment,
>   `username` char(50) default NULL,
>   `password` char(40) default NULL,
>   `displayname` varchar(50) NOT NULL,
>   PRIMARY KEY  (`id`),
>   UNIQUE KEY `username` (`username`)
>
> Post Model:
> class Post extends AppModel {
>     var $name = 'Post';
>     var $validate = array (
>         'title' => array(
>             'rule' => 'notEmpty'
>         ),
>         'category' => array(
>             'rule' => 'notEmpty'
>         ),
>         'body' => array(
>             'rule' => 'notEmpty'
>         ),
>         'frontpage' => array(
>             'rule' => 'numeric'
>         )
>     );}
>
> User model:
> class User extends AppModel {
>     var $name = 'User';
>     var $validate = array(
>         'username' => array(
>             'rule' => 'notEmpty',
>             'message' => 'Please enter your Username'
>         ),
>         'displayname' => array(
>             'rule' => 'notEmpty'
>             'message' => 'Please enter the name you wish displayed
> with your posts'
>         ),
>         'password' => array(
>             'rule' => 'notEmpty',
>             'message' => 'Pelase enter your Password'
>         )
>     );}
>
> index.ctp:  This view is on my main page and loops through all the
> posts that are tagged to be on the front page
>
>      ['frontpage']==true){ ?>
>         link($post['Post']['title'],
> array('controller' => 'posts', 'action' => 'view', $post['Post']
> ['id'])); ?>
>         
>         
>         
>         
>     

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