Weird problem with languages

2010-11-04 Thread Fran Iglesias
Hi,

I have a weird problem with L10n.

I've just created the .po files, tested in the development machine and all 
works fine.

When uploaded to production the localization doesn't work unless I change 
language codes to the two character code (i.e.: Configure::write('language', 
'es') ). But if I change this, i18n stops to work as intended with existing 
content (Translate behavior uses this code to find translations, and they was 
saved in DB with the "es-es" format).

How to set the default language so both i18n and l10n work as expected? Could 
it be a server configuration  issue?

(Weird solution: change i18n table locale codes to the two digit format, but i 
think there should be a better way).



---
Fran Iglesias 
http://cakephpilia.blogspot.com

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

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


Re: Send 'first' parameter to pagination function

2010-10-20 Thread Fran Iglesias
$this->paginate['Book'][0] = 'first'; 

should do the trick...

El 20/10/2010, a las 18:43, Mariano C. escribió:

> I need a sort of find('first') for pagination? How can i do?

---
Fran Iglesias 
http://cakephpilia.blogspot.com

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

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


Re: 15 minute Blog Tutorial? Really?

2010-10-10 Thread Fran Iglesias
Hi Jeff
El 10/10/2010, a las 22:58, Jeff escribió:

> Debug already IS '2'
> 
> http://click-2-run.com/cakephp/posts/index.php

Try

http://click-2-run.com/cakephp/posts/index

without the extension

The url is /controller/action and action name in the controller doesn't include 
extensions.
---
Fran Iglesias 
http://cakephpilia.blogspot.com

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

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


Re: SimpleTest: "You need a new test.php. Try this one: cake\console\libs\templates\skel\webroot\test.php"

2010-08-31 Thread Fran Iglesias
Hi
El 31/08/2010, a las 14:41, Joshua Muheim escribió:

> Still the same error. Even when there is *no* test.php file in the
> webroot I get this error. Very frustrating. Any other help?

I remember having the very same error, and the solution was to update cake 1.2 
to final.
---
Fran Iglesias 
http://cakephpilia.blogspot.com

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

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


Re: Question about I18n and relation

2010-08-31 Thread Fran Iglesias

Hi,

El 30/08/2010, a las 16:56, MoAX escribió:


Informations about my category are retrieved and its title from the
i18n table too. But items title and description (in the i18n table)
are not retrieved while their informations are.


Is a limitation in the Translate Behavior. Related models are not  
translated.


There are several workarounds. For example:

$this->Category->recursive = -1:
$category = $this->Category->read(null, $id)
$items = $this->Category->Item->find('all', array('conditions' =>  
array('category_id' => $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


Re: Problem with tinyint(1)

2010-08-17 Thread Fran Iglesias
Hi,

El 17/08/2010, a las 20:02, Arnold Roa escribió:

> hi, i have a field icon, tinyint(1).
> is this okey? or is a bug?

tinyint(1) is boolean for Cake.
You could define the field as tinyint(2)
---
Fran Iglesias 
http://cakephpilia.blogspot.com

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

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


Re: How write joins in cakephp please help me out

2010-05-18 Thread Fran Iglesias

HI
El 18/05/2010, a las 12:20, Narendra Padala escribió:

I am new to cakephp, If any one can help me how to write left joins  
in cake php. please conver below query in cakephp


try

http://book.cakephp.org/view/872/Joining-tables

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: baking 1.3.0 problems?

2010-05-16 Thread Fran Iglesias
Hi,

El 27/04/2010, a las 12:18, invisibleman escribió:

> It just seems to create empty files for me. For example if i have a
> table called groups and i bake it it just creates an empty group.php
> file for me even though i defined relationships and validation etc.

I found a similar problem. The reason was that in my installation, the cake 
core folder was inside a path that contains a 'libs' folder. Such as:

/Users/frankie/Sites/libs/cake13/cake

Workaround: move cake folder to another place.

I've submitted a ticket with this issue 

http://cakephp.lighthouseapp.com/projects/42648/tickets/724-template-task-problems-when-cake-core-is-under-a-path-that-includes-a-libs-folder

---
Fran Iglesias 
http://cakephpilia.blogspot.com

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

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


Re: Error after adding database.php file to project (happening on Windows and Ubuntu)

2010-01-22 Thread Fran Iglesias

Hi

El 21/01/2010, a las 23:44, Lucas Loss escribió:


4. Then I've renamed the file database.php.default to database.php;
5. Back to the browser I reloaded the page and noticed a new sentence:


I miss a step between these. Have you configured your database  
connection in database.php? And, by the way, is a database server up  
and running?



see a print of the page on http://yfrog.com/jp125afterdatabasep;


Have you read the error message in the top? It looks that you need to  
set the right permissions in the tmp folder so Apache can write.


Please, read the manual on installation, I think the answers are all  
there.


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: Pagination with 2nd order recursive conditions filter

2010-01-10 Thread Fran Iglesias

Hi,
El 11/01/2010, a las 8:35, Jeremy Burns escribió:

I have had the very same annoying problem and couldn't solve it. I  
wanted to do (effectively - using the good old blog as an example):


If you are writing your custom find types to perform the search as in

http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define-find-methods/

you could try this sort of hack:

http://code.assembla.com/milhojas/subversion/nodes/app_model.php?rev=394

(I override the method in the app_model to avoid touch the core).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: global functions

2009-12-10 Thread Fran Iglesias
Hi,

El 10/12/2009, a las 14:32, Ernesto escribió:

> it's very uncomfortable to copy them in a helper and in a component @
> every little mod.
> is there any clever way to manage these funcs?



You could load them in the APP/config/bootstrap.php

Another solution is to create a class with several methods, load it  
during bootstrap and use as singleton, something similar to the  
inflector class.
---
Fran Iglesias 
http://cakephpilia.blogspot.com

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

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


Re: managing the "missing argument" errors

2009-11-30 Thread Fran Iglesias
Hi again,

El 30/11/2009, a las 9:35, Ernesto escribió:

> too many ifs in my controllers.

It think this is unavoidable.

Setting the argument with a default value of null avoid the PHP error  
of "missing argument",

function edit($id = null) {...}

but you need to give some response to the situation.

Only the proper action "knows" how many arguments are mandatory, so  
you need to check if they are set and valid. The default value  
approach "normalizes" the arguments for the validation check. (Your  
approach takes two steps: check argument's existence and validation).

You could ignore the argument fault and delegate to the view to deal  
with the absence of data to edit/show:

In the controller simply let the action try to find the item with the  
id of null. The result will be false, no ifs needed. Then, in the view:

if (!$item) {
  echo 'No valid data to edit/show':
} else {...}

If this logic must go in the controller or in the view depends on  
several factors.

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: managing the "missing argument" errors

2009-11-30 Thread Fran Iglesias
Hi,

El 30/11/2009, a las 9:16, Ernesto escribió:

> but that's unconfortable...

My approach:

in controller...

function edit($id = null) {
if (!$id) {
$this->Session->setFlash('INvalid URL');
$this->redirect (array('action' => 'index');
}

// Code, code, code
}

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

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


Re: Delete confirm

2009-11-25 Thread Fran Iglesias
Hi,

If you don't have a delete view (or don't want to have) I guess you  
need to redirect to the index action after deleting.

El 25/11/2009, a las 13:22, jburns escribió:

> The delete view, I presume. The error message is as I typed it.

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

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


Class Controller not found in Shell

2009-08-27 Thread Fran Iglesias

Hi,

I'm working on this shell,

http://bin.cakephp.org/view/1424384908

but it throws a Fatal error: Class 'Controller' not found in [...]/ 
app_controller.php

In fact, the model method it's not executed at all.

what could be the reason?
---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Unit testing and file uploads

2009-08-10 Thread Fran Iglesias

Hi,

I'm working in a plugin for my system to manage uploads. It includes  
an Uploadable behavior.

Is it possible to unit-test the upload part in some way? That is, is  
there a way to "mock" a file upload to the server.

My "B plan" is try to isolate the move_uploaded_file() part into a  
method, to be able to simulate the results of the upload to test the  
rest of the behavior. Could this be a correct strategy?

Thanks
---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: MISSING TABLE

2009-08-10 Thread Fran Iglesias

I think you forgot to define a 'prefix' key in the database  
configuration if all tables must have a prefix in their names.

Another solution if that's not he case: in the model add a var  
$useTable = 'cc_works_collections'

Hope that helps

El 09/08/2009, a las 23:01, JuanWalker escribió:

> Hi Guys, I've this problem. I've a table called cc_works_collections
> that I've created on mysql db.

---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: knowledge base component

2009-08-07 Thread Fran Iglesias

The Cakebook?

http://thechaw.com/cakebook

El 07/08/2009, a las 11:12, leop escribió:

> Does anyone know of a knowledge base / wiki application built with
> Cake?

---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: Containable - Deep Associations - Sort resulting array

2009-08-04 Thread Fran Iglesias

Hi,

El 04/08/2009, a las 17:54, pomares escribió:

> I guess I will have to write a custom query() instead. Unless one of
> you comes up with a genial idea!

I think you could try using joins. Read this post by Nate Abele.

http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find


---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: Finding missing numbers in an array

2009-08-04 Thread Fran Iglesias

You could try

$missing_numbers = array_diff($the_array, $the_complete_array);


El 04/08/2009, a las 9:57, liaogz82 escribió:

>
> Hi all,
>
> I know this is not directly related to cakePHP but i am cracking my
> head trying my best to figure out how to discover a missing number in
> an array in php.
>
> Let me give you this example:
> $missing_array1 = array(1,2,3,4,6,7,8);
>
> The missing number for the above array is 5.
>
> $missing_array2 = array(1,2,3,4,5,7,8,9);
>
> The missing number is 6
>
> Please help me on this. Thanks
>
> Gangzheng
> >

---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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 access methods of different controller?

2009-07-17 Thread Fran Iglesias

Is an action or some kind of "general utility" method?. In this case,  
I prefer to write a Component or even add it to the AppContoller.

El 17/07/2009, a las 21:00, Amit escribió:

>
> Hi, quick question.
>
> How do I access methods of one controller into another controller??
> (other than using requestAction).

---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Fixtures import

2009-07-15 Thread Fran Iglesias

Hi,

I'm unable to make my fixtures import table definitions.

Core tests for fixture pass, so I don't know what's happenings.

I've tried:

$import = 'Model'

$import = array('model' => 'Model', $connection = 'default');

$import = array('table' => 'models', $connection = 'default');

and so on...

Anyone can drop me a clue?

Tests works well if I declare a $fields array.

---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Containable does not return data

2009-07-13 Thread Fran Iglesias

Hi,

I'm writing a Commentable Behavior based on some ideas from

http://josediazgonzalez.com/posts/view/2/Commentable_Behavior

Briefly, the behavior binds a hasMany association between a model and  
the Comment model. This works well, and muy tests pass ok.

My problem happens when I issue a model->find with 'contain' =>  
'Comments'. Querys are right and retrieve data, but the results array  
is empty for the Comment key.

The code of the Behavior and a test are here:

http://bin.cakephp.org/saved/48209

Fake model is what its name implies, a Fake model for testing. All  
models actsAs Containable (via AppModel)



---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: App::import and Classregistry (Solved)

2009-07-07 Thread Fran Iglesias

Found the solution (thanks Mark Story)

You need to set the $controller->plugin parameter to let the  
controller know that it lives in a plugin.

App::import('Model', 'Plugin.Model') does the trick beacause it  
registers the right class, so the controller ifself doen't need to  
import again.

El 05/07/2009, a las 23:24, Fran Iglesias escribió:

> Reading the Core test case for Classregistry doesn't clarify the  
> question for me. I need to study how to prove this issue in a more  
> general fashion.

---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: App::import and Classregistry

2009-07-05 Thread Fran Iglesias

Hi again,

El 05/07/2009, a las 22:59, Miles J escribió:

> Well firstly id like to know why you are importing and initiating
> controllers?


Unit-test controllers using this methodology:

http://mark-story.com/posts/view/testing-cakephp-controllers-the-hard-way

Classregistry works as intended for me except when testing plugins.

As far as Controllers load Models using Classregistry, many of my test  
failed beacause Models were instantiated as AppModel instead of the  
proper class. I discovered that I could workaround this problem doing  
an explicit App::import('Model', 'Plugin.Model'). Then the controller  
is able to load the right class.

I detect the problem when trying to test models with attached  
behaviors (in fact, behaviors weren't attached at all).

Reading the Core test case for Classregistry doesn't clarify the  
question for me. I need to study how to prove this issue in a more  
general fashion.

Thanks.
---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: App::import and Classregistry

2009-07-05 Thread Fran Iglesias

Hi,

El 05/07/2009, a las 22:29, Miles J escribió:

> Well the correct and only way is calling the type:
> App::import('Model', 'ModelName');

Yes. Mine was a typo. I'm sorry.

> But its best to just use loadModel() in the controller.


My problem with Classregistry is happening when I'm testing plugins.

http://bin.cakephp.org/view/410144964


---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



App::import and Classregistry

2009-07-05 Thread Fran Iglesias

Hi

I was writing tests for controllers in a plugin and found that many  
tests failed beacause the controller instantiated the model as a  
generic AppModel class. I'm using this approach by Mark Story:


http://mark-story.com/posts/view/testing-cakephp-controllers-the-hard-way

(By the way, the actions worked well in the old  "manual browser  
testing" so this issue could be related to the test suite and plugins.)

This test failed:

function testGroupModelInstance() {
$this->assertEqual(get_class($this->Groups->Group), 'Group');
}

I found that calling App:import('Model') at the beginning solves the  
issue

App::import('Accounts.Group');

I din't find this well documented, so I comment here for discussion.

---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: slug of choice

2009-06-22 Thread Fran Iglesias


El 22/06/2009, a las 9:03, aman batra escribió:
> What should be the approach over this.. I m using the sluggable
> behavior to generate the slug for the post.

Perhaps...

- make the slug field editable in the ass/edit actions

- If the slug field is left blank by the user, create the slug  
programatically, and/or...
- Populate the slug file with the "slugged" title, if slug field is  
empty, using a javascript function

hth
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Fixtures importing table definitions

2009-06-19 Thread Fran Iglesias

Hi,

I'm trying to convert my fixtures files to impor table definitions  
from database, following

http://book.cakephp.org/view/358/Preparing-test-data#Importing-table-information-and-records-361

but it doesn't work. (Missing table errors), both using model or table.

I'm working in a plugin (I don't know if this is important)

I'm using last stable.

Any idea?

---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with a behavior and a Controller test

2009-06-16 Thread Fran Iglesias

Hi,

I'm writing a Controller test, that uses a Model that Acts As a  
Behavior.

I'm using the "hard way" methodology by Mark Story to build the  
controller in the test case.

My problem is as follows:

The controller method being tested makes a call to a Model method  
implemented by the behavior but fails with the 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 'createTicket' at line 1

I think this is a typical error when you call a model method that  
doesn't exists. Or if you call a method in the behavior but the  
behavior is not loaded.

In the model tests, the method works well. So,

How could I manually binf the behavior to the model?



Thanks.




---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: Using several views for same controller function

2009-04-28 Thread Fran Iglesias

Hi,

MVC complaints aside, if you want to use a "no convention" view,  
simply perform a

$this->render('the_view');






--~--~-~--~~~---~--~~
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: requestAction and parameters

2009-03-26 Thread Fran Iglesias

Hi,
El 26/03/2009, a las 12:56, Dardo Sordi Bogado escribió:

> $this->requestAction(array('action' => 'recent', 'pass' => array(5)));
>
> I haven't tested it myself.

I'll try that, thank you.

> Is this just out of curiosity or do you have a reason to use the  
> array syntax ?

The main reason is to bypass the router in light of the recent posts  
about requestAction performance. I'm creating a set of elements in the  
application to acts as building blocks for different pages, but need  
some flexibility. They will be cached, of course..

But, apart from that, when I find this kind of "holes" my brain doen't  
rest until it gets a good response.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



requestAction and parameters

2009-03-25 Thread Fran Iglesias

Hi,

I have a doubt with requestAction and passing parameters to the  
action. The cookbook doesn't state it clear enough for me.

If you have a controller action like this:

function recent($count = null) {...}

and you call it using requestAction with a parameter...

$this->requestAction(array('action' => 'recent', 5));

then you don't get 5 in the $count variable in the action. You can  
find in $this->params[0].

Is this the expected behavior?

TIA
---
Fran Iglesias 
http://cakephpilia.blogspot.com


--~--~-~--~~~---~--~~
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: Latest Cake Release breaks HABTM pagination

2009-01-29 Thread Fran Iglesias

Hi,

first, sorry: I'm not a guru.

take a look to this Bakery post by Nate:

http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find

it completely changed my view about the pagination issue when combined  
with the custom finds beacause you can force joins on habtm  
assocciations with no "hacks".

See this by Rafael Bandeira for pagination with custom finds:

http://rafaelbandeira3.wordpress.com/tag/pagination/

specially considering this alternative approach:

http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define-find-methods/
http://cakebaker.42dh.com/2008/09/23/an-alternative-way-to-define-custom-find-types/

El 29/01/2009, a las 1:31, aron escribió:

> the sql statement no longer does a join, when we replace the cake
> folder with the rc4 cake folder it works fine again. Any insight from
> any cake gurus?

--
Fran Iglesias
fran...@buabua.com





--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Testing a controller method

2009-01-18 Thread Fran Iglesias

Hi,

I'm trying to write a test case for a private method in a controller.  
This controller uses the Email component.

The method purpose is to send notifications via email to users.

http://code.assembla.com/milhojas/subversion/nodes/dev/app/controllers/users_controller.php#ln292

I want to test if the message contains all data in the proper format.

The test case, tries to send the email in debug delivery mode and  
compares the expected message to the Message.Email.messsage session  
variable.

http://code.assembla.com/milhojas/subversion/nodes/dev/app/tests/cases/controllers/users_controller.test.php#ln81

The problem is that the Email component fails when trying to set a  
flash message (EmailComponent line 767) beacause Email->Session  
component is not an object. This only happens in the test context.

So, my question is: what preparations have I to do in order to run  
this test?

Thank you.
--
Fran Iglesias
fran...@buabua.com





--~--~-~--~~~---~--~~
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: Cake 1.2 and JW FLV Media Player

2008-11-07 Thread Fran Iglesias

Have you tried change AppHelper to Helper. The snippet works for 1.2RC3

El 07/11/2008, a las 12:41, nightcrawler13 escribió:

> thx for your reply but it still had same error
>
>> or simply change the snippet code fromm extends AppHelper to extends
>> Helper...
>>


--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake 1.2 and JW FLV Media Player

2008-11-06 Thread Fran Iglesias

HI,

El 07/11/2008, a las 7:39, nightcrawler13 escribió:

> but after I followed then I got this error message "Fatal error: Class
> 'AppHelper' not found in C:\xampp\htdocs\stream\app\views\helpers
> \media_player.php on line 106"

You could add the file app_helper.php in

C:\xampp\htdocs\stream\app\

with this code



or simply change the snippet code fromm extends AppHelper to extends  
Helper...

I guess some builds of Cake 1.2 haven't cake/libs/view/helpers/ 
app_helper.php
--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



ACL nodes naming doubt

2008-11-04 Thread Fran Iglesias

Hi,

I want to have two branches on my AROs tree.

One is for a typical controllers/actions authorization systems. It  
works perfectly.

The second one is for a "privileges" based authorization inside  
actions. For example: I want to allow two groups access to the same  
action, but one group can edit all records, and the other group only  
can access their own.

I have a "privileges" root node, but I'm not sure on how to name  
aliases for children Aros. For example:

EditAllRecords or privileges/EditAllRecords

and how to check permissions

$this->Acl->allow($user, 'EditAllRecords');

or

$this->Acl->allow($user, 'privileges/EditAllRecords');

Actually, I have Aros in the first form (EditAllRecords), but the ACL- 
 >check doesn't work well,

in the second form triggers an error DbAcl::check() - Failed ARO/ACO  
node lookup in permissions check,
in the first form Acl->check seems unable to find the right aro.

So, how must I name my Aco aliases? or Is a better approach to this  
kind of setup? Thanks
--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Solved Re: Auth passing user model to Acl

2008-10-30 Thread Fran Iglesias

Sorry,

forget the issue.

It was my fault.

First, the problematic node was the ACO node, not the ARO. Acl  
checking the user model is perfectly OK (obvious).

Second. My ACO's aliases were bad constructed. I was thinking on full  
paths as aliases and that's no longer needed from some time ago. So,  
an "admin_index" node is valid, as child of a "Posts" node, for  
instance.

Thanks.
--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth passing user model to Acl

2008-10-29 Thread Fran Iglesias

Hi,

I have a problem with this.

Using Auth with Acl and action authoroization.

If fails beacause Auth pass the entire user model data to the  
AclComponent->check() method instead of an simple array with model and  
foreign_key keys.

Could this be a misconfiguaration of the Auth Component in the  
AppController?

$this->Auth->userModel = 'Usuario';
$this->Auth->fields = array(
'username' => 'usuario',
'password' => 'clave');
$this->Auth->loginAction = array(
Configure::read('Routing.admin') => false,
'controller' => 'usuarios',
'action' => 'login');
$this->Auth->loginRedirect = array(
'controller' => 'pages',
'action' => 'entrada');
$this->Auth->logoutRedirect = array(
'controller' => 'pages',
'action' => 'salida');
$this->Auth->loginError = __('Error de login', true);
$this->Auth->autoRedirect = false;
$this->Auth->authorize = 'actions';
$this->Auth->actionPath = 'actions/';


--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Acl: way to get Acos related to a given Aro?

2008-10-24 Thread Fran Iglesias

Hi,

I'm trying to find a way to guess all Acs for a given Aro in Acl.

I tried this approach (in a controller, with Acl component)


// get node and all parents
$aro = new Aro();
$node = $aro->node(array('model' => 'Group', 'id' => 7);

// extract id's
$ids = Set::extract($node, '{n}.Aro.id');
$conditions = array('id' => $ids);

// Find all Aros with that id, this will bring associated Aco
$data = $this->Acl->Aro->find('all', $conditions);

// Extract Aco from the array (Privilege is the model for the Acos I  
want to retrieve)
$prueba = Set::extract($data, '/Aco[model=Privilege]');

It seems a bit inefficient. I would like to hear some suggestions.

--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Testing and cake custom installation

2008-10-16 Thread Fran Iglesias

Hi,

I have a custom installation of CakePHP in my development setup  
(mainly to share core and some vendors and to resemble the production  
setup).

Setup is as follows:

/Webserver
   /apps
/app1
/app2
   /Documents (this is Apache document root
 /app1 (the webroot for app1)
 /app2 (the webroot for app2)
   /share
 /cake
 /vendors

But now, testing no longer works,, even changing paths in the test.php  
file.

I know that actual implementation doesn't support this custom install,  
but I would like to know if a workaround is possible.

--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Linking to non-admin action from admin-action

2008-10-09 Thread Fran Iglesias

Hi,

El 09/10/2008, a las 18:11, Sam Sherlock escribió:

> I think you have to add prefix => false to the array 2nd param  
> passed to link - but it might be admin => false (I thnk its the  
> former allowing the admin.routing to be changed eg members or ewoks)


A complete post by AD7six

http://www.ad7six.com/MiBlog/MakingTheMostOfTheRouter

--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Install cake on leopard, but not the docroot

2008-10-08 Thread Fran Iglesias


El 08/10/2008, a las 20:43, dotty escribió:

> Now, how would i go about installing cake without mucking up my ~/
> Sites directory? Could i make a new dir called ~/cakeSites and run
> cake in there?



> Any help would be great!


You could install it under /Library/WebServer/Documents and access it  
in http://localhost

--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Custom views based on action parameters?

2008-10-06 Thread Fran Iglesias

Hi,

El 04/10/2008, a las 17:41, Lamonte escribió:

> How do you do it.


controller->render('view_name');


--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Configure::write or define()

2008-09-26 Thread Fran Iglesias


El 26/09/2008, a las 11:53, luigi7up escribió:

> As I understood old method define(); is much better because it uses
> php native way to define constants and latter on to use that constant
> you just call it like this: _CONSTANT_NAME.


Configure is not intended for define constants.  It's a flexible way  
to read and write application-wide configuration data.

http://book.cakephp.org/view/42/The-Configuration-Class

Constants are OK for multiple purposes.



--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Variables in localization strings

2008-09-24 Thread Fran Iglesias

Hi,

El 24/09/2008, a las 17:38, lemp escribió:

> French: __("objectif", true) . " " . $year;
>
> English: $year . " " . __("objectif", true);



The __() function supports the sprintf format, so

> French: sprintf(__("objectif %s", true));
>
> English: sprintf(__("%s objectif", true));




--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automatic Login after Signup using Auth Component

2008-09-24 Thread Fran Iglesias


El 24/09/2008, a las 9:31, mario escribió:

> So in this case,
> $this->Auth->login($this->data); // login user


I think you have the plain version of the password in password2 field.  
You could do some like:

if ($this->User->save($this->data)) {
$this->data['User']['password'] = $this->data['User']['password2'];
    $this->Auth->login($this->data); // login user
}


--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automatic Login after Signup using Auth Component

2008-09-24 Thread Fran Iglesias


El 24/09/2008, a las 9:02, mario escribió:

> This time, it failed to login the user. It seems like there is some
> problem in terms of hashing my password.


Not sure, but you may try to login the User, with the non-hashed  
password.
--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automatic Login after Signup using Auth Component

2008-09-23 Thread Fran Iglesias


El 24/09/2008, a las 7:28, mario escribió:

> Do anyone of you have an idea on how to automatically login
> after signing-up using Auth Component?


This seems a task for $this->Auth->login()

http://api.cakephp.org/1.2/class_auth_component.html#5c2562e36d1fb6f8b93a15fb23604abc


--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Behavoirs no load

2008-04-30 Thread Fran Iglesias


El 30/04/2008, a las 13:24, inver escribió:

> $this->Noticia->bindTranslate('titulo')


$this->Noticia->bindTranslation('titulo');

http://api.cakephp.org/1.2/class_translate_behavior.html#9753a3633a708bcd9e8a2f479cd72936

--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Creating forms

2008-04-24 Thread Fran Iglesias


El 24/04/2008, a las 10:05, rtanz escribió:

> my problem is how to
> have cake then create the forms themselves based on the designer's
> selection. any hints? thanks

You could create fields in the "Question" model to store the type and  
options for response.

Then, in the view, a switch structure could output a different form  
element according to that info.

hth
--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: php4 auto-validation

2008-04-23 Thread Fran Iglesias


El 23/04/2008, a las 8:40, Hugues escribió:

> Anyone already addressed this issues so far?


First of all, check the class var $name in your models and  
controllers. It is needed for php4 compatibility, For exemaple:

class Post extends AppModel {
var $name = 'Post';
}

if not present, the application fails with no messagges or with  
apparently unrelated warnings.

Hope that helps.
--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Poor EmailComponent templating

2008-03-07 Thread Fran Iglesias


El 07/03/2008, a las 4:27, Andrey Demenev escribió:

> and was very surprised to see that is accepts email
> content as text.


I think you must google around a bit.

This is how I say Email to use a template (controller)

$this->Email->template = 'usuarios'.DS.'alta';
$this->set (compact('data')); // $data contains the data I want 
to  
pass to the template


This is an example of a template I have in my APP/views/element/email/ 
text/usuarios/alta.ctp (in Spanish, but you'll get the idea)


Hola, 

Has sido dado de alta en  con los siguientes datos de conexión:

Usuario: 
Clave: 

Importante: Los datos que recibes en este mensaje anulan cualquier  
otro que hayas recibido anteriormente para este nombre de usuario en  
este servicio.

Para acceder, visita la página 

Gracias.

--
Fran Iglesias
[EMAIL PROTECTED]





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



Re: Some doubts with Dynamic Content Localization

2008-03-06 Thread Fran Iglesias


El 06/03/2008, a las 9:57, ninjapiza escribió:

> What's your question about your doubt is with associated models ?

I don't know if the translate behavior is able to retrieve  
translations for the associated models. And if so, how?

>> Another bit confusing me after reading some tutorials is how to set a
>> default language for the behavior. I mean: is there a CakePHP setting
>> for this or you must set one of your own?.


For this, I found that Config.language is the key in Configure.

--
Fran Iglesias
[EMAIL PROTECTED]





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



Unexpected error with cake console

2008-03-05 Thread Fran Iglesias

Hi,

I'm trying to use cake to bake some stuff and to extract POT files  
for my apps with the i18n shell.

Shells start OK and both show their menus, but when I choose an  
option I get an error like:

Fatal error: Call to a member function on a non-object in / 
Applications/MAMP/htdocs/virtualba/cake/console/libs/i18n.php on line 85

or:

Fatal error: Call to a member function on a non-object in / 
Applications/MAMP/htdocs/virtualba/cake/console/libs/bake.php on line 94

Version is v1.2.0.6311. I've just downloaded last branches from  
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/console and  
have the same problem.

Would like to know if someone else has a similiar problem.


--
Fran Iglesias
[EMAIL PROTECTED]





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



Re: Custom Component and Redirect problem

2008-02-07 Thread Fran Iglesias


El 07/02/2008, a las 23:43, Micro escribió:

> If I uncomment the  $this->redirect(array('action'=>'index')), my
> component works perfectly fine, and i don't get any error.  I try to
> comment out the component part, and it works fine.  The problem only
> occurs when I use my custom component and has the redirect line.  Any
> clue?


Redirect sends headers, and you has just printed a result. You have to  
rethink the code.
--
Fran Iglesias
[EMAIL PROTECTED]




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



Re: Ajax links working first time (Solved)

2008-02-06 Thread Fran Iglesias

Hi,

El 05/02/2008, a las 19:11, Fran Iglesias escribió:

> This works well... the first time.
>
> When I create or edit an event the index updates but the links (ajax
> links are created with AjaxHelper:link()) doesn't work. In fact, when
> I look at the generated HTML there is no javascript code to manage the
> Ajax request (the first time, there is).


I think I've solved the problem. I wrote a redux with a fake  
controller and a pair of actions to simulate the situation.

I used htmlentities to show the code generated by the AjaxHelper::link 
() method. If I did so, the ajax link generated in the ajax request  
worked ok. If no, the link simply doesn't respond. So I guessed that  
there was a problem with the encoding of the ajax request.

I need to build the ajax link explicitly setting the 'encoding'  
option to 'utf-8' (in the options array that you pass to the link()  
method).

Hope that helps others.

--
Fran Iglesias
[EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ajax links working first time

2008-02-05 Thread Fran Iglesias

Hello,

I have a problem with the AjaxHelper. I'll try to explain:

I have a view to edit Posts. Post hasMany Event, so I manage to build  
a view with an "embedded" index and form to create and edit Events  
related to a post.

This works well... the first time.

When I create or edit an event the index updates but the links (ajax  
links are created with AjaxHelper:link()) doesn't work. In fact, when  
I look at the generated HTML there is no javascript code to manage the  
Ajax request (the first time, there is).

PostsController and EventsController both have Ajax and Javascript in  
the components array, and protoype is loaded in the main view.

There is no problems with conflicting DOM id or similar.

The issue happens at ajax request.

I would like some suggestion on how to debug this issus. Thanks.
--
Fran Iglesias
[EMAIL PROTECTED]




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



Re: Installing CakePHP on MAMP

2008-01-25 Thread Fran Iglesias

Hi,

El 25/01/2008, a las 9:56, [EMAIL PROTECTED] escribió:

> Doesn't MAMP use some non-standard port by
> default?


MAMP uses  port for http and 8889 port for Mysql by default. You  
may change this in Preferences.

So, in your browser

http://localhost:/

Another issue is the location of mysql.sock for Bake. You may need to  
do a symbolic link in /var/mysql to the "MAMP" mysql.sock (default  
installation)
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

(in var you may need to create a directoru for mysql).

cd /var
sudo mkdir mysql

then

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
--

Fran Iglesias
[EMAIL PROTECTED]




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



Re: Question about Set class

2008-01-18 Thread Fran Iglesias


El 18/01/2008, a las 15:01, grigri escribió:

> debug(Set::extract($temp, '{n}.0.task'));

Thanks. So simple...

> On Jan 18, 1:00 pm, "R. Rajesh Jeba Anbiah"
> <[EMAIL PROTECTED]> wrote:
>>FWIW, when I profiled Set class last time, it was relatively huge
>> hit.
>>

I agree, but performance is not critical at this step of development  
(or even for the final application, we don't expect a huge amount of  
visitors). But I found Set class very useful.

--
Fran Iglesias
[EMAIL PROTECTED]




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



Question about Set class

2008-01-18 Thread Fran Iglesias

Hi

I have this array:

Array
(
 [0] => Array
 (
 [0] => Array
 (
 [id] => 2
 [task] => Circulares.Preparar
 )
)
 [1] => Array
 (
 [0] => Array
 (
 [id] => 5
 [task] => *.*
 )
 )
)

I want to get an array like this

Array {
 [0] => Circulares.preparar
 [1] => *.*
}

?'ve been trying several paths with Set::extract to get it but my  
best result is with '{n}.{n}.task', which produces

Array
(
 [0] => Array
 (
 [0] => Circulares.Preparar
 )

 [1] => Array
 (
 [0] => *.*
 )
)

I would like to know if there is a way to achieve this using the Set  
class or I need to "postproccess" the result.

I've read the API, and http://www.thinkingphp.org/2007/02/24/cake-12s- 
set-class-eats-arrays-for-breakfast/ without success.


TIA
--
Fran Iglesias
[EMAIL PROTECTED]




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



CSS Vendors folder (Cake 1.2, latest alpha)

2007-10-09 Thread Fran Iglesias

Hi,

I'm trying to put some shared CSS into the vendors/css folder, but  
they are not loaded at all. All links echoed by $html->css() point to  
webroot. I'm not sure if I need to do something more.

The server enviroment is:

- PHP as CGI (Server API CGI/FastCGI)
- Shared hosting
- PHP 4.3.11
- no mod_rewrite
- no .htaccess

Installation is located in a subfolder, as

/html/cakeinstall/...

with the default folder structure.

After some research I found that env('SCRIPT_NAME') didn't work for  
me, but $_SERVER['SCRIPT_NAME'] worked fine (env bug? I'm not sure  
after reading source in the API). So I change app/config/core.php to  
define BASE_DIR with this value.


--
Fran Iglesias
[EMAIL PROTECTED]




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




Re: Advice on retrieving groups of authorized objects

2007-09-10 Thread Fran Iglesias

Thank you AD,

I guess it's better for me to activate the "B plan".

In my pre-cakaphp developer life, I wrote a simpler, yet functional,  
system. I could try to improve it with some ideas from ACL's. Major  
limitations was granularity (it works on group basis) and it was not  
hierarchical.
--
Fran Iglesias
[EMAIL PROTECTED]




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



Advice on retrieving groups of authorized objects

2007-09-10 Thread Fran Iglesias

Hi,

I've been researching on ACL, trying to find a way to implement this  
to authorize users to access the resources in my application.

I've found several tutorials and articles in the Bakery and other  
webs about CakePHP and I think I understand de basis and how to  
implement access control to individual actions or objects, but I  
failed to figure a way to select objects based on ACL.

For example. I need to allow several groups to acces to an index  
action, but I need to retrieve only the items that are are allowed to  
the logged user. The ACL API gives me answers to the question "Is  
this user allowed to access that item?", but I want to find the  
answer to "What items are allowed to this user given this action".

My best guess is a two step process. First, check if the user is  
allowed to access the action. Second, retrieve the array of ACO's  
allowed to the user (for a particular model) and use it to construct  
a query to select them in this way: SELECT * FROM [model] WHERE id IN 
([list of id]).

I think this method implies some sort of "multiroot" in the ACO  
table, one root for actions, one root for objects (I mean posts, or  
reports..., the objects that users want to manage)...

I would like to hear some advice in this question.
--
Fran Iglesias
[EMAIL PROTECTED]




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



Arguments in behavior methods (cake 1.2)

2007-07-24 Thread Fran Iglesias

Hi,

I've been playing with behaviors for a project and I want to ask if  
behavior methods "automagically" get the model as the first argument.

This seems clear with callback methods, but I found this happening in  
public methods as well. So, I guess you can invoke a method form a  
behavior without passing a reference to the model, isn't it?
--
Fran Iglesias
[EMAIL PROTECTED]




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



Re: My own global function

2007-06-20 Thread Fran Iglesias


El 19/06/2007, a las 23:31, chanh.ong escribió:

> Which of these options will my functions be availalbe in all places
> like model, controller, and view?

In 1.2 you can use /app/config/bootstrap.php to load "globally  
available" functions.


--
Fran Iglesias
[EMAIL PROTECTED]




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



Re: Persistent forms?

2007-06-13 Thread Fran Iglesias


El 13/06/2007, a las 2:15, Geoff Ford escribió:

> How are you building the form and how are you passing the data in?

I was building it relaying on $this->data (I'm very new to Cake, 2-3  
weeks or so, and even more newbie to Ajax... 2-3 days or so).

> If you are unsing the formhelpers they rely on $this->data.  If in
> your controller you are setting $this->data that is why the details
> are being displayed in the form.

I think you point me to the solution. I rewrite the action in the  
controller:

function add () {
if (!empty ($this->data['Frasecita'])) {
if ($this->Frasecita->save($this->data)) {
$this->Frasecita->create ();
// Clear $this->data to get an empty form -> 
Thanks Geoff Ford
$this->data = array ();
}   
}

// If Ajax Retrieve data to show the index table and redraw the 
 
entire view (todo.ctp).
if ($this->RequestHandler->isAjax()) {
$this->set ('frases', $this->Paginate ());  

$this->render ('todo');
}
// Else render the default view for this action
}

Simply clear the $this->data after saving.

The point is that the view is going to render the form in the same  
cycle, so $this->data is still populated with POST data.

Thank you.
--
Fran Iglesias
[EMAIL PROTECTED]
http://cakephilia.blogspot.com  



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



Persistent forms?

2007-06-12 Thread Fran Iglesias

Hi,

I've been playing with the AjaxHelper (in Cake v 1.2.0.5146alpha).

I'm having a problem trying to reset a form after submitting the data  
and saving them. This works well but I was unable to reset the form.  
I guess there is some persistence system that works even  between  
reloads of the page (good, but I don't know where).

I've tried Form.reset() (from prototype.js) in the "complete"  
callback (AjaxHelper::submit). But nothing happens.

I've tried other approaches with javascript with no result.

Finally, I've set default values in the view (passing an array with  
'value' => '' to FormHelper::input)

This works well, except for the fact that if the user inputs wrong  
data and these doesn't validate, the form is resetted.

So... the questions:

Is there persistence support for data in forms (and where)? I think  
so, but...
Is there a way to reset a form after submit with ajax?

(Check in the controller or view if is necessary to reset the form???)

Thanks in Advance.


--
Fran Iglesias
[EMAIL PROTECTED]
http://cakephpilia.blogspot.com



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



Re: Additional layout placeholders?

2007-06-07 Thread Fran Iglesias


El 07/06/2007, a las 18:18, mrtopher escribió:

> Sounds like I
> might have to replicate a little more HTML than I would like but I
> think it could work.

AFAIK, you could insert elements in your  layout via

echo $this->element ('elementName');

so, you could have your "containers" in the layout, and fill them  
with elements, and the $content_for_layout for the output of the  
actual controller/action.

(I've read about other ways to achieve similar results to solve some  
performance issues)
--
Fran Iglesias
[EMAIL PROTECTED]




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



Re: Upload a File with CakePHP 1.2.0.5137alpha

2007-06-01 Thread Fran Iglesias


El 01/06/2007, a las 15:31, dardosordi escribió:

> Hope it helps.
> It's all there, just read the code.

I've just found the problem.

As said, model->data is empty until Save. I was trying to access some  
data from the upload before it was available to the model. Solution:  
move all logic related to model->data to the beforeSave method (or  
where it belongs).

My logic involves some "autorouting" of the files depending on mime- 
type, and a "mode" option to store references to the file ior the  
content of the file itself n the model . File Upload model is also in  
the To Do list for my project.

Thank you.

--
Fran Iglesias
[EMAIL PROTECTED]




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



Re: Upload a File with CakePHP 1.2.0.5137alpha

2007-06-01 Thread Fran Iglesias


El 31/05/2007, a las 14:48, dardosordi escribió:

> save http://bin.cakephp.org/saved/17539 as app/models/behaviors/
> upload.php

Hi, I've tried a similar approach to write an upload behavior (my  
first behavior, yes, another newBaker) based on this example but it  
fails when adding new models, because model->data array contains  
nothing before save and the setup method tries to access it.

By the way, I'm not sure about the placement of upload files as a  
behavior. I see it on the controller layer, but not so sure :-(.

I would like to find some documentation about the inners of writing  
behaviors, not only api or sample code (useful, but a bit difficult  
for a starter). Some sort of empty template... Any ideas?

--
Fran Iglesias
[EMAIL PROTECTED]




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