cara... o núcleo do Cake pode ser colocado em um diretório comum...
basta vc acertar uma constante dentro do index.php...
CAKE_CORE_algumacoisaqueeunãolembroorestoagora...
Lá vc bota o endereço URI absoluto de onde está o CakePHP.
Sempre que vc atualizar o CakePHP, vc atualiza neste diretório
Isso sim... o problema não está aí. O problema está em compartilhar
css, js, controller, models, helpers, elements, etc entre as
aplicações, evitando a redundância de arquivos.
Por exemplo, aqui tenho um CSS que é utilizado em todas minhas
aplicações. Não gostaria de ficar replicando ele em
Oi, diegon.hernandes.
Segue algumas sugestões para você sobre o CakePHP.
Padrões do Cake para a criação dos modelos, controllers e views.
Modelos: Nome do modelo deve ser sempre no singular e com letras
minúsculas. No seu caso, arquivo deve se chamar material.php. Se a
tabela Material
No que se refere aos models, views e controller (e devidos agregados)
vc pode posicionar todos eles dentro do diretório /cake...
Agora os JS e o CSS, humn, vc pode usar uma função packer que tem
disponível na Bakery, configurando um detalhezinho para ele pegar em
um endereço absoluto local ao
try this:
$this-Author-generateList(null, null, null, null,
{n}.Author.last_name {n}.Author.first_name);
On Dec 11, 2007 9:46 AM, aniston [EMAIL PROTECTED] wrote:
Just an indicator that might help you, its an example on db column
merging with concat
Yeah this is one that has plagued me too. I found some code for a workaround
by defining a simple extra association in your model, and requiring some
small changes to the model::find method that can be implemented in your
app_model. I found this code in the bakery I think, modded it a bit though
Hi,
I was wondering, what is the correct way to call a 404 Error from
wihtin a controller?
The situation is this: I use pretty urls (for SEO) to let the user
navigate through my site. When the controller is called to show an
appartment, 4 parameters are passed. The first thing I do is check
2 Models
FIRST:
class LocalNumber extends AppModel {
var $useDbConfig = 'prepaid';
var $useTable = 'cards';
var $primaryKey = 'number';
var $displayField = 'number';
var $name = 'LocalNumber';
var $recursive = 2;
var $hasOne = array(
I use something like this (cake 1.2 prebeta):
$this-cakeError('error404',array(array('url'='/')));
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to
Baz...
I update to the 1.2.x.x trunk every so often and use for production
sites. It's generally considered stable enough to use.
https://svn.cakephp.org/repo/trunk/cake/1.2.x.x
I also have the 1.2.x.x branch repository checked out from:
https://svn.cakephp.org/repo/branches/1.2.x.x
I
Thanks snowdog... which class offers cakeError as a method? I couldn't
find this in the API.
Another question... is it possible to set a custom layout for the
error404.thtml file?
On 11 dec, 10:58, snowdog [EMAIL PROTECTED] wrote:
I use something like this (cake 1.2 prebeta):
When calling a 404 error with:
$this-cakeError('error404',array(array('url'='/')));
How do I set the layout for the error404.thtml. It tends to use the
default.thtml layout, but I would like to change this!
--~--~-~--~~~---~--~~
You received this message because
If your models are using different datasources you have to set the
'external' attribute in the association (I think).
On Dec 11, 9:28 am, Zwift [EMAIL PROTECTED] wrote:
2 Models
FIRST:
class LocalNumber extends AppModel {
var $useDbConfig = 'prepaid';
var $useTable =
I've simplified it
/*
MODELS
*/
class LocalNumber extends AppModel {
var $useDbConfig = 'prepaid';
var $name = 'LocalNumber';
var $hasOne = 'LocalAccount';
}
class LocalAccount extends AppModel {
var $name = 'LocalAccount';
var $belongsTo = array(
I think not
http://api.cakephp.org/1.2/libs_2model_2model_8php-source.html (from
line 260)
On 11 Gru, 11:44, grigri [EMAIL PROTECTED] wrote:
If your models are using different datasources you have to set the
'external' attribute in the association (I think).
On Dec 11, 9:28 am, Zwift [EMAIL
hi
I had a similar problem. But I took another approach. I added
afterFind function in my model. AfterFind gets called after every
query and there I have the rule to calculate full name..below is a
sample code
function afterFind($results)
{
foreach ($results as $key = $val)
I am developing a PHP-mysql database. It is noted that when the
browser window is refreshed the data is inserted again in the
database. unfortunately there is no unique keys that I can use to
verify the existance of the data, so as to prevent the multiple
insertion.
If You create a custom 404 layout, take care that an 404 code by HTTP
is provided.
This can be done by header(http/1.0 404 not found);
To prevent errors you can use something like this:
if(!headers_sent) {
header(http/1.0 404 not found);
}
You should set some validation rules for your Model, and setup a
custom rule to check whether the submitted data is already in the
database, OR implement Model::beforeSave()
Hope that helps,
dr. H.
--~--~-~--~~~---~--~~
You received this message because you are
i am validating the data b4 inserting. but the data type is text..
the text will not be unique...
explain me clearly...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this
I would like to know how get my own data set. For example in my
database relationships model Item hasMany Comment, Comment has set
relation belongsTo User. When I try:
$comments = $this-paginate('Item.Comment');
I do not get data what I need. My problem is like in ticket:
After some researching I just need to know - is it even possible???
Many people (on IRC) says: yes, sure
But hell I cannot make it work even with simples User - Profile
associacion (from tempdocs)
On 11 Gru, 11:56, Zwift [EMAIL PROTECTED] wrote:
I think
You should use the redirect after post pattern, using a HTTP 302 or
303 status code after saving your fields.
if($this-Model-save())
$this-redirect($url, $code, $exit);
On Dec 11, 12:58 pm, chowdary [EMAIL PROTECTED] wrote:
i am validating the data b4 inserting. but the data type is
But how do I define the layout that CakePHP should use for the
template error404.thtml
On 11 dec, 12:37, powtac [EMAIL PROTECTED] wrote:
If You create a custom 404 layout, take care that an 404 code by HTTP
is provided.
This can be done by header(http/1.0 404 not found);
To prevent errors
Can you paste here your SQL Dumb, and models code
I just don't understand whats going on here?
Or did you used my above example??
Hell...
Darkness...
On 11 Gru, 14:11, grigri [EMAIL PROTECTED] wrote:
I just ran a quick test (I've never actually needed to have more than
one db config for
I recently had this idea which might be the BETTER way to send out
Emails using CakePHP.
http://www.gigapromoters.com/blog/2007/12/11/a-better-way-to-send-emails-than-cakephps-default-email-component/
Looking for your feedbacks..
--~--~-~--~~~---~--~~
You
I found that changing the layout in error.php (errorHandler class)
does seem to work. This doens't seem like good-practice though...
Any simpler solutions?
On 11 dec, 11:40, BoSc [EMAIL PROTECTED] wrote:
When calling a 404 error with:
$this-cakeError('error404',array(array('url'='/')));
In one of the latest SVN versions of CakePHP this seems to have been redone.
It now returns:
['to']['year']
['to']['month']
['to']['day']
cleanUpFields is gone. It should be done automatically through the model,
BUT I can't get it to save to the database. Out well.
On Dec 5, 2007 9:51 PM, Baz
Hi, I have some code looking like http://bin.cakephp.org/view/11696180
Basically, my Configuration model aliases an associated Mtie model to
ExceptionMask.
In implementing Mtie::afterFind($results) I discovered that $results
uses the alias ExceptionMask instead of the model name Mtie, as would
Thanks for your reply.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
Slightly.
Sorry, I'm new to all of this. I just realized that I need some software to
download from the branches.
I do have a question though. What do you do when you update and stuff
doesn't work, just roll back?
For eg. Saving datetime fields to the database no longer works.
On Dec 11, 2007
how about
class AppController extends Controller {
function beforeRender() {
if ($this-viewPath == 'errors') {
$this-layout = 'error';
}
}
}
On Dec 11, 2:25 pm, BoSc [EMAIL PROTECTED] wrote:
I found that changing the layout in error.php (errorHandler class)
does seem to
What does it say cleanUpFields() was replaced by? Maybe you could use
that
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To
FormHelper::text() just generates the markup for a single input field.
FormHelper::input() can generate any type of input field (text,
password, textarea, select, radio, ...) which can be auto-detected
from the model's schema, or user-defined. It also adds a wrapper div
and error message, if
http://cakephp.org/screencasts
Setting up the console should help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from
I guess it depends on how you choose to develop. Personally I keep a
separate copy of cake for every single site that I create. This means
I don't have to worry about backwards compatibility for each site
every time I want to use a new version of cake. Some people who are
using *nix might use a
Yes, as long as your helper is in the app/views/helpers directory, and
not inside the cake core libs.
As to actually loading the helper (if it's not already loaded)... If
you're on 1.2 pre-alpha you would use:
loadHelper('Form');
or if you're on bleeding edge 1.2 branch:
App::import('Helper',
HI!
I'm trying to delete a row from a model, using
Modelname-del($id)
But I receive the error
SQL Error: 1052: Column 'id' in where clause is ambiguous
Why is this happening? How can i solve itP?
Thanks
--~--~-~--~~~---~--~~
You received this message because
On Dec 11, 5:12 pm, Paolo [EMAIL PROTECTED] wrote:
HI!
I'm trying to delete a row from a model, using
Modelname-del($id)
But I receive the error
SQL Error: 1052: Column 'id' in where clause is ambiguous
Why is this happening? How can i solve itP?
Thanks
How about showing the sql
did you try:
?php $this-layout = 'error'; ?
in your error404.thtml ?
On 11 déc, 15:37, grigri [EMAIL PROTECTED] wrote:
how about
class AppController extends Controller {
function beforeRender() {
if ($this-viewPath == 'errors') {
$this-layout = 'error';
}
}
}
On Dec
Model::deconstruct() I think
http://api.cakephp.org/1.2/class_model.html#0198f3999e2942f8e82db80fc9e19c30
:)
Sam D
On Dec 11, 2007 8:33 AM, Gwoo [EMAIL PROTECTED] wrote:
What does it say cleanUpFields() was replaced by? Maybe you could use
that
--
(the old fart) the advice is
Well, it's hard to provide an answer like this..
Can you paste some code and explain to us what are trying to achieve?
If you're inserting text and there is something else that needs to be
unique, you will need a custom validation rule for your Model.
On Dec 11, 12:58 pm, chowdary [EMAIL
I have two list box (A and B), and I have two buttons to move list
items (options)
from this box to the other.I have a submit button to submit the form.
I know how to move items from A to B by using Javascript, and I know
how to use option ... selected to select an item.
However, how can I
Yeah, I saw that...
And I also saw something that said this is called through Model::set().
But, I'm still lost as to how to use it.
Also, what I did was I got the latest SVN and I just did a bake on a simple
database with a date field. Long story short, it doesn't work.
I think I'll just
Hi all,
I have an HABTM relationship between tables named Users and Notes. I
only want to populate the join table when a note is sent to a user.
The join table will be used to determine which users have permission
to view which notes. Because both the note record and the user record
are
It says it was replaced by: Model::deconstruct()
But the functionality is different. Doing a direct call didn't work for me.
Even if it did, there's another issue with the latest version not saving
dates and times to the database. I think I'll just hold up on the SVN for
now. At least until they
Hi All,
I assumed that you could use variables set in an action in a
beforeRender function because it is called after the controller action
but I guess I am wrong. is there a way to pass a variable to
beforeRender? Here is my code:
function beforeRender()
{
if($id){
Hi guys
I'm a new baker, I guess I'm better at cooking.
I tried to use the upload behavior 1.3 ( http://bin.cakephp.org/saved/21813#
) but it didn't upload anything. There are no debugging messages or
errors either, so I dont know what else to do. I tried using other
versions of this behaviour
OK guys here's one to stump you:
My form is on a page where the bulk of the page is for tv listings, so
the URL for the page is like this: www.mydomain.com/listings/view/
At the top of the page is the main view of the listings, the main
feature of the page, but one we're not interested in for
I tried something just like that yesterday:
$user = $this-requestAction('mshows/edit/5');
It did not work for me, it does not process the id = 5 and send back
the data
even though that works if you type mshows/edit/5 in the address bar.
You have to fetch the data in your controller and send it
Curious to what you guys think about this different way of developing?
I bring up this question because I've been given the task to start
using BDD for an existing project that is using CakePHP v1.1 and
cannot move forward to v1.2 until it is officially released and
stable.
All that I could
should I just create my own table and not try for the HABTM
association?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe
If I call Model-create and then Model-getLastInsertID
Will I get the last inserted Id or I must actually create a db record
before calling getLastInsertID?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP
Hacking the core really wouldn't do it for me, I guess the only proper
way to use Cake is with hardcoded queries.
As without this simple ability I'd rate the database abstraction as
broken.
Has it really be a year since the bug was posted???
Nothing?
Am I choosing the wrong framework?
-Ben
Hi.
Thanks for your help before, everyone... This one's just a quick
question. I'm pretty sure the answer's just make the new model and
stop being lazy, but I'd like to make sure just in case.
I've got a project with a has-and-belongs-to-many relationship,
linking a products table to a features
I know what you mean. I've spent three days to solve a problem that's
three lines of regular PHP code and still no solution. Apparently
CakePHP 'just works!' so doesn't need documentation. Yeah, well if it
works, it's on minimum wage and giving surly customer service! And
except for those days
On Dec 11, 2007 7:46 PM, jon [EMAIL PROTECTED] wrote:
I know what you mean. I've spent three days to solve a problem that's
three lines of regular PHP code and still no solution. Apparently
CakePHP 'just works!' so doesn't need documentation. Yeah, well if it
works, it's on minimum wage and
When you bake using bake.php it offers you to bake also the test
scripts.
It's just a matter of using them, I guess.
On 11 dez, 19:47, Andrew Assarattanakul [EMAIL PROTECTED] wrote:
Curious to what you guys think about this different way of developing?
I bring up this question because I've
But I forgot to mention I use PHPUnit and HTTPUnit (Java)
On 12 dez, 00:29, Dérico Filho [EMAIL PROTECTED] wrote:
When you bake using bake.php it offers you to bake also the test
scripts.
It's just a matter of using them, I guess.
On 11 dez, 19:47, Andrew Assarattanakul [EMAIL
I've been plugging along with the little 15 minute blog tutorial, and
I can't even view my Posts view. Here's what happens:
http://localhost/ works fine
http://localhost/posts returns Missing View: Fatal: Confirm you have
created the file : /Users/myusername/Sites/CakeBlog/app/views/posts/
sounds like you do not have allow override set to true in your apache
config file
Sam D
On Dec 11, 2007 7:45 PM, 703designs [EMAIL PROTECTED] wrote:
I've been plugging along with the little 15 minute blog tutorial, and
I can't even view my Posts view. Here's what happens:
http://localhost/
Oh, sorry. Didn't read up to the end. It might be mod_rewrite is not
working. Although, you where able to access localhost/posts and gives you
that error.
Check again
On Dec 12, 2007 10:58 AM, Louie Miranda [EMAIL PROTECTED] wrote:
Please review the error.
*It says..*
returns Missing
I totally agree with that sentiment. But remember, this was meant to
be as quick and dirty as possible, with the caveat that it's NOT the
place to do anything super sensitive. As I was building this to fill
my own need, I knew I didn't want to go through the hassle of logins
and passwords.
I searched through the list and could not find anyone having this
specific issue.
I am using 1.2 (not exactly sure what version, but not pre-beta). I
have a table of content pages, which includes a parent_id field. I am
trying to pull a threaded array like this:
$test =
The new with attribute seems to go some way to fixing it, however
the functionality has changed since first included and the tutorials
out there are dated.
If you include a model for your HABTM with, then query that model.
Sorry for the non-naming convention tables, from older legacy system.
Oh wow, I'm dumb. I wrote index.thml! Anyway, the blog tutorial should
tell users to do a chmod -R 777 to the app/tmp directory, since
there's a permissions issue otherwise.
On Dec 11, 10:00 pm, Louie Miranda [EMAIL PROTECTED] wrote:
Oh, sorry. Didn't read up to the end. It might be mod_rewrite
On Dec 11, 2007 10:25 PM, Mr-Yellow [EMAIL PROTECTED] wrote:
As for writting CakePHP I think that would be better left to those
with an eye on the direction and conventions of the project, those who
should realise this is a feature at the basis of being able to use
CakePHP for DB access.
I have a problem with my session whenever I do an ajax call.
When I do single ajax calls, I do not have a problem at all. It works
perfectly fine.
Session will expire after 20mins. As per normal.
But when I do 2 simultanous ajax calls, my first ajax call will
succeed but my second reply is a
Needed to use 'DISTINCT Pack.PackID' hack too.
What does the unique attribute do in models,? Can't find it documented
anywhere.
-Ben
On Dec 12, 12:44 pm, Chris Hartjes [EMAIL PROTECTED] wrote:
On Dec 11, 2007 7:46 PM, jon [EMAIL PROTECTED] wrote:
I know what you mean. I've spent three
http://tempdocs.cakephp.org/#TOC70554
This says The $conditions should be formed just as they would in an
SQL statement
Is the new way of doing it just pure SQL without all this array
garbage that doesn't really work?
-Ben
On Dec 12, 4:02 pm, Mr-Yellow [EMAIL PROTECTED] wrote:
Just want to say that I adore this framework. When I launch a
successful site with Cake, I will donate $100 of my first $500 made,
and that's my word.
On Dec 11, 10:15 pm, Chris Hartjes [EMAIL PROTECTED] wrote:
On Dec 11, 2007 10:11 PM, 703designs [EMAIL PROTECTED] wrote:
Oh wow, I'm dumb.
Hi
Ive only just started mucking around with CakePHP, and am having a
little trouble getting my head around the controllers and models
thingees. YES - I have tried looking in the manual!!
Im trying to make a cake website that will more or less mirror some
normal-non-framework php sites I have
Lets say I want.
Foo = 1
AND
Bar = '2'
AND
(Cat LIKE 'a%' OR Cat LIKE 'b%' OR Cat LIKE 'c%')
Tried just about everything. How can it be this hard??? Why are
there so many users not able to get queries to work in so many
situations? Does it mean the overall design of the query construtor
The right way to do this would be to have 3 models each of which uses the
same table ( letter_contents )
with the correct conditions defined ( see finderQuery ) or place the
conditions within the Letter model's relationships.
[EMAIL PROTECTED] wrote:
I considered option 2 as I believe
Or even better.. copy the page_controller from the cake core to your
controllers folder and *gasp* give a $uses array..
Then you dont have those pesky dispatcher calls. If your application doesn't
have a great need for requestAction then you should avoid it. I even write
my elements /
On Dec 12, 7:23 am, Mr-Yellow [EMAIL PROTECTED] wrote:
Lets say I want.
Foo = 1
AND
Bar = '2'
AND
(Cat LIKE 'a%' OR Cat LIKE 'b%' OR Cat LIKE 'c%')
Tried just about everything.
I am pretty sure you didn't try:
$constraint['FooModel.FooField'] = 1;
On Dec 12, 7:31 am, abba bryant [EMAIL PROTECTED] wrote:
The right way to do this would be to have 3 models each of which uses the
same table ( letter_contents )
with the correct conditions defined ( see finderQuery ) or place the
conditions within the Letter model's
OR consider
77 matches
Mail list logo