Re: joining strings in model

2011-09-10 Thread void
You can use beforeFind Model's callback otherwise Model constructor. I
prefer beforeFind method.

class AppModel extends Model {
[...]
public function __construct($id = false, $table = null, $ds =
null) {
  // Set here virtualFields ($this->virtualFields = X)
$this->virtualFields = array(
  'name' => 'LEFT('. $this->name .'_'.description,
40)'
);
parent::__construct($id, $table, $ds);
}
public function beforeFind($queryData) {
  // Set here virtualFields ($this->virtualFields = X)
}
}

On 10 Set, 11:02, the plumpNation  wrote:
> Apologies in advance if this sounds stupid, but have you tried setting
> this property in the "constructor" or it's cake equivalent?
>
> On Sep 9, 4:28 pm, lyba  wrote:
>
>
>
>
>
>
>
> > Any suggestions why it is not possible to join strings in a model
> > file:
>
> >         $foo = 'A'.'B';
>
> > this produces error:
> > Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION
> > in .\app\models\event.php on line 7
>
> > A real life scenario:
> > I have a model Event that has a self reference and is called under
> > different aliases (Event, PreviousEvent, NextEvent).
> > I need a virtual name for that model as an extract from the event
> > description
>
> > this works:
> > public $virtualFields = array('name' => 'LEFT(description, 40)');
> > but since model is called under different aliases in one request I get
> > warning:
> > Column 'description' in field list is ambiguous
>
> > I thought this would work:
> > public $virtualFields = array('name' => 'LEFT('. $this->name 
> > .'.description, 40)');
>
> > but then I discovered that joining strings in model does not work at
> > all.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Invite Friends

2011-07-11 Thread void
You can try AddThis

On 10 Lug, 22:47, Prabha Vathi  wrote:
> Hi
>
> Is there any plugin available for cakephp invite friends from google and
> other service if possible
>
> Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: get available locales as list for combobox

2010-10-28 Thread void
Hello, I am not aware of a helper/component that does this.
You can create you a list of the files in app / locale via PHP using
the glob() function, but you can not translate it because it is not a
fixed string (and especially the glob occurs in runtime) And "bake
i18n extract" can not generate the. pot.
I solved creandomi a tool bash or php to run in order to build the
pot, and I think they integrate it into bake i18n can be very helpful.


On 27 Ott, 10:50, cwsTrummer  wrote:
> i am trying to make my application multilanguage ready so i have
> created two folders in my app/locale folder name "eng" and "deu" and
> made a default.po file. everything is working fine and gets
> translated!
>
> but now i want to save the language to each user which can login. so i
> have a field "language" in my databasetable where i want to store
> "eng" or "deu"
>
> is it possible to generate a list for my view form because of the
> folders which exist in the app/locale folder?
> its easy to code this by myself.. getting a list of folders by php and
> translate them to the real language names but is there an existing
> solution? for example a component or helper which does this already??
> should be cake core functionality!!

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: get available locales as list for combobox

2010-10-28 Thread void
Hello,
I am not aware of a helper/component that does this.
You can create you a list of the files in app/locale via PHP using the
glob() function, but you can not translate it because it is not a
fixed string (and especially the glob occurs in runtime) And "bake
i18n extract" can not generate the. pot.
I solved creandomi a tool bash or php to run in order to build the
pot, and I think they integrate it into bake i18n can be very helpful.


On 27 Ott, 10:50, cwsTrummer  wrote:
> i am trying to make my application multilanguage ready so i have
> created two folders in my app/locale folder name "eng" and "deu" and
> made a default.po file. everything is working fine and gets
> translated!
>
> but now i want to save the language to each user which can login. so i
> have a field "language" in my databasetable where i want to store
> "eng" or "deu"
>
> is it possible to generate a list for my view form because of the
> folders which exist in the app/locale folder?
> its easy to code this by myself.. getting a list of folders by php and
> translate them to the real language names but is there an existing
> solution? for example a component or helper which does this already??
> should be cake core functionality!!

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