# |
Aug 8th 2008, 20:35 |
skua |
i need just one line of code to change database on the fly |
# |
Aug 8th 2008, 20:35 |
TommyO |
make a datasource |
# |
Aug 8th 2008, 20:35 |
skua |
yes but there is something to autoload code for each access of model without to create behavior :p |
# |
Aug 8th 2008, 20:34 |
TommyO |
$actsAs |
# |
Aug 8th 2008, 20:34 |
TommyO |
beforeSave, beforeFind, beforeFilter, afterSave, ... |
# |
Aug 8th 2008, 20:33 |
skua |
) |
# |
Aug 8th 2008, 20:33 |
skua |
autoload a piece of code |
# |
Aug 8th 2008, 20:33 |
TommyO |
autoload 'something' ? |
# |
Aug 8th 2008, 20:33 |
skua |
what's the function to auload something in model object. i try setup() or initialize() but that didn't worked |
# |
Aug 8th 2008, 19:56 |
Telik_Work |
is anyone here?? |
# |
Aug 8th 2008, 19:52 |
Telik_Work |
oops, sorry |
# |
Aug 8th 2008, 19:52 |
Telik_Work |
clear |
# |
Aug 8th 2008, 19:48 |
cl0s_ |
is there a way to change the img directory that cake uses like u can with layout? |
# |
Aug 8th 2008, 19:46 |
CrazyTux[m] |
how do I ONLY render the view, nothing else? |
# |
Aug 8th 2008, 19:42 |
Azhi_Dahaka_ |
yes, i know... but i don't want 2 input boxes to search into... |
# |
Aug 8th 2008, 19:41 |
TommyO |
and this is probably more an exception to the rule than anything else... |
# |
Aug 8th 2008, 19:40 |
TommyO |
you probably need to App::import('Core', 'Validation'); right before you try to use it |
# |
Aug 8th 2008, 19:39 |
Azhi_Dahaka_ |
x |
# |
Aug 8th 2008, 19:39 |
Azhi_Dahaka_ |
th |
# |
Aug 8th 2008, 19:39 |
Azhi_Dahaka_ |
that's WAY cleaner than my current approach |
# |
Aug 8th 2008, 19:39 |
TommyO |
Azhi_Dahaka_: ^^ |
# |
Aug 8th 2008, 19:37 |
TommyO |
if (!Validation::blank($field)) { ... is perfectly legit in a controller |
# |
Aug 8th 2008, 19:36 |
Azhi_Dahaka_ |
the only validation is: not empty... because i'm using some like queries, so empty means all |
# |
Aug 8th 2008, 19:35 |
Azhi_Dahaka_ |
and returns every matching book |
# |
Aug 8th 2008, 19:35 |
Azhi_Dahaka_ |
the term is looked up on the name of the book, the abstract of the book and the name of the themes linked to each book |
# |
Aug 8th 2008, 19:34 |
TommyO |
Validation class is static, no reason you couldn't call those methods directly |
# |
Aug 8th 2008, 19:34 |
TommyO |
you can validate, or you can check the validity from the controller, which might fit here |
# |
Aug 8th 2008, 19:34 |
Azhi_Dahaka_ |
ok, case in point: search feature |
# |
Aug 8th 2008, 19:34 |
TommyO |
yeah, it's starting to get grey area isn't it :) |
# |
Aug 8th 2008, 19:33 |
Azhi_Dahaka_ |
yes, and no... it also looks for a field on another models |
# |
Aug 8th 2008, 19:33 |
TommyO |
you could validate against a Model rule even if it never gets saved |
# |
Aug 8th 2008, 19:33 |
TommyO |
so it is tied to a model, just not to a specific field |
# |
Aug 8th 2008, 19:33 |
Azhi_Dahaka_ |
meh, i will check on the controller if the data on the input field is empty and return an empty array |
# |
Aug 8th 2008, 19:33 |
Azhi_Dahaka_ |
hmm... it's a search term for some fields in an existing model... |
# |
Aug 8th 2008, 19:32 |
TommyO |
Azhi_Dahaka_: tie it to a Model then, even if the Model isn't tied to a database |
# |
Aug 8th 2008, 19:27 |
Azhi_Dahaka_ |
hmm, how can i add validation to a form not tied to a model? |
# |
Aug 8th 2008, 19:17 |
Azhi_Dahaka_ |
because, that's ALL |
# |
Aug 8th 2008, 19:17 |
Azhi_Dahaka_ |
so, i don't want to do a like "%%" |
# |
Aug 8th 2008, 19:17 |
Azhi_Dahaka_ |
thing is: i'm not exactly looking for stuff on just one field |
# |
Aug 8th 2008, 19:16 |
TommyO |
empty term however is a validation issue imho |
# |
Aug 8th 2008, 19:16 |
TommyO |
Azhi_Dahaka_: I like empty in the view. <?php if (empty($results)): ?>... <?php else foreach($results as $result): ?>... |