Re: simple question about CakePHP syntax

2010-02-13 Thread Cristian Cassina




And the big difference is that single quote can't work with variables.

For example:

$name = 'Cristian';
$string = 'Hi, my name is $name';

echo $string; will output -> Hi, my name is $name
If you had:

$name = 'Cristian';
$string = "Hi, my name is $name";

the echo $string; output would be -> Hi, my name is Cristian 

WebbedIT ha scritto:

  This is not a CakePHP question, it is a {HP question.

Your two strings are identical, the only difference is your are
surrounding them in double quotes the first time and single the
second, in neither case are the quotes part of the string.

Nice little explanation here:
http://v1.jeroenmulder.com/weblog/2005/04/php_single_and_double_quotes.php

On Feb 12, 3:40 pm, majna  wrote:
  
  
http://hr.php.net/manual/en/language.types.string.php

On Feb 12, 12:50 pm, sebb86  wrote:



  Hello,
  


  i have a question about some signs. Is the use of this   "sample"
always equal to this   'sample'  ?
  


  Thanks!
  

  
  
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
  







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: What's wrong with pagination sorting?

2009-10-20 Thread Cristian Cassina

Thanks Will,
I didn't know this and find it useful, having my troubles, from time to 
time, with pagination.

Cristian

Will Poillion ha scritto:
> Ok, I found the problem everyone.
>
> For anyone also having this problem, it is the default pagination.
>
> var $paginate = array('limit' => 100, 'page' => 1, 'sort' => 'name',
> 'direction' => 'asc');
>
> If you set a default sort and direction in your controller, all of
> your sorting will only work in one direction.
>
> In the case above, the only link it would create in for the field
> 'name' was a 'desc' one. Conversely, for all other fields it would
> only create an 'asc' one.
>
> One I took them out:
>
> var $paginate = array('limit' => 100, 'page' => 1);
>
> All of the sorting links worked fine, in both directions. My
> suggestion is if you want to have a default sort/direction, just pass
> them as arguments from the referring page:
>
> /controller/index/sort:name/direction:asc/
>
> Will


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



Pagination ancd checkboxes

2009-10-20 Thread Cristian Cassina

Hello everyone,
I have a little problem. I paginate results from a query. Every row, in 
the view, has a checkbox so that I can choose multiple rows (actually 
orders), submit them and have a resume with the total hours needed to 
complete them, materials used and quantities and so on.
The problem is, if I try to choose, let's say, three orders on the first 
page, and two from the second page, obviously I have a big problem: the 
three form the first page are discarded, and only the two from the 
second page can be found in the $this->data array.
How can I provide temporary storage for all the orders I check on 
different pages? I think caching is the answer, but I can't figure out 
how to make it work in this specific case.
Thanks

Cristian

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



Validation with bindModel on the fly

2009-10-05 Thread Cristian Cassina

Hi everyone,

this one is puzzling me. In my app, validation works like a charm for 
every model I have, except one. In that one, validation works but, 
here the rules:

var $validate = array(
'name' => array(
  'rule' => 'alphaNumeric',
  'required' => true,
  'message' => 'Il campo codice GP deve essere 
alfanumerico',
  'allowEmpty' => false
),
'customer_name' => array(
  'rule' => 'alphaNumeric',
  'required' => true,
  'message' => 'Il campo codice cliente deve essere 
alfanumerico',
  'allowEmpty' => false
),
'grammatura' => array(
  'rule' => 'numeric',
  'message' => 'la grammatura deve essere un numero intero',
  'allowEmpty' => false
)
);

As I was telling you, validation works. In fact, if I leave any of those 
three fields empty, data aren't saved in the database. The problem is 
the message that doesn't show! Even worse, I get the flash message from 
the controller that everything has been saved correctly (when is not)! 
Here is the controller add action as backed via console and modified:

function add() {
if (!empty($this->data)) {
$this->Distint->create();

$this->Distint->bindModel(array('hasMany'=>array('DistintsMaterial','DistintsOperation','DistintsMachine','DistintsExtop')));
$this->Distint->save($this->data);
  
$this->Session->setFlash(__('La distinta base è stata 
salvata', true));
$this->redirect(array('action'=>'index'));
}

The thing is I had to bind those models to this one on the fly, because 
in the habtm tables I have extra fields to save data within. I suspect 
this binding being the reason of my troubles. No matter what you do with 
the aforementioned validation rules, the only message you'll get is the 
one in the setFlash.

Have you any idea about how to fix this?
Thank you.

Cristian

--~--~-~--~~~---~--~~
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: Install CakePHP in sub folder ? ? ? How can I ? ? ?

2009-10-03 Thread Cristian Cassina

Hello,

probably i didn't get it right, but if you put your CSS files in the 
webroot/css directory you shouldn't have any problem. I did the very 
same thing, putting my app in a subfolder, the tuning the routes for the 
homepage accordingly and everything works (as it should). Does your 
default.ctp call the CSS the proper way?


DatacenterHellas ha scritto:
> Hello all.
>
> I have install the CakePHP in a sub folder in my web hosting package
>
> (in example http://www.mydomainname.ext/subfoldername/)
>
> The Cake is running very cool but I have problem with CSS and propably
> with other files (such as javascripts and images) tha I have not yet
> try.
>
> From the source code inside the Firefox I see this code for the CSS
>
> 
>
> But my page is not styled
>
> What Can I do for ? ? ?
>
> Kind regards
> >
>   


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



Validator message not showing

2009-10-02 Thread Cristian Cassina

Hi everyone,
I'm dealing  with a little problem that I can't simply get rid of.
I have these validation rules in the required model:

 var $validate = array(
'name' => array(
'rule' => 'notEmpty',
'message' => 'Il campo codice non può essere 
lasciato vuoto'
),
'customer_name' => array(
  'rule' => 'notEmpty',
  'message' => 'Il codice cliente non può essere vuoto'
),
'grammatura' => array(
  'rule' => array('notEmpty', 'numeric'),
  'message' => 'la scheda deve avere una grammatura'
)
);

I probably didn't get the thing right, but if I try to submit the view 
with any of these fields empty, it flashes me "Object has been saved 
correctly", while it didn't save anything.
What am I doing wrong? Is the setFlash method totally independent from 
the error message in the validator?
Thank you

Cristian

--~--~-~--~~~---~--~~
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: Find Value in $this->data

2009-09-25 Thread Cristian Cassina

Did you try to cycle it with a foreach and search within? Never used the 
in_array function. I'll take a look at it.

foreach($this->data['Ingredient'] as $ingredient):
if($ingredient == $ingredient_chosen) {
   echo "found!";
}
   else
{
   echo "not found!";
}
endforeach;
   


Luke ha scritto:
> Hi Guys,
>
> I am trying to find out if a Value in the $this->data Array excists.
> Here the structure of the Array:
>
> Array
> (
> [Recipe] => Array
> (
> [recipe_name] =>
> )
>
> [Ingredient] => Array
> (
> [1] => Array
> (
> [ingredientname] => Milk
>
> )
>
> [0] => Array
> (
> [ingredientname] => Water
>
> )
>
> )
> }
>
> I now wanted to use:
>
> if (!in_array($value['In']['ingredientname'],$this->data
> ['Ingredient']) )
>
> So, if it is not in the array I wanted to give a message out. This
> does not work for some reason, did I missunderstand the in_array
> function? Any idea to achieve it otherwise?
>
> >
>   


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



Integrating CakePHP with Adobe Flex

2009-09-25 Thread Cristian Cassina

Hello everyone,

yesterday I had a look at Flex. Pretty impressive for making RIAs. Then 
I saw it's possible to interface Flex to PHP. My imagination went even 
further, wondering if it's possible to interface it with Cake. It seems 
that, for Cake 1.1, this was reality thanks to AmfCakePHP, but this 
brilliant piece of software, for what I understood, doesn't work as 
expected in Cake 1.2. So I found another software called cpAmf, which 
seems to do all AmfCakePHP did: 
http://bakery.cakephp.org/articles/view/flex-remoting-with-cakephp-cpamf-plugin-1

Considering I know nothing about Flex, which is the way to follow to 
start making things with Cake and Flex? Do any of you guys use these two 
technologies together? Any good tutorial or manual, or even website to 
refer to?
Thank you

Cristian

--~--~-~--~~~---~--~~
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: Trouble with installation

2009-09-24 Thread Cristian Cassina

Nigel,

could it be a permission related issue? Did you check file and folders 
permissions of this new Cake installation?
Regards

Cristian

Nigel ha scritto:
> I use Ubuntu 9.04 and I installed apache, mysql, and php5.  I did the
> blog tutorial successfully with everything working.  After that I
> deleted the folder cake and installed it again for the next tutorial.
> I cleared the database.  Now, the Cake page is not displaying properly
> as though there is some trouble with apache mod_rewrite, but I checked
> it out and its fine.  What am I missing here?
>
> >
>   


--~--~-~--~~~---~--~~
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: Choose which database to usa, on the fly

2009-09-24 Thread Cristian Cassina

Thank you and thank to WebbedIT fro your kid replies and suggestions. 
I'm going to read the article you posted and I'll decide which path to 
follow.

Cristian

Jorge Horacio Cué Cantú ha scritto:
> Hello,
>
> One approach I take with an application is: Each different "customer" 
> (I am developping a SaaS site) o "company" in Your case, can have an 
> specific domain (  www.company1.com , 
> www.company2.com , ...)   then based on 
> domain the application can select an specific database.
>
> Check following artile in the backery;
>
> 
> http://bakery.cakephp.org/articles/view/one-core-one-app-multiple-domains
>
> That way you can select even more things, such as: "themes", 
> "database", "AC/ACO", modules..."
>
> I hope this can help You. Regards.
>
>
> 2009/9/23 WebbedIT mailto:p...@webbedit.co.uk>>
>
>
> Your query is off topic so really needs it's own topic.
>
> I'm sure you could probably do this, but not sure if it is the right
> way to go.
>
> Why would you separate different companies into different databases?
> I would imagine each database would have duplicate tables/models etc.
> so simply having a company_id foreignKey within each model would allow
> you to pull the relevant data without having to maintain multiple
> databases and their connections.
>
> I have done this with a centrally hosted CMS which drives around 20
> completely different websites from one database, and I am currently
> working on a portal/community website for the third sector where any
> number of non-profit organisations can manage their own sub-sites.
>
> Paul.
>
>
>
> >


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



Choose which database to usa, on the fly

2009-09-23 Thread Cristian Cassina

Hello everyone, my first post here.
I'm planning a new application, which will have per-user databases 
(users are companies). In the actual incarnation of the project ("pure" 
PHP), at the login the user inserts his username, password and name of 
the company (which turns out to be part of the name of the database the 
application will connect to to gather data). I wish I could do the very 
same thing in CakePHP, so decide which db to connect to at login time. 
How can I achieve this?
Thank you.

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