Re: Cakephp deployment gone wrong...page controller not working. Maybe .htaccess problem?

2010-10-16 Thread mig_akira

Actually I changed my Apache at home to "AllowOverride None", and I could
replicate the error. Could someone confirm that this error could be a server
error, and not a cakephp config error?

THanks!
-- 
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Cakephp-deployment-gone-wrong-page-controller-not-working-Maybe-htaccess-problem-tp3215523p3215550.html
Sent from the CakePHP mailing list archive at Nabble.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


Cakephp deployment gone wrong...page controller not working. Maybe .htaccess problem?

2010-10-16 Thread mig_akira

Hello everyone.

I'm trying to deploy a simple website. It's working fine, except that I cant
go to any link in my site (all links are using the page controller). It just
says page not found. In my test environment it's working perfectly. 

In my PC it's located in /var/www/cakephp/app, and cakephp is the root
folder.

In the server, its in /eventos/eneimagem/2010, 2010 is the root folder.
Here's the link to the simple page.

www.uel.br/eventos/eneimagem/2010

(it's in portuguese). 

Another thing, I was using the css('default'); ?>, but it could
not find the css file. I had to change it manually  to  

It seems that the webroot folder has some problem.

Can anyone help me here?

Thanks!



-- 
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Cakephp-deployment-gone-wrong-page-controller-not-working-Maybe-htaccess-problem-tp3215523p3215523.html
Sent from the CakePHP mailing list archive at Nabble.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: Simple Cakephp image gallery??

2010-09-21 Thread mig_akira

After messing with it a lot, mainly by using print_r($thumbs), I found out
the problem... where it's written $thumbs['photo']... it should be
$thumbs['photoset']['photo']...

Now everything is working just fine.
-- 
View this message in context: 
http://cakephp.19694.n2.nabble.com/Simple-Cakephp-image-gallery-tp5552915p5553139.html
Sent from the CakePHP mailing list archive at Nabble.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


Simple Cakephp image gallery??

2010-09-21 Thread mig_akira

Hello everyone. I'm trying to build a simple image gallery on cakephp, but it
seems there's no tutorials about that in the internet. 

The only one I found was this one (
http://articles.sitepoint.com/article/photo-gallery-cakephp-flickr ), but
it's from 2007 and I can't seem to get it to work. I get as far as writing
the view, but then I get "Undefined index:  title" and "Undefined index: 
id".

My code is: 
<-- app/views/gallery/index.ctp -->


 
 



 
 link($item['title'], '/gallery/' .
$item['id']);?>  
 


If I change $html-->link($item['title'] to $html->link($item[0]['title'] I
can get the title, but nothing more. If I click on the link, nothing
happens.

My controller is:

function index($id = null)
{
$photosets = $this->flickr->photosets_getList('');
$this->set('sets', $photosets);
$currset = $id == null ? $photosets['photoset'][0]['id'] : $id;
$this->set('currset', 
$this->flickr->photosets_getInfo($currset));
$this->set('thumbs', 
$this->flickr->photosets_getPhotos($currset));
}

What am I doing wrong, or is there any better tutorial for building a image
gallery?

Thanks a lot!






-- 
View this message in context: 
http://cakephp.19694.n2.nabble.com/Simple-Cakephp-image-gallery-tp5552915p5552915.html
Sent from the CakePHP mailing list archive at Nabble.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: Problem viewing data...

2009-09-25 Thread mig_akira


Ok just did that, here's the output:

prjr2009/controllers/users_controller.php (line 88)
id: 2

So the ID is correct, but it's still showing the user with id: 1 ! I'm
starting to think it's mocking me =P


brian-263 wrote:
> 
> 
> Put debug("id: ${id}") in your controller. Maybe it's not what you
> think it is. Do you have a route for this action?
> 
> On Thu, Sep 24, 2009 at 1:38 PM, mig_akira  wrote:
>>
>>
>> Ops, sorry, here's the code for views/users/view.ctp
>> [code]
>> 
>> 
>> 
>>        
>>                >> __('Ativo'); ?>
>>                >
>>                        
>>
>>                
>>                >> ?>
>>                >
>>                        
>>
>> (and son on)..
>> [/code]
>>
>> the contents are not the same, because it happens for every
>> user...doesn't
>> matter if it's user number 7 or 123...=(
>>
>> I don't get, because all other views for other controllers, such as for
>> groups, are correct and are pretty much similar to the users view!
>>
>>
>>
>> brian-263 wrote:
>>>
>>>
>>> On Mon, Sep 21, 2009 at 4:47 PM, mig_akira 
>>> wrote:
>>>>
>>>>
>>>> hello everyone!
>>>>
>>>> I'm building a simple web page, with Auth/ACL and a few members.
>>>>
>>>> Problem is, I baked the admin part of the site, and everything works
>>>> fine
>>>> except for one thing! In my users admin page, I click in "view", but it
>>>> insists in showing the view for the first user (in this case, the
>>>> admin).
>>>>
>>>> In my url, it shows /users/view/7 (number of the user's ID), but it
>>>> shows
>>>> the data for the user with ID == 1.
>>>>
>>>> Funny thing is, if I click EDIT instead of VIEW, it shows the correct
>>>> user!
>>>> (and the URL is /users/edit/7)
>>>>
>>>> Here are the codes for the VIEWS/USERS/INDEX.CTP :
>>>> [code]
>>>> >>> $i = 0;
>>>> foreach ($users as $user):
>>>>        $class = null;
>>>>        if ($i++ % 2 == 0) {
>>>>                $class = ' class="altrow"';
>>>>        }
>>>> ?>
>>>>        >
>>>>                
>>>>                        
>>>>                
>>>>                
>>>>                        
>>>>                
>>>>                
>>>>                        
>>>>                
>>>>                
>>>>                        link(__('View', true),
>>>> array('action'=>'view',
>>>> $user['User']['id'])); ?>
>>>>                        link(__('Edit', true),
>>>> array('action'=>'edit',
>>>> $user['User']['id'])); ?>
>>>>                        link(__('Delete', true),
>>>> array('action'=>'delete',
>>>> $user['User']['id']), null, sprintf(__('Are you sure you want to delete
>>>> #
>>>> %s?', true), $user['User']['id'])); ?>
>>>>                
>>>>        
>>>> 
>>>> [/code]
>>>
>>>
>>> That's the view for index(), not view(). The latter would not have a
>>> foreach loop, as you should only have a single User in your array.
>>>
>>>> And here's for the action view in the users_Controller.php:
>>>> [code]
>>>> function view($id = null) {
>>>>                if (!$id) {
>>>>                        $this->Session->setFlash(__('Invalid User.',
>>>> true));
>>>>                        $this->redirect(array('action'=>'index'));
>>>>                }
>>>>                $this->set('user', $this->User->read(null, $id));
>>>>        }
>>>> [/code]
>>>>
>>>> What could be the problem?
>>>>
>>>
>>> Check that you're looking at the proper view file. Then, add
>>> debug($user). It's possible that the record in the database is the
>>> same for User 1 & 7.
>>>
>>> >
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Problem-viewing-data...-tp25530475p25578012.html
>> Sent from the CakePHP mailing list archive at Nabble.com.
>>
>>
>> >
>>
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-viewing-data...-tp25530475p25612039.html
Sent from the CakePHP mailing list archive at Nabble.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: Problem viewing data...

2009-09-24 Thread mig_akira


Ops, sorry, here's the code for views/users/view.ctp
[code]




>
>

 

>
>

 
(and son on)..
[/code]

the contents are not the same, because it happens for every user...doesn't
matter if it's user number 7 or 123...=(

I don't get, because all other views for other controllers, such as for
groups, are correct and are pretty much similar to the users view!



brian-263 wrote:
> 
> 
> On Mon, Sep 21, 2009 at 4:47 PM, mig_akira  wrote:
>>
>>
>> hello everyone!
>>
>> I'm building a simple web page, with Auth/ACL and a few members.
>>
>> Problem is, I baked the admin part of the site, and everything works fine
>> except for one thing! In my users admin page, I click in "view", but it
>> insists in showing the view for the first user (in this case, the admin).
>>
>> In my url, it shows /users/view/7 (number of the user's ID), but it shows
>> the data for the user with ID == 1.
>>
>> Funny thing is, if I click EDIT instead of VIEW, it shows the correct
>> user!
>> (and the URL is /users/edit/7)
>>
>> Here are the codes for the VIEWS/USERS/INDEX.CTP :
>> [code]
>> > $i = 0;
>> foreach ($users as $user):
>>        $class = null;
>>        if ($i++ % 2 == 0) {
>>                $class = ' class="altrow"';
>>        }
>> ?>
>>        >
>>                
>>                        
>>                
>>                
>>                        
>>                
>>                
>>                        
>>                
>>                
>>                        link(__('View', true),
>> array('action'=>'view',
>> $user['User']['id'])); ?>
>>                        link(__('Edit', true),
>> array('action'=>'edit',
>> $user['User']['id'])); ?>
>>                        link(__('Delete', true),
>> array('action'=>'delete',
>> $user['User']['id']), null, sprintf(__('Are you sure you want to delete #
>> %s?', true), $user['User']['id'])); ?>
>>                
>>        
>> 
>> [/code]
> 
> 
> That's the view for index(), not view(). The latter would not have a
> foreach loop, as you should only have a single User in your array.
> 
>> And here's for the action view in the users_Controller.php:
>> [code]
>> function view($id = null) {
>>                if (!$id) {
>>                        $this->Session->setFlash(__('Invalid User.',
>> true));
>>                        $this->redirect(array('action'=>'index'));
>>                }
>>                $this->set('user', $this->User->read(null, $id));
>>        }
>> [/code]
>>
>> What could be the problem?
>>
> 
> Check that you're looking at the proper view file. Then, add
> debug($user). It's possible that the record in the database is the
> same for User 1 & 7.
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-viewing-data...-tp25530475p25578012.html
Sent from the CakePHP mailing list archive at Nabble.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: Paginate - order clause is ambiguous!

2009-09-23 Thread mig_akira


That did the trick!
Thanks!


lapinski wrote:
> 
> 
> Try this:
> 
> var $paginate = array ('order' => 'Page.index');
> 
> Lapinski
> 
> 
> mig_akira wrote:
>> 
>> Hello everyone!
>> 
>> I'm having a problem here. 
>> 
>> I have a table Pages, which belongsTo Categories. I'm using an
>> "ordenable" behaviour, and so both pages and categories have a field
>> called "index". Problem is, in my pages_controller, i wrote this:
>> 
>> var $paginate = array ('order' => 'index');
>> 
>> And as a result, I receive an error saying 
>> 
>> SQL Error: 1052: Column 'index' in order clause is ambiguous
>> 
>> It must be because both categories and pages have the same field. I cant
>> change this field...so how can I specify that I want to use the index
>> from the Pages table?
>> 
>> Thanks!!
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Paginate---order-clause-is-ambiguous%21-tp25530985p25531276.html
Sent from the CakePHP mailing list archive at Nabble.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 can I pass variable from app_controller to a component?

2009-09-22 Thread mig_akira


Well, problem solved...don't know if I did it the right way, though...

Since the variable I was trying to use in my component was an array of data
from a table, I had to import the model in the component using: 

$Category = ClassRegistry::init('Category');

So I set the array after that, in the component as well, like this:

   $categories = $Category->find('all',array(
'conditions'=>array('Category.active'=>1),
'order'=> array('Category.index'=>'ASC')
));

Thanks!


mig_akira wrote:
> 
> Hello everyone.
> 
> I'm trying to build a simple dropdown menu for a website. I'm using this
> tutorial:
> http://www.palivoda.eu/2008/04/dynamic-menu-in-cakephp/
> 
> THe menu is working, but I don't know how can I pass the array with all
> the data to build the menu from the app_controller to the menu component. 
> 
> I was using a simple element menu, with this in my appcontroller's
> beforeFilter:
> 
> function _setLayoutFrontEnd()
> {
>   $this->layout = 'default';
> $this->_loadMenu();
> }
> 
> function _loadMenu()
> {
>   $categories = $this->Category->find('all',array(
>   'conditions'=>array('Category.ativo'=>1),
>   'order'=> array('Category.indexpag'=>'ASC')
>   ));
>   $this->set('categories',$categories);
> }
> 
> With that, I could use the array $categories in my view/elements/menu.ctp. 
> 
> Now I need to pass it to my controllers/components/menu.php. 
> How can I do that?
> 
> Thanks!!!
> 

-- 
View this message in context: 
http://www.nabble.com/how-can-I-pass-variable-from-app_controller-to-a-component--tp25530525p25530987.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



Paginate - order clause is ambiguous!

2009-09-22 Thread mig_akira


Hello everyone!

I'm having a problem here. 

I have a table Pages, which belongsTo Categories. I'm using an "ordenable"
behaviour, and so both pages and categories have a field called "index".
Problem is, in my pages_controller, i wrote this:

var $paginate = array ('order' => 'index');

And as a result, I receive an error saying 

SQL Error: 1052: Column 'index' in order clause is ambiguous

It must be because both categories and pages have the same field. I cant
change this field...so how can I specify that I want to use the index from
the Pages table?

Thanks!!
-- 
View this message in context: 
http://www.nabble.com/Paginate---order-clause-is-ambiguous%21-tp25530985p25530985.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



how can I pass variable from app_controller to a component?

2009-09-21 Thread mig_akira


Hello everyone.

I'm trying to build a simple dropdown menu for a website. I'm using this
tutorial:
http://www.palivoda.eu/2008/04/dynamic-menu-in-cakephp/

THe menu is working, but I don't know how can I pass the array with all the
data to build the menu from the app_controller to the menu component. 

I was using a simple element menu, with this in my appcontroller's
beforeFilter:

function _setLayoutFrontEnd()
{
$this->layout = 'default';
$this->_loadMenu();
}

function _loadMenu()
{
$categories = $this->Category->find('all',array(
'conditions'=>array('Category.ativo'=>1),
'order'=> array('Category.indexpag'=>'ASC')
));
$this->set('categories',$categories);
}

With that, I could use the array $categories in my view/elements/menu.ctp. 

Now I need to pass it to my controllers/components/menu.php. 
How can I do that?

Thanks!!!
-- 
View this message in context: 
http://www.nabble.com/how-can-I-pass-variable-from-app_controller-to-a-component--tp25530525p25530525.html
Sent from the CakePHP mailing list archive at Nabble.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 viewing data...

2009-09-21 Thread mig_akira


hello everyone!

I'm building a simple web page, with Auth/ACL and a few members. 

Problem is, I baked the admin part of the site, and everything works fine
except for one thing! In my users admin page, I click in "view", but it
insists in showing the view for the first user (in this case, the admin). 

In my url, it shows /users/view/7 (number of the user's ID), but it shows
the data for the user with ID == 1.

Funny thing is, if I click EDIT instead of VIEW, it shows the correct user!
(and the URL is /users/edit/7)

Here are the codes for the VIEWS/USERS/INDEX.CTP :
[code]

>










link(__('View', true), 
array('action'=>'view',
$user['User']['id'])); ?>
link(__('Edit', true), 
array('action'=>'edit',
$user['User']['id'])); ?>
link(__('Delete', true), 
array('action'=>'delete',
$user['User']['id']), null, sprintf(__('Are you sure you want to delete #
%s?', true), $user['User']['id'])); ?>



[/code]

And here's for the action view in the users_Controller.php:
[code]
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid User.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('user', $this->User->read(null, $id));
}
[/code]

What could be the problem?

THanks!!!

-- 
View this message in context: 
http://www.nabble.com/Problem-viewing-data...-tp25530475p25530475.html
Sent from the CakePHP mailing list archive at Nabble.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: Simple question !

2009-09-04 Thread mig_akira


Yes, I think that it can be done by creating a file called app_models.php in
the root folder of your application (like the app_controller.php)

Aziz-6 wrote:
> 
> 
> Is it possible to create a "beforesave" method for all the models ?
> I mean in a file like app_controller which controll all the controllers
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Simple-question-%21-tp25295075p25299320.html
Sent from the CakePHP mailing list archive at Nabble.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: $form->input('category_id') shows only category IDs to select - can I make it more user friendly, showing the name of the category?

2009-09-03 Thread mig_akira


Ops sorry guys... i searched the web and I find myself the answer...

just put in my category model the line
var $displayField = "title";
and so it displays the title in the add view.



mig_akira wrote:
> 
> Using associated models (categories hasMany members) I wrote in my
> membersController I wrote: 
> 
> $this->set('categories $this->Member->Category->find('list'));
> 
> and in the add view, i just wrote:
> 
>   echo $form->input('category_id');
> 
> Works beautifully, except that it only shows numbers (the ID of the
> category) in the selection box. It would be nice if could show the names
> of the groups instead. How can I do this simple modification? 
> 
> Thanks in advance!
> 

-- 
View this message in context: 
http://www.nabble.com/%24form-%3Einput%28%27category_id%27%29-shows-only-category-IDs-to-select---can-I-make-it-more-user-friendly%2C-showing-the-name-of-the-category--tp25288173p25288264.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



$form->input('category_id') shows only category IDs to select - can I make it more user friendly, showing the name of the category?

2009-09-03 Thread mig_akira


Using associated models (categories hasMany members) I wrote in my
membersController I wrote: 

$this->set('categories $this->Member->Category->find('list'));

and in the add view, i just wrote:

  echo $form->input('category_id');

Works beautifully, except that it only shows numbers (the ID of the
category) in the selection box. It would be nice if could show the names of
the groups instead. How can I do this simple modification? 

Thanks in advance!
-- 
View this message in context: 
http://www.nabble.com/%24form-%3Einput%28%27category_id%27%29-shows-only-category-IDs-to-select---can-I-make-it-more-user-friendly%2C-showing-the-name-of-the-category--tp25288173p25288173.html
Sent from the CakePHP mailing list archive at Nabble.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 two models in one controller, paginating data from both

2009-09-03 Thread mig_akira


It was a lot easier than I thought!
Cakephp does all that for me.

In my membersController I wrote 

$this->set('categories $this->Member->Category->find('list'));

and in the add view, i just wrote:

  echo $form->input('category_id');

Works like a charm =)



mig_akira wrote:
> 
> Hello everyone.
> 
> I have a simple question. 
> 
> I have a controller ('membersController') that must use 2 models ('member'
> and 'category'). A category hasMany members. 
> 
> When adding a member, I must choose the category it belongs to in my Add
> view.  To paginate data from the Member model is simple, just
> $this->set('members', $this->paginate());
> But the problem is, I can't get the data from the Category model in my
> MembersController so that the admin can just select one among all
> categories available.
> 
> I tried using, in my membersController:
> 
> var $uses = array('Member ', 'Category')
> 
> But in the add function, what must i use insted of
> $this->set('categories', $this->paginate()); ? 
> 
> Thanks!
> 

-- 
View this message in context: 
http://www.nabble.com/Using-two-models-in-one-controller%2C-paginating-data-from-both-tp25285302p25288150.html
Sent from the CakePHP mailing list archive at Nabble.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: Auth/ACL -> using auth->Authorize='crud' and non-standard actions

2009-09-03 Thread mig_akira


That was exactly what I was looking for!

Thanks a lot!


delocalizer wrote:
> 
> 
> Hi;
> as long as you're happy to allow 'moveUp' in same group as one of
> c,r,u,d, you can use Auth->mapActions to do what you want:
> http://book.cakephp.org/view/813/mapActions
> Otherwise you will have to use Auth->authorize='actions' and recreate
> your acos and aros_acos.
> 
> 
> On Sep 3, 1:02 pm, mig_akira  wrote:
>> OOOPS!!!
>> where I said
>> $this->Auth->actionPath = 'controllers/'
>>
>> I really meant
>> auth->Authorize='crud'
>>
>> sorry for the confusion!!!
>>
>>
>>
>> mig_akira wrote:
>>
>> > Hello everyone.
>>
>> > I'm using auth and acl in my website, and I'm using the 'crud' way to
>> > grant or deny access. Everything is fine, except that I don't know how
>> to
>> > grant or deny access to a non-standard action in a controller.
>>
>> > For example, in my postsController, I have the actions add, read,
>> index,
>> > view, etc. All of those are standard, so I just type in the command
>> line:
>>
>> > cake acl grant Admin Posts '*'  
>>
>> > And I have access for all those actions, because aros_acos table will
>> be
>> > changed accordingly.
>>
>> > But what if I have an action there called "moveUp", for example? How
>> can I
>> > grant or deny access to this action?
>>
>> > FOr now I'm using
>>
>> > Function beforeFilter {
>> >    $this->Auth->allowedActions = array('moveUp');
>> > }
>>
>> > But this isn't safe, as you can imagine =P
>>
>> > Thanks guys! I hope I made myself clear, this ACL/Auth stuff is still a
>> > bit confusing to me!
>>
>> --
>> View this message in
>> context:http://www.nabble.com/Auth-ACL--%3E-using-actionPath-%3E%27controller...
>> Sent from the CakePHP mailing list archive at Nabble.com.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Auth-ACL--%3E-using-actionPath-%3E%27controllers%27-and-non-standard-actions-tp25269069p25285465.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



Using two models in one controller, paginating data from both

2009-09-03 Thread mig_akira


Hello everyone.

I have a simple question. 

I have a controller ('membersController') that must use 2 models ('member'
and 'category'). A category hasMany members. 

When adding a member, I must choose the category it belongs to in my Add
view.  To paginate data from the Member model is simple, just
$this->set('members', $this->paginate());
But the problem is, I can't get the data from the Category model in my
MembersController so that the admin can just select one among all categories
available.

I tried using, in my membersController:

var $uses = array('Member ', 'Category')

But in the add function, what must i use insted of $this->set('categories',
$this->paginate()); ? 

Thanks!
-- 
View this message in context: 
http://www.nabble.com/Using-two-models-in-one-controller%2C-paginating-data-from-both-tp25285302p25285302.html
Sent from the CakePHP mailing list archive at Nabble.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: Auth/ACL -> using auth->Authorize='crud' and non-standard actions

2009-09-02 Thread mig_akira


OOOPS!!! 
where I said 
$this->Auth->actionPath = 'controllers/'

I really meant 
auth->Authorize='crud'

sorry for the confusion!!!


mig_akira wrote:
> 
> Hello everyone.
> 
> I'm using auth and acl in my website, and I'm using the 'crud' way to
> grant or deny access. Everything is fine, except that I don't know how to
> grant or deny access to a non-standard action in a controller. 
> 
> For example, in my postsController, I have the actions add, read, index,
> view, etc. All of those are standard, so I just type in the command line:
> 
> cake acl grant Admin Posts '*'  
> 
> And I have access for all those actions, because aros_acos table will be
> changed accordingly.
> 
> But what if I have an action there called "moveUp", for example? How can I
> grant or deny access to this action?
> 
> FOr now I'm using 
> 
> Function beforeFilter {
>$this->Auth->allowedActions = array('moveUp');
> }
> 
> But this isn't safe, as you can imagine =P
> 
> Thanks guys! I hope I made myself clear, this ACL/Auth stuff is still a
> bit confusing to me!
> 

-- 
View this message in context: 
http://www.nabble.com/Auth-ACL--%3E-using-actionPath-%3E%27controllers%27-and-non-standard-actions-tp25269069p25269129.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



Auth/ACL -> using actionPath->'controllers' and non-standard actions

2009-09-02 Thread mig_akira


Hello everyone.

I'm using auth and acl in my website, and I'm using the 'controllers' way to
grant or deny access. Everything is fine, except that I don't know how to
grant or deny access to a non-standard action in a controller. 

For example, in my postsController, I have the actions add, read, index,
view, etc. All of those are standard, so I just type in the command line:

cake acl grant Admin Posts '*'  

And I have access for all those actions, because aros_acos table will be
changed accordingly.

But what if I have an action there called "moveUp", for example? How can I
grant or deny access to this action?

FOr now I'm using 

Function beforeFilter {
   $this->Auth->allowedActions = array('moveUp');
}

But this isn't safe, as you can imagine =P

Thanks guys! I hope I made myself clear, this ACL/Auth stuff is still a bit
confusing to me!
-- 
View this message in context: 
http://www.nabble.com/Auth-ACL--%3E-using-actionPath-%3E%27controllers%27-and-non-standard-actions-tp25269069p25269069.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



AuthComponent - Need more explanation about "$this->Auth->authorize"

2009-08-07 Thread mig_akira


Hello everyone!

I've been trying to make a simple site using Acl/Auth. Everything is going
fine, except that I don't quite understand the differences between the 4
kinds of 'authorizes', nor how to implement them.

For example, I don't understand how can I use the AclComponent::check() to
authenticate the user when using authorize->'actions'. The same with
authorize->'crud'. Where do I put the mapAction? In appController, or in
every controller? What does it exactly do?

Sorry, but every blog I found about this say that they don't really know how
to use those, and the manual is very briefly about this!

Thanks!!!

(By the way, I'm using authorize->'actions' and I keep getting 
[code]
 DbAcl::check() - Failed ARO/ACO node lookup in permissions check.  Node
references:
Aro: Array
(
[User] => Array
  (
[id] => 3
[username] => normaluser
[name] => miguel
[email] => d...@d.com
[group_id] => 2
[active] => 1
[created] => -00-00 00:00:00
[modified] => -00-00 00:00:00
)

)
[/code]
)


-- 
View this message in context: 
http://www.nabble.com/AuthComponent---Need-more-explanation-about-%22%24this-%3EAuth-%3Eauthorize%22-tp24870311p24870311.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



AuthComponent - Need more explanation about "$this->Auth->authorize"

2009-08-07 Thread mig_akira


Hello everyone!

I've been trying to make a simple site using Acl/Auth. Everything is going
fine, except that I don't quite understand the differences between the 4
kinds of 'authorizes', nor how to implement them.

For example, I don't understand how can I use the AclComponent::check() to
authenticate the user when using authorize->'actions'. The same with
authorize->'crud'. Where do I put the mapAction? In appController, or in
every controller? What does it exactly do?

Sorry, but every blog I found about this say that they don't really know how
to use those, and the manual is very briefly about this!

Thanks!!!

(By the way, I'm using authorize->'actions' and I keep getting 
[code]
 DbAcl::check() - Failed ARO/ACO node lookup in permissions check.  Node
references:
Aro: Array
(
[User] => Array
  (
[id] => 3
[username] => normaluser
[name] => miguel
[email] => d...@d.com
[group_id] => 2
[active] => 1
[created] => -00-00 00:00:00
[modified] => -00-00 00:00:00
)

)
[/code]
)


-- 
View this message in context: 
http://www.nabble.com/AuthComponent---Need-more-explanation-about-%22%24this-%3EAuth-%3Eauthorize%22-tp24870310p24870310.html
Sent from the CakePHP mailing list archive at Nabble.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: orderedBehavior 2.1.2 - Bug in afterdelete function?

2009-06-08 Thread mig_akira


The bug is in line 138, function afterdelete(). TO fix it, we must change
from

 $action = array($this->settings['field'] => $this->settings['field'] . ' -
1');
to
 $action = array($this->settings['field'] => '`'.$this->settings['field'] .
'` - 1');

Thanks!

mig_akira wrote:
> 
> Hello everyone.
> 
> I'm using this behavior:
> http://bakery.cakephp.org/articles/view/orderedbehavior-2-1
> 
> to ordenate pages in my site. 
> 
> But the thing is, when I delete a page, the order_display of all other
> pages does not change automatically. For example, if I have 5 pages, and
> delete the page with order_display number 3, I'll have the following
> order_display: 1, 2, 4, 5 and not 1,2,3,4, which would be correct.
> 
> I believe it must be a bug in the afterdelete filter in the behavior, but
> I can't understand wit, since I'm new to cakephp. Could you people check
> it out please?
> 
> Here's the code:
> 
>   public function beforeDelete(&$Model) {
> 
>   $Model->read();
> 
>   $highest = $this->_highest($Model);
> 
>   if (!empty($Model->data) &&
> ($Model->data[$Model->alias][$Model->primaryKey] ==
> $highest[$Model->alias][$Model->primaryKey])) {
> 
>   $Model->data = null;
> 
>   }
> 
>   }
> 
>   public function afterDelete(&$Model) {
> 
>   if ($Model->data) {
> 
>   // What was the weight of the deleted model?
> 
>   $old_weight = 
> $Model->data[$Model->alias][$this->settings['field']];
> 
>   // update the weight of all models of higher weight by
> 
>   
> 
> 
> 
>   $action = array($this->settings['field'] => 
> $this->settings['field'] .
> ' - 1');
> 
>   $conditions = array(
> 
>   $Model->alias . '.' . 
> $this->settings['field'] . ' >' =>
> $old_weight);
> 
>   if ($this->settings['foreign_key']) {
> 
>   $conditions[$Model->alias . '.' . 
> $this->settings['foreign_key']] =
> $Model->data[$Model->alias][$this->settings['foreign_key']];
> 
>   }
> 
>   // decreasing them by 1
> 
>   return $Model->updateAll($action, $conditions);
> 
>   }
> 
>   return true;
> 
>   }
> 
> 
> I'm using a simple $this->Page->del($id) in the controller to delete the
> pages.
> 
> Thanks a lot!!
> 

-- 
View this message in context: 
http://www.nabble.com/orderedBehavior-2.1.2---Bug-in-afterdelete-function--tp23907768p23923573.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



orderedBehavior 2.1.2 - Bug in afterdelete function?

2009-06-06 Thread mig_akira


Hello everyone.

I'm using this behavior:
http://bakery.cakephp.org/articles/view/orderedbehavior-2-1

to ordenate pages in my site. 

But the thing is, when I delete a page, the order_display of all other pages
does not change automatically. For example, if I have 5 pages, and delete
the page with order_display number 3, I'll have the following order_display:
1, 2, 4, 5 and not 1,2,3,4, which would be correct.

I believe it must be a bug in the afterdelete filter in the behavior, but I
can't understand wit, since I'm new to cakephp. Could you people check it
out please?

Here's the code:

public function beforeDelete(&$Model) {

$Model->read();

$highest = $this->_highest($Model);

if (!empty($Model->data) &&
($Model->data[$Model->alias][$Model->primaryKey] ==
$highest[$Model->alias][$Model->primaryKey])) {

$Model->data = null;

}

}

public function afterDelete(&$Model) {

if ($Model->data) {

// What was the weight of the deleted model?

$old_weight = 
$Model->data[$Model->alias][$this->settings['field']];

// update the weight of all models of higher weight by





$action = array($this->settings['field'] => 
$this->settings['field'] . '
- 1');

$conditions = array(

$Model->alias . '.' . 
$this->settings['field'] . ' >' => $old_weight);

if ($this->settings['foreign_key']) {

$conditions[$Model->alias . '.' . 
$this->settings['foreign_key']] =
$Model->data[$Model->alias][$this->settings['foreign_key']];

}

// decreasing them by 1

return $Model->updateAll($action, $conditions);

}

return true;

}


I'm using a simple $this->Page->del($id) in the controller to delete the
pages.

Thanks a lot!!
-- 
View this message in context: 
http://www.nabble.com/orderedBehavior-2.1.2---Bug-in-afterdelete-function--tp23907768p23907768.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



bug in ordenable behavior: moveDown exceeds number of order_display

2009-06-06 Thread mig_akira


Hello everyone!

I use an ordenable behavior to sort pages in my site. I created a field
called 'index' in my pages table, and it's working fine, except that when I
use the action MoveDown, it keeps moving the index down even limitlessly. 

For example, if there are 5 pages, and I press moveDown in my "page 1" with
"index 1" 10 times, then my pages will be like:
(index - title)
1 - page 2
2 - page 3
3 - page 4
4 - page 5
10 - page 1

It should stop when it's 

5 - page 1

Here's the behavior code:

[code]
 'index',
);

if (array_key_exists('field',$settings))
{
self::$__settings['field'] = $settings['field'];
}
else
{
self::$__settings['field'] = $defaults['field'];
}
}

function beforeSave(&$model)
{
if (! isset($model->data[$model->name]['id']))
{
$lastPage = $this->_getLastContent($model);

if($lastPage)
{

$model->data[$model->name][self::$__settings['field']] =
$lastPage[$model->name][self::$__settings['field']] + 1;
}
else
{

$model->data[$model->name][self::$__settings['field']] = 1;
}
}

return true;
}

function moveUp(&$model,$content)
{
if ( $content[$model->name][self::$__settings['field']] > 1)
{

$searchKey = 
$content[$model->name][self::$__settings['field']] - 1;
echo $searchKey;
$upContent = $model->find('first',array(
'conditions'=> array(
self::$__settings['field'] => $searchKey
)
));

if ($upContent)
{

$upContent[$model->name][self::$__settings['field']] =
$content[$model->name][self::$__settings['field']];
$model->save($upContent);
$model->create(); 
}

$content[$model->name][self::$__settings['field']] = 
$searchKey;
$model->save($content,array('callbacks'=>false));
}
}

function moveDown(&$model,$content)
{

if ( $content[$model->name][self::$__settings['field']] !=
$this->_getLastContent($model))
{
$searchKey = 
$content[$model->name][self::$__settings['field']] + 1;

$downContent = $model->find('first',array(
'conditions'=> array(
self::$__settings['field'] => $searchKey
)
));

if ($downContent )
{
$downContent 
[$model->name][self::$__settings['field']] =
$content[$model->name][self::$__settings['field']];
$model->save($downContent 
,array('callbacks'=>false));
$model->create(); 
}

$content[$model->name][self::$__settings['field']] = 
$searchKey;
$model->save($content,array('callbacks'=>false));
}   
}

function _getLastContent(&$model)
{
return $model->find('first',array(

'order'=>array($model->name.'.'.self::$__settings['field'] => 'DESC')
));
}
}
?>
[/code]

-- 
View this message in context: 
http://www.nabble.com/bug-in-ordenable-behavior%3A-moveDown-exceeds-number-of-order_display-tp23905710p23905710.html
Sent from the CakePHP mailing list archive at Nabble.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: changing the default index view (from pages/index.ctp to, say, /news/index.ctp)

2009-05-15 Thread mig_akira


Great guys! Thanks a lot!

Claudiu Apetrei wrote:
> 
> 
> In the app>config>routes.php. You will find the default /pages/
> setting, you can change it to what controller and action you want.
> 
> On May 15, 6:46 pm, mig_akira  wrote:
>> Hello!
>>
>> I'm making a website where the first home page should be the news page. I
>> would like to change the default /pages/index.ctp to another one, like
>> /news/index.ctp or /news/viewNews.ctp, etc.
>>
>> How can I do that?
>>
>> Thanks!!!
>> --
>> View this message in
>> context:http://www.nabble.com/changing-the-default-index-view-%28from-pages-i...
>> Sent from the CakePHP mailing list archive at Nabble.com.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/changing-the-default-index-view-%28from-pages-index.ctp-to%2C-say%2C--news-index.ctp%29-tp23562479p23568611.html
Sent from the CakePHP mailing list archive at Nabble.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: Auth -> How to show a message "logged in as John' when the user is already logged in

2009-05-15 Thread mig_akira


Indeed it helped! Thanks!

Kyo-4 wrote:
> 
> 
> This might help:
> 
> http://groups.google.ch/group/cake-php/browse_thread/thread/ee9456de93d2eece/7c930c0b46b7eafc?lnk=gst&q=isAuthed#7c930c0b46b7eafc
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Auth--%3E-How-to-show-a-message-%22logged-in-as-John%27-when-the-user-is-already-logged-in-tp23553382p23568606.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



changing the default index view (from pages/index.ctp to, say, /news/index.ctp)

2009-05-15 Thread mig_akira


Hello!

I'm making a website where the first home page should be the news page. I
would like to change the default /pages/index.ctp to another one, like
/news/index.ctp or /news/viewNews.ctp, etc.

How can I do that? 

Thanks!!!
-- 
View this message in context: 
http://www.nabble.com/changing-the-default-index-view-%28from-pages-index.ctp-to%2C-say%2C--news-index.ctp%29-tp23562479p23562479.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



Auth -> How to show a message "logged in as John' when the user is already logged in

2009-05-14 Thread mig_akira


Hello!

I'm using auth to authenticate users and it's working fine. The only problem
is that the user can't know if he's already logged in, since the login and
password boxes are still there even if he logged. 

How can I show a message instead of the login box saying something like "you
are logged in as user John'? 

Thanks!!
-- 
View this message in context: 
http://www.nabble.com/Auth--%3E-How-to-show-a-message-%22logged-in-as-John%27-when-the-user-is-already-logged-in-tp23553382p23553382.html
Sent from the CakePHP mailing list archive at Nabble.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: generating slug from title - must be unique! (using sluggable-1.1.3)

2009-05-13 Thread mig_akira




Alexandru Ciobanu-4 wrote:
> 
> 
> On 05/13/2009 06:23 PM, mig_akira wrote:
>>
>>
>> $conditions = array($Model->alias . '.' .
>> $this->__settings[$Model->alias]['slug'] =>' LIKE ' . $slug . '%');
>>
>>
> I can't recall when the change was made but your code won't work with 
> any recent cakephp releases.
> 
> It should be:
> 
> $conditions = array($Model->alias . '.' . 
> $this->__settings[$Model->alias]['slug'].  ' LIKE ' => $slug . '%');
> 
> 

That's great, thanks for warning me! I'm using version 1.2.2.8120, and in
this version it's working, but when I upload everything to the server, I
will change the code to what you said! 

THanks again!
-- 
View this message in context: 
http://www.nabble.com/generating-slug-from-title---must-be-unique%21-%28using-sluggable-1.1.3%29-tp23515374p23529923.html
Sent from the CakePHP mailing list archive at Nabble.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: generating slug from title - must be unique! (using sluggable-1.1.3)

2009-05-13 Thread mig_akira


Hi, thanks for answering.

It was supposed to increment a number at the end, but it seems that there's
a bug in the code. Changing line 121 to 

$conditions = array($Model->alias . '.' .
$this->__settings[$Model->alias]['slug'] =>' LIKE ' . $slug . '%');

And line 125 to

$conditions[$Model->alias . '.' . $Model->primaryKey. ' !='] = $Model->id; 

did the trick! Thanks again!


Braindead-4 wrote:
> 
> 
> As far as I can see from the source, the sluggable behavior increments
> a number at the end of the slug in the case the slug is already in
> use.
> Pls. check the beforeSave event of the sluggable behavior.
> 
> Markus
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/generating-slug-from-title---must-be-unique%21-%28using-sluggable-1.1.3%29-tp23515374p23524033.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



generating slug from title - must be unique! (using sluggable-1.1.3)

2009-05-12 Thread mig_akira


Hello!

I'm using the behavior sluggable-1.1.3 and the instructions from
http://bakery.cakephp.org/articles/view/sluggable-behavior

Everything works fine, except that if I create two pages with the same
Title, then the slugged URL will be the same for both. Is there some way to
stop it from generating the same slug, or to change it somehow (by
generating something like title1, title2, etc)?

Thanks a lot!!
-- 
View this message in context: 
http://www.nabble.com/generating-slug-from-title---must-be-unique%21-%28using-sluggable-1.1.3%29-tp23515374p23515374.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



Reading URL from a mysql table and showing the corresponding page

2009-05-08 Thread mig_akira


Hello there.

I'm new to cakephp. I want to create a controller that will read an URL from
the database and then show the corresponding content in a view. For example,
in the field "URL", there will be written 'contact'. The controller will
read this url, and then show the text in the 'text' field, using the default
view layout. Basically I won't be creating pages in the /pages directory,
they would all be stored in the database.

Is it possible to do that? This would be nice because then if the site's
owner wanted to change the page's content, he wouldn't have to go to the
/pages directory and edit html code and stuff.

Thanks!
-- 
View this message in context: 
http://www.nabble.com/Reading-URL-from-a-mysql-table-and-showing-the-corresponding-page-tp23438387p23438387.html
Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



Showing last 5 posts in a blog

2009-04-27 Thread mig_akira


Hello everyone.

I'm very new to cakephp. 

I would like to show in a page my last 5 blog posts. I made a function
viewAll that shows all posts, but I don't know how can I show only the last
5 entries.

Any help would be appreciated! Thanks!
-- 
View this message in context: 
http://www.nabble.com/Showing-last-5-posts-in-a-blog-tp23267920p23267920.html
Sent from the CakePHP mailing list archive at Nabble.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: Help setting custom validation counting rule

2008-10-02 Thread mig_akira


Hello! 

Sorry, it's because I'm brazilian, and $contagem is the portuguese for
$count...I translated it to post here, but I forgot that! =)


3lancer.eu wrote:
> 
> 
> Hi,
> 
>>   function limitState($data, $limit) {
>>         $count = $this->find('count', array('conditions' => $data,
>> 'recursive' => -1) );
>>         return $contagem < $limit;
>>         }
> 
> What is $contagem doing here then?
> 
> Regards,
> Piotr
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Help-setting-custom-validation-counting-rule-tp19787584p19791258.html
Sent from the CakePHP mailing list archive at Nabble.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help setting custom validation counting rule

2008-10-02 Thread mig_akira


Im doing this way, but it's not quite working:
In my model:

 [code]
'state' => array(
'limit' => array(
'rule' => array ('limitState', 10),
'message' => '*The limit for this state has been
reached'
),

//Along with other rules...

//then the function:
  function limitState($data, $limit) {
$count = $this->find('count', array('conditions' => $data, 
'recursive' => -1) );
return $contagem < $limit;
}

[/code]

I think I just need to narrow my find to only the 'CA' state, but I dont
know how can I do that. Anyone know? 

Thanks again! 

mig_akira wrote:
> 
> Hello!
> 
> I need help making a custom validation rule here. 
> 
> I made a simple form, with name, adress, etc. 
> 
> But in the field 'State', I must limit the max number of people from a
> certain state. Let's say, there can be only 300 people from California
> submitting. THe other states have no limitation whatsoever. The data from
> state is stored in a varchar field, with only the 2 first letters of the
> state ('CA', for example). So I must count how many people from 'state' ->
> 'CA' there is and then must set up a custom rule that prevents people from
> submitting to the site when the max number's been reached.
> 
> Thanks, any help will be appreciated!
> 

-- 
View this message in context: 
http://www.nabble.com/Help-setting-custom-validation-counting-rule-tp19787584p19789495.html
Sent from the CakePHP mailing list archive at Nabble.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Make a validation rule be valid only in a certain date

2008-09-29 Thread mig_akira


Hello!

Is there a way to make a validation rule be applied only within a certain
date? For examplo, in 10/10/2008 the rule will be used, but next day,
10/11/2008, the rule will not be used. The way I need it, there are two
rules, one of them would be used for two days, and the other one will be
used for only one day, and both of them starts at the same day.

The rule is simple, just an 'equalTO' with a warning message. 

For example, in day 1, if the string submited in a form is equalTo
"whatever" or to "wherever", then the rule will be applied. In day 2, the
rule will be applied only to "wherever". And in day 3, no rule will be
applied. 

Thanks!
-- 
View this message in context: 
http://www.nabble.com/Make-a-validation-rule-be-valid-only-in-a-certain-date-tp19727816p19727816.html
Sent from the CakePHP mailing list archive at Nabble.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



making custom validate rule (NotEqualTo)

2008-09-29 Thread mig_akira


Hello!

I'm new to cakePHP and I would like to make a custom validate rule. I made a
page where there is a form with fields such as "name", "adress", etc. In the
field "City" there is only ONE city that is not allowed to apply - say,
"Forbidden City". I need a rule that is similar to "EqualTo", but the
opposite: when the name of the city is equalTo "Forbidden City", then there
would be an error message!

Something like "rule" => array("NotEqualTo", "Forbidden City"). 

Is there an easy way to do this? Can I somehow use the "EqualTo" rule?

THanks !!
-- 
View this message in context: 
http://www.nabble.com/making-custom-validate-rule-%28NotEqualTo%29-tp19725904p19725904.html
Sent from the CakePHP mailing list archive at Nabble.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---