Re: Reserved words in CakePHP?

2012-09-28 Thread Jeremy Burns | Class Outfit
Define "didn't work" and "freaked out".

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 28 Sep 2012, at 16:55:24, Brad Giessing  wrote:

> I created a function called list() in a controller and it freaked out. I 
> guess it doesn't like that, either.
> 
> On Wednesday, April 15, 2009 5:22:14 AM UTC-5, John Andersen wrote:
> Hi all, 
> 
> Is there reserved words in CakePHP, which I can't use when naming my 
> models? 
> 
> For example "collection" and "tag". 
> 
> Enjoy, 
>John, Latvia
> 
> -- 
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>  
>  

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: SQL Error: 1064: You have an error in your SQL syntax;

2012-09-28 Thread Chris
I have commented this line and error disappear..  
/*
$is_friend = in_array($this->user['id'], 
$this->Friend->myFriends($user['User']['id']));
  else
$is_friend = false;
  */ 

can anyone tell me proper way to write this...? I think I need it to read 
code from model. 
 thanks 

On Friday, September 28, 2012 8:55:52 PM UTC-7, Chris wrote:
>
> I have a function which works on 1.2 pre-Beta version,... but not working 
> on 1.3 CAKE 
> can anyone tells me whats wrong with this,... or what am I doing wrong,... 
> THANKS 
>
> SQL Error: 1064: You have an error in your SQL syntax;
>
>   if($this->is_user())
>
> $is_friend = in_array($this->user['id'], 
> $this->Friend->myFriends($user['User']['id']));
>   else
> $is_friend = false;
>   
>   if($user['User']['privacy'] == array_search('friend', 
> Configure::read('Site.privacy')))
>   {
> if($this->user['id'] != $user['User']['id'] && !$is_friend)
> {
>   $this->flash('error', ucfirst('this profile is only viewable by 
> owner\'s friends'));
>   $this->redirect('/send_request/' . $user['User']['username']);
> }
>   }
>   elseif($user['User']['privacy'] == array_search('private', 
> Configure::read('Site.privacy')))
>   {
> if($this->user['id'] != $user['User']['id'])
> {
>   $this->flash('error', ucfirst('this profile is only viewable by 
> its owner'));
>   $this->redirect('/owner/' . $user['User']['username']);
> }
>   }
>   
>   $this->set_title(ucfirst(i18n::translate('info')) . ' : ' . 
> $user['User']['firstname'] . ' ' . $user['User']['lastname']);
>   
>   $this->set('user_obj', $user);
>   
>
> and this is my Friend model: 
>
>  class Friend extends AppModel {
>   var $name = 'Friend';
>
> var $validate = array(
>  'user_id' => array(
>   'rule' => 'notEmpty',
>   'message' => 'Please enter a valid user',
>  ),
>  'friend_id' => array(
>   'rule' => 'notEmpty',
>   'message' => 'Please enter a valid friend',
>  ),
>  );
>  
>
>   var $belongsTo = array('User' => array('foreignKey' => 'friend_id'));
>
>
>   function myFriends($id = null)
>   {
> $friends_ids = $this->generateList(array('Friend.user_id' => $id), 
> array('Friend.friend_id' => 'ASC'), null, '{n}.Friend.friend_id', 
> '{n}.Friend.friend_id');
> return is_array($friends_ids) ? $friends_ids : array();
>   }
>
>
>   function afterDelete()
>   {
>   }
> }
> ?>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




SQL Error: 1064: You have an error in your SQL syntax;

2012-09-28 Thread Chris
I have a function which works on 1.2 pre-Beta version,... but not working 
on 1.3 CAKE 
can anyone tells me whats wrong with this,... or what am I doing wrong,... 
THANKS 

SQL Error: 1064: You have an error in your SQL syntax;

  if($this->is_user())

$is_friend = in_array($this->user['id'], 
$this->Friend->myFriends($user['User']['id']));
  else
$is_friend = false;
  
  if($user['User']['privacy'] == array_search('friend', 
Configure::read('Site.privacy')))
  {
if($this->user['id'] != $user['User']['id'] && !$is_friend)
{
  $this->flash('error', ucfirst('this profile is only viewable by 
owner\'s friends'));
  $this->redirect('/send_request/' . $user['User']['username']);
}
  }
  elseif($user['User']['privacy'] == array_search('private', 
Configure::read('Site.privacy')))
  {
if($this->user['id'] != $user['User']['id'])
{
  $this->flash('error', ucfirst('this profile is only viewable by 
its owner'));
  $this->redirect('/owner/' . $user['User']['username']);
}
  }
  
  $this->set_title(ucfirst(i18n::translate('info')) . ' : ' . 
$user['User']['firstname'] . ' ' . $user['User']['lastname']);
  
  $this->set('user_obj', $user);
  

and this is my Friend model: 

 array(
  'rule' => 'notEmpty',
  'message' => 'Please enter a valid user',
 ),
 'friend_id' => array(
  'rule' => 'notEmpty',
  'message' => 'Please enter a valid friend',
 ),
 );
 

  var $belongsTo = array('User' => array('foreignKey' => 'friend_id'));


  function myFriends($id = null)
  {
$friends_ids = $this->generateList(array('Friend.user_id' => $id), 
array('Friend.friend_id' => 'ASC'), null, '{n}.Friend.friend_id', 
'{n}.Friend.friend_id');
return is_array($friends_ids) ? $friends_ids : array();
  }


  function afterDelete()
  {
  }
}
?>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Reserved words in CakePHP?

2012-09-28 Thread Brad Giessing
I created a function called list() in a controller and it freaked out. I 
guess it doesn't like that, either.

On Wednesday, April 15, 2009 5:22:14 AM UTC-5, John Andersen wrote:
>
> Hi all, 
>
> Is there reserved words in CakePHP, which I can't use when naming my 
> models? 
>
> For example "collection" and "tag". 
>
> Enjoy, 
>John, Latvia

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: how to remove label from username and password

2012-09-28 Thread Ivan Rimac
you can use now placeholder => username, it looks better :-)


2012/9/29 Chris 

> thanks ivnrmc,... it works
> I have also add username and password into the fields
>
> , array('label' => false, 'value' => 'username')
> , array('label' => false, 'value' => 'password')
>
> but password show *
>
> On Friday, September 28, 2012 5:48:51 PM UTC-7, ivnrmc wrote:
>
>> After name of the input...
>>
>> Html->input('username', array('label' => false)); ?>
>>
>> sent from my Samsung Galaxy S
>>
>> Ivan Rimac
>> mail: ivn...@gmail.com
>>
>> mob: +385 95 555 9966
>>
>> Dana 29.9.2012. 02:31 "Chris"  je napisao/la:
>>
>>> Hi guys,...
>>> how can I remove label from username and password from the "Form",... to
>>> NOT show up from browser...
>>>
>>> Username Password*
>>>
>>>
>>>  
>>> Form->input('username')**; ?>
>>> 
>>>
>>> 
>>> Form->input('password')**; ?>
>>>  
>>>
>>> thanks
>>>
>>>  --
>>> Like Us on FacekBook 
>>> https://www.facebook.com/**CakePHP
>>> Find us on Twitter http://twitter.com/CakePHP
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "CakePHP" group.
>>> To post to this group, send email to cake...@googlegroups.com.
>>> To unsubscribe from this group, send email to cake-php+u...@**
>>> googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/cake-php?hl=en
>>> .
>>>
>>>
>>>
>>  --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>



-- 
*Ivan Rimac***
mail: ivn...@gmail.com
*tel: +385 95 555 99 66*
*http://ivanrimac.com*

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: how to remove label from username and password

2012-09-28 Thread Chris
thanks ivnrmc,... it works  
I have also add username and password into the fields 

, array('label' => false, 'value' => 'username') 
, array('label' => false, 'value' => 'password')  

but password show * 

On Friday, September 28, 2012 5:48:51 PM UTC-7, ivnrmc wrote:
>
> After name of the input...
>
> Html->input('username', array('label' => false)); ?>
>
> sent from my Samsung Galaxy S
>
> Ivan Rimac
> mail: ivn...@gmail.com 
> mob: +385 95 555 9966
> Dana 29.9.2012. 02:31 "Chris" > je 
> napisao/la:
>
>> Hi guys,... 
>> how can I remove label from username and password from the "Form",... to 
>> NOT show up from browser... 
>>
>> Username Password* 
>>
>>
>>  
>> Form->input('username'); ?>
>> 
>>
>> 
>> Form->input('password'); ?>
>>  
>>
>> thanks 
>>
>>  -- 
>> Like Us on FacekBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To post to this group, send email to cake...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> cake-php+u...@googlegroups.com .
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>  
>>  
>>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: how to remove label from username and password

2012-09-28 Thread Ivan Rimac
After name of the input...

Html->input('username', array('label' => false)); ?>

sent from my Samsung Galaxy S

Ivan Rimac
mail: ivn...@gmail.com
mob: +385 95 555 9966
Dana 29.9.2012. 02:31 "Chris"  je napisao/la:

> Hi guys,...
> how can I remove label from username and password from the "Form",... to
> NOT show up from browser...
>
> Username Password*
>
>
> 
> Form->input('username'); ?>
> 
>
> 
> Form->input('password'); ?>
> 
>
> thanks
>
>  --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: how to remove label from username and password

2012-09-28 Thread bujanga
echo $this->Form->label('username', 'Create your own label using this
if you wish');
echo $this->Form->input('username', array( 'type' => 'text', 'label' =>false));

On Fri, Sep 28, 2012 at 7:31 PM, Chris  wrote:
> Hi guys,...
> how can I remove label from username and password from the "Form",... to NOT
> show up from browser...
>
> Username Password*
>
>
> 
> Form->input('username'); ?>
> 
>
> 
> Form->input('password'); ?>
> 
>
> thanks
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




how to remove label from username and password

2012-09-28 Thread Chris
Hi guys,... 
how can I remove label from username and password from the "Form",... to 
NOT show up from browser... 

Username Password* 



Form->input('username'); ?>



Form->input('password'); ?>


thanks 

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Html link not changing url location

2012-09-28 Thread arron
Sorry for the ignorance, what do you mean?

On Friday, September 28, 2012 12:38:52 PM UTC-7, Léo Willian Kölln wrote:
>
> Why not use Routing Array on the Html::link() ?
> http://book.cakephp.org/2.0/en/appendices/glossary.html#term-routing-array
>
> http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::link
>
> Léo Willian Kölln
>
>
> On Tue, Sep 25, 2012 at 2:28 PM, arron >wrote:
>
>> I have configured routes.php so i can have pretty urls 
>>
>> it works when i do this 
>> > echo $examples['somemodel']['slug'];>?>
>>
>> but I am trying to use cakes way for generating links  
>>
>> $this->Html->link($examples['model']['somename'], '/controllername/slug/' 
>> + $examples['model']['slug']);
>>
>> when I use  $this->Html-> link the url location doesn't change.  
>>
>>
>>
>> The url name is different 
>> but the hyper link doesnt change and is stuck on the first result 
>>
>>
>> example1  
>> example2  
>> example3  
>> example4  
>>
>>
>> instead of 
>>
>> example1  
>> example2  
>> example3  
>>
>>
>>
>> //router.php
>> Router::connect(
>>
>> "/example/:slug",
>> array('controller' => 'somecontrollername', 'action' => 'view'),
>>array( 
>> 
>> 'name'=>'[-A-Z0-9]+', 
>>
>>'pass' => array('slug')
>>
>>
>>
>>   ) 
>>
>> );
>>  Router::connectNamed(
>> array('/example/' => array('action' => 'view', 'controller' => 
>> 'somecontrollername')),
>> array('default' => true, 'greedy' => true)
>> ); 
>>
>>
>>
>> //'view.ctp
>>
>> > foreach ($example as $examples): ?>
>>
>> > $this->Html->link($examples['model']['somename'], '/controllername/slug/' 
>> + $examples['model']['slug']);
>> ?>
>>
>> result 
>>
>> example1  
>> example2  
>> example3  
>> example4  
>>
>>
>> instead of 
>>
>> example1  
>> example2  
>> example3  
>>
>>
>>
>>
>> any help would be great 
>>
>> -- 
>> Like Us on FacekBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To post to this group, send email to cake...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> cake-php+u...@googlegroups.com .
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>  
>>  
>>
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Html link not changing url location

2012-09-28 Thread Léo Willian Kölln
Remember, you don´t need to use Router::url(array()). Pass only the array().

Léo Willian Kölln


On Fri, Sep 28, 2012 at 5:37 PM, arron  wrote:

>
> I just tried this, with a little work I think i can get this to work.
> Thanks
> Html->link($datas['Model']['filed'],
> Router::url(array('controller' => 'controller', 'action' => 'view', 5)))?>
>
>
> On Friday, September 28, 2012 12:38:52 PM UTC-7, Léo Willian Kölln wrote:
>
>> Why not use Routing Array on the Html::link() ?
>> http://book.cakephp.org/2.0/**en/appendices/glossary.html#**
>> term-routing-array
>> http://book.cakephp.org/2.0/**en/core-libraries/helpers/**
>> html.html#HtmlHelper::link
>>
>> Léo Willian Kölln
>>
>>
>> On Tue, Sep 25, 2012 at 2:28 PM, arron  wrote:
>>
>>>  I have configured routes.php so i can have pretty urls
>>>
>>> it works when i do this
>>> >> echo $examples['somemodel']['**slug'];>?>
>>>
>>> but I am trying to use cakes way for generating links
>>>
>>> $this->Html->link($examples['**model']['somename'],
>>> '/controllername/slug/' + $examples['model']['slug']);
>>>
>>> when I use  $this->Html-> link the url location doesn't change.
>>>
>>>
>>>
>>> The url name is different
>>> but the hyper link doesnt change and is stuck on the first result
>>>
>>>
>>> example1 
>>> example2 
>>> example3 
>>> example4 
>>>
>>>
>>> instead of
>>>
>>> example1 
>>> example2 
>>> example3 
>>>
>>>
>>>
>>> //router.php
>>> Router::connect(
>>>
>>> "/example/:slug",
>>> array('controller' => 'somecontrollername', 'action' => 'view'),
>>>array(
>>>
>>> 'name'=>'[-A-Z0-9]+',
>>>
>>>'pass' => array('slug')
>>>
>>>
>>>
>>>   )
>>>
>>> );
>>>  Router::connectNamed(
>>> array('/example/' => array('action' => 'view', 'controller' =>
>>> 'somecontrollername')),
>>> array('default' => true, 'greedy' => true)
>>> );
>>>
>>>
>>>
>>> //'view.ctp
>>>
>>> >> foreach ($example as $examples): ?>
>>>
>>> >> $this->Html->link($examples['**model']['somename'],
>>> '/controllername/slug/' + $examples['model']['slug']);
>>> ?>
>>>
>>> result
>>>
>>> example1 
>>> example2 
>>> example3 
>>> example4 
>>>
>>>
>>> instead of
>>>
>>> example1 
>>> example2 
>>> example3 
>>>
>>>
>>>
>>>
>>> any help would be great
>>>
>>> --
>>> Like Us on FacekBook 
>>> https://www.facebook.com/**CakePHP
>>> Find us on Twitter http://twitter.com/CakePHP
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "CakePHP" group.
>>> To post to this group, send email to cake...@googlegroups.com.
>>> To unsubscribe from this group, send email to cake-php+u...@**
>>> googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/cake-php?hl=en
>>> .
>>>
>>>
>>>
>>
>>  --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Html link not changing url location

2012-09-28 Thread arron

I just tried this, with a little work I think i can get this to work. 
Thanks 
Html->link($datas['Model']['filed'], 
Router::url(array('controller' => 'controller', 'action' => 'view', 5)))?>

On Friday, September 28, 2012 12:38:52 PM UTC-7, Léo Willian Kölln wrote:
>
> Why not use Routing Array on the Html::link() ?
> http://book.cakephp.org/2.0/en/appendices/glossary.html#term-routing-array
>
> http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::link
>
> Léo Willian Kölln
>
>
> On Tue, Sep 25, 2012 at 2:28 PM, arron >wrote:
>
>> I have configured routes.php so i can have pretty urls 
>>
>> it works when i do this 
>> > echo $examples['somemodel']['slug'];>?>
>>
>> but I am trying to use cakes way for generating links  
>>
>> $this->Html->link($examples['model']['somename'], '/controllername/slug/' 
>> + $examples['model']['slug']);
>>
>> when I use  $this->Html-> link the url location doesn't change.  
>>
>>
>>
>> The url name is different 
>> but the hyper link doesnt change and is stuck on the first result 
>>
>>
>> example1  
>> example2  
>> example3  
>> example4  
>>
>>
>> instead of 
>>
>> example1  
>> example2  
>> example3  
>>
>>
>>
>> //router.php
>> Router::connect(
>>
>> "/example/:slug",
>> array('controller' => 'somecontrollername', 'action' => 'view'),
>>array( 
>> 
>> 'name'=>'[-A-Z0-9]+', 
>>
>>'pass' => array('slug')
>>
>>
>>
>>   ) 
>>
>> );
>>  Router::connectNamed(
>> array('/example/' => array('action' => 'view', 'controller' => 
>> 'somecontrollername')),
>> array('default' => true, 'greedy' => true)
>> ); 
>>
>>
>>
>> //'view.ctp
>>
>> > foreach ($example as $examples): ?>
>>
>> > $this->Html->link($examples['model']['somename'], '/controllername/slug/' 
>> + $examples['model']['slug']);
>> ?>
>>
>> result 
>>
>> example1  
>> example2  
>> example3  
>> example4  
>>
>>
>> instead of 
>>
>> example1  
>> example2  
>> example3  
>>
>>
>>
>>
>> any help would be great 
>>
>> -- 
>> Like Us on FacekBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To post to this group, send email to cake...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> cake-php+u...@googlegroups.com .
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>  
>>  
>>
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Need help with a find on related HABTM relationship

2012-09-28 Thread lowpass
You don't really need to add a constraint if your code if you specify
the User.id as a condition and run your query on the User model.

In Project model:

public function fetchAll($user_id = null)
{
if (!empty($user_id))
{
return $this->User->find(
'all',
array(
'conditions' => array(
'User.id' => $user_id
),
'contain' => array(
'Project' => array(
'Site'
)
)
)
)
}
else
{
// get all projects
}
}

In ProjectsController, just pass $this->Auth->user('id'). The else
block above would be used for an admin action, or a view that listed
all project names for whatever reason.

On Fri, Sep 28, 2012 at 2:10 PM, Clark Ritchie  wrote:
> I'm looking for some guidance here.
>
> I have:
>
> User hasAndBelongsToMany Project
>
> Schema:
> Users.id
> Users.name
> ...
>
> Project hasAndBelongsToMany User
>
> Schema:
> Project.id
> Project.name
> ...
>
> My join table:
>
> projects_users.user_id
> projects_users.project_id
>
> Site belongsTo Project
>
> Site.id
> Site.project_id
> ...
>
>
> Users-Projects works OK, I can assign a user to one or many projects.
> Sites-Projects works OK, I can assign a Site to a Project.
>
> Now, I want to make sure the user can only find sites that match the
> projects to which they are assigned.  I assume I need to put a condition
> into the Site's beforeFind function, but I can't figure it out.
>
> Any guidance here?
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Splash page before Authentication

2012-09-28 Thread lowpass
I was going to suggest you make the splash page a static html file,
but you'd need to set the splash page as the DirectoryIndex, which
would interfere with webroot/index.php.

You could set the loginRedirect to point to PagesController, action =>
splash (don't forget to allow() this action). But then whenever a
sesion timed out, the user would get the splash page instead of the
login.

On Wed, Sep 26, 2012 at 11:54 AM, Dario Espina  wrote:
> Hi everyone,
>
> I wrote a nice app, but it's quite boring when you get an login page first,
> so we design a nice splash screen to be show before the login page.
> It has two links: Subscribe and Log In
>
> Our main page it's rendered on the home.ctp
>
> how can I show: Splash -> login -> home?
>
> thanks!
>
> BTW I'm using cakephp 2.0
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Need help with a find on related HABTM relationship

2012-09-28 Thread Clark Ritchie
I'm looking for some guidance here.  

I have:

User hasAndBelongsToMany Project

Schema:
Users.id
Users.name
...

Project hasAndBelongsToMany User

Schema:
Project.id
Project.name
...

My join table:

projects_users.user_id
projects_users.project_id

Site belongsTo Project

Site.id
Site.project_id
...


Users-Projects works OK, I can assign a user to one or many projects.
Sites-Projects works OK, I can assign a Site to a Project.

Now, I want to make sure the user can only find sites that match the 
projects to which they are assigned.  I assume I need to put a condition 
into the Site's beforeFind function, but I can't figure it out.

Any guidance here?

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Is it possible to translate cakephp autogenerated datetime field?

2012-09-28 Thread Felipe Zavan
I'm almost sure you can do it like that:

Put App::import('Core', 'l10n'); in AppController
and your po file sould be like that:

msgid  "January"
msgstr "Janeiro"

msgid  "February"
msgstr "Fevereiro"

msgid  "March"
msgstr "Março"

msgid  "April"
msgstr "Abril"

msgid  "May"
msgstr "Maio"

etc... (that's branzilian portuguese by the way)

More info: 
http://book.cakephp.org/2.0/en/core-libraries/internationalization-and-localization.html
if you're brazilian:
http://blog.thiagobelem.net/traduzindo-o-nome-dos-meses-no-cakephp/

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Is it possible to translate cakephp autogenerated datetime field?

2012-09-28 Thread Manuel Vilanova
CakePhp autogenerates 3 selects for a datetime input.

Im using .PO files for translations.

Is it possible to translate the months in the select[month] to the other 
languages I have and not show them in english?

Cheers!

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Plugin assets not loading in production server

2012-09-28 Thread Xoubaman
So many hours wasted with this... the development version was 2.1 and the 
uploaded version 2.2.1.

Updating the bootstrap made it. At this point I think I will fully update 
to 2.2.

Thanks chronon.

El viernes, 28 de septiembre de 2012 01:58:36 UTC+2, chronon escribió:
>
> If you are using Cake 2.2.x, do you have this in your bootstrap.php?
>
> Configure::write('Dispatcher.filters', array(
> 'AssetDispatcher',
> 'CacheDispatcher'));
>
> See http://book.cakephp.org/2.0/en/appendices/2-2-migration-guide.htmlfor 
> more info...
>
> On Thursday, September 27, 2012 12:48:05 PM UTC-7, Xoubaman wrote:
>>
>> The app is working with no issue in the development server (Windows), but 
>> not loading the plugin assets in production server (Linux). I get a 
>> "controller not found" error in each one.
>>
>> Some things I have out of a clean app or may be useful to know:
>>
>> - Plugins can be placed in Plugin folder or Modules folder. I have 
>> App::build(array('Plugin' => array(APP.'Modules'.DS))); in bootstrap.
>> - Neither Plugin nor Module folder assets are being loaded (as an 
>> example, I can't access domain.com/debug_kit/css/debug_toolbar.css).
>> - Base webroot assets are loaded correctly.
>> - All app routes, included plugin ones, work fine (but look crappy 
>> without some css in the views).
>>
>> Trying to solve it, I deployed a fresh Cake install, created a test 
>> plugin with just one css file in Plugin/Test/webroot/css and loaded all 
>> plugins in bootstrap. I can see the css content in the url 
>> www.mydomain.com/test/css/file.css. In my app i'm not doing anything 
>> weird, just load assets with the paht or plugin notation, neither working.
>>
>> Any idea of what could be going on?
>>
>>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.