Re: Application Settings stored in the DB and available in plugin models?

2010-06-15 Thread Sam
Variables stored via Configure::write should be accessable anywhere in
your site- if it isn't working then the code isn't being executed.
Figure out why it isn't executing and you'll solve your problem.

Does your plugin AppController extend your site's AppController? Also,
where are you defining the settings? If you are doing it in the
AppController beforeFilter, and are using beforeFilter in your plugin
AppController, make sure that you are calling parent::beforeFilter()
in your plugin's AppController.

regards,
Sam


On Jun 15, 6:09 pm, "#2Will"  wrote:
> Hi,  I have some settings set in the admin area and stored in the db
> that i use throughout the app, and would like to access in a plugin.
>
> I get the settings like this in the app controller:
>
> function _getSettings(){
>                 $this->settings = $this->Setting->find();  #get them
>
>                 #make available in controllers
>                 $this->settings = $this->settings['Setting'];
>
>                 # make available in views
>                 $this->set('settings',$this->settings);
>
>                 #make available in plugins
>                 // ??
>
>         }
>
> But those variables are not availabe in a plugin model.  How can I
> make those settings available everywhere?
>
> Settings writen using configure::write in the core.php file are
> available, but not ones written in appController.  Where can i write
> them out from the DB so they are available in the plugin model?
>
> Or am i going about this the wrong way entirely?
>
> Thanks,
>
> Will.

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: serious problem with cakephp about CakePHP Auth Component & Permissions

2010-06-15 Thread Jeremy Burns | Class Outfit
Have you read the guide?
http://book.cakephp.org/view/1543/Simple-Acl-controlled-Application

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jun 2010, at 05:45, hoss7 wrote:

> i want Users, Groups & Permissions for Groups, for my website
> 
> 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: serious problem with cakephp about CakePHP Auth Component & Permissions

2010-06-15 Thread hoss7
i want Users, Groups & Permissions for Groups, for my website

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: Format Array

2010-06-15 Thread Ed Propsner
My last post was a bit misleading ... The way I should have stated it is
that using array_merge() and unset()
I was able to structure the array the way that I want it in the controller
action for the search results so it's not throwing
an error, but it is still showing in the url as >>
country=Chile&data[Search][region]= . The results page has a custom sort
so when the data is sorted the url changes back to >> country=Chile®ion=
. I had to alter the controller, view, and a few elements
to account for the difference and to keep it from giving an error.

What I would like to do is have $this->params array arrive at the controller
already formatted the way I want instead of me
having to manipulate the array once it get's there.

On Tue, Jun 15, 2010 at 5:47 PM, Ed Propsner  wrote:

> I have a dropdown in one of my searches that is populated via ajax.
>
> When the form submits (GET) my params end up looking something like:
>
> [code]
>
> [minAge] => 31
> [maxAge] => 41
> [country] => Chile
> [data] => Array
> (
> [Search] => Array
> (
> [region] => Libertador General Bernardo O'Higgins
> )
>
> )
>
>
> [/code]
>
> If there a way for me to format the array so it's in sync with the rest of
> the form?
>
> eg.
>
> [minAge] => 31
> [maxAge] => 41
> [country] => Chile
> [data] => Array
> [region] => Libertador General Bernardo O'Higgins
>
>
> Nothing I tried has worked.
>
>
>
>
>

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


Application Settings stored in the DB and available in plugin models?

2010-06-15 Thread #2Will
Hi,  I have some settings set in the admin area and stored in the db
that i use throughout the app, and would like to access in a plugin.

I get the settings like this in the app controller:

function _getSettings(){
$this->settings = $this->Setting->find();  #get them

#make available in controllers
$this->settings = $this->settings['Setting'];

# make available in views
$this->set('settings',$this->settings);

#make available in plugins
// ??

}

But those variables are not availabe in a plugin model.  How can I
make those settings available everywhere?

Settings writen using configure::write in the core.php file are
available, but not ones written in appController.  Where can i write
them out from the DB so they are available in the plugin model?

Or am i going about this the wrong way entirely?

Thanks,

Will.

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


Format Array

2010-06-15 Thread Ed Propsner
I have a dropdown in one of my searches that is populated via ajax.

When the form submits (GET) my params end up looking something like:

[code]

[minAge] => 31
[maxAge] => 41
[country] => Chile
[data] => Array
(
[Search] => Array
(
[region] => Libertador General Bernardo O'Higgins
)

)


[/code]

If there a way for me to format the array so it's in sync with the rest of
the form?

eg.

[minAge] => 31
[maxAge] => 41
[country] => Chile
[data] => Array
[region] => Libertador General Bernardo O'Higgins


Nothing I tried has worked.

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: Automagic Form (Drop down list)

2010-06-15 Thread euromark
and last but not least
if you want to set default values - this is NOT done in the views
many make that mistake

this is actually done in the controller

if (!empty($this->data)) {
...
} else {
 // set default values here
$this->data['Model']['field'] = 'defautlValue';
}

this way after a post and some validation errors the defaults dont
override any chances

otherwise they would always jump back to default - which is really
annoying for users


On 15 Jun., 19:25, calvin  wrote:
> And also, if you have a nonstandard display field that isn't just
> being used for this particular select input, then you will probably
> want to set the $displayField property in your model so cake can
> automagically display that field in find('list') results and in
> tables.
>
> On Jun 15, 8:46 am, euromark  wrote:
>
>
>
> > usually you dont pass the dummy field via controller
> > there is an empty field param for it
>
> > echo $this->Form->input('category_id', array('options'=>$cats,
> > 'empty=>'dummyName');
> > or
> > echo $this->Form->input('category_id', array('options'=>$cats,
> > 'empty=>array('dummyFieldValue'=>'dummyName')));
>
> > On 15 Jun., 17:35, leo  wrote:
>
> > > You might also want to do this if you want to specify which fields to
> > > return:
> > > $this->set('categories', $this->Item->Category-
>
> > > >find('list',array('fields'=>array('id','other_name'));
>
> > > If you need to add a dummy field, try:
> > > $categories = array(0=>'unassigned') + 
> > > $this->Item->Category->find('list',array('fields'=>array('id','other_name')
> > >  );
>
> > > $this->set('categories', $categories);
>
> > > And in the view, if your categories aren't appearing (because the
> > > naming is different) try:
> > > echo $this->Form->input('category_id',array('options'=>$cats));

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: SessionHandler error message

2010-06-15 Thread AKim
Weird, not sure how my code got messed up, but you're right.
Reimported that file and everything's working.

Thanks for looking at this!

~A

On Jun 15, 11:05 am, John Andersen  wrote:
> Are you sure you haven't mixed up your versions?
>
> My own 1.3.2 version and the API clearly states that the code in 1.3.2
> at your specified correction point, look like this:
> [code]
> 215     /**
> 216     * Determine if Session has been started.
> 217     *
> 218     * @access public
> 219     * @return boolean True if session has been started.
> 220     */
> 221     function started() {
> 222     if (isset($_SESSION) && session_id()) {
> 223     return true;
> 224     }
> 225     return false;
> 226     }
> [/code]
>
> No mention of $_started!
> Please clarify your issue!
> Enjoy,
>    John
>
> On Jun 15, 12:44 am, AKim  wrote:
>
>
>
> > Is anyone else getting the following error after upgrading to 1.3.2?
>
> > Notice (8): Undefined property: SessionHelper::$_started [CORE\cake
> > \libs\cake_session.php, line 222]
>
> > It looks like the default $_started variable was removed between 1.3.0
> > and 1.3.2.
>
> > I'd recommend the following modification for line 222 of \lib
> > \cake_session.php:
>
> > from:
> > if (isset($_SESSION) && $this->_started) {
>
> > to:
> > if (isset($_SESSION) && isset($this->_started) && $this->_started){
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -

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: Access controller from model

2010-06-15 Thread cricket
On Jun 15, 1:41 pm, Ragnis  wrote:
> Can i access controller from model?
> I need it to get controllers $params variable.

Pass it to the model from the controller.

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: i was defined one global variable in core.php how can i use that variable in my app controller

2010-06-15 Thread cricket
On Jun 15, 8:11 am, Narendra Padala  wrote:
> Hi all I am new to cake php,
>
> I am created some themes like red, green blue etc.
>
> i have to use these themes in my appliaction.
>
> so i defined in my app controller like this
>
>     var $view = 'Theme';
>     var $theme = 'black'; // here i need global value.
>
> this value i have to set in the core .php
>
> like this i wrote
>
>         define('', 'blue');
>
> now i need use the '' value to
>
>     var $theme = $''  // here how can i use.
>
> Please any one can help me out to solove this problem

I would use bootstrap.php, not core.php. And, instead of define(), I'd
do:

Configure::write('xxx', 'blue');

In AppController, use Configure::read('xxx') to get the value.

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: model-view - related data; choos fields to be displays?

2010-06-15 Thread calvin
Sorry, I misunderstood your question. I hope I didn't offend you. That
wasn't my intention.

And the Cookbook section called "Developing with CakePHP" actually
does sorta break everything down into where each function is called
from/when you'd use it. With the API documentation, you have to look
at which class it belongs to. Since find is a Model function:
http://api13.cakephp.org/class/model#method-Modelfind

--that means it needs to be called from a Model object. And since you
have access to a model object inside of the model ($this->find()) and
inside of controllers ($this->MyModel->find()), you can use it in
either model or controller.

But I generally find the Cookbook more informative and easier to use
than the API documentation.

On Jun 15, 2:54 am, mivogt-LU  wrote:
> @calvin:
> Thanks I am not that new to php, I know what an array and and array
> index is
> I can not du as you suppose as the data I need is not passed to the
> $booking array.
> $booking only contains the foreignkey in the field mealclassid
> the field melclassKennung is not available.
> I doublechecked this once by hardcoding it in and getting errors for
> non available array index
> once did the debug ($booking) to see what is contained.
>
> This is why I asked for hot to do within cake.
> I might do myselfe some php sql syntax and get my data from the db
> directly
> but this is no good style i was told.
>
> My tryout using cakes find() also did not hit when I tired it inside
> the view code
> somhow I think it was the wrong place and might work if i do the
> find() inside the controller
>
> ** might be a guess for the cake book: add in the api where to call
> wich command **
>
> cu
>
> michael
>
> On 15 Jun., 02:51, calvin  wrote:
>
> > When you baked your models did you set the displayField property when
> > cake bake asks you to? "requestName" and "mealclassKennung" are not
> > standard display field names. Cake only knows to look for fields
> > called "name" or "title" to use as display fields by default. If you
> > want to display any other field, you need to tell cake which field to
> > use.
>
> > If you don't want to use cake bake to generate your views for you,
> > then just edit the code manually. Replace $booking['mealclass_id']
> > with $booking['mealclassKennung']. That's just basic PHP. If you can't
> > understand what your code says, then I'd recommend getting a PHP book
> > and skimming through it--particularly read the chapters about how
> > arrays and associative arrays work. You're going to need to know that
> > stuff to work with cake.
>
> > On Jun 14, 11:26 am, mivogt-LU  wrote:
>
> > > HI there,
>
> > > if I choos in the index view the view button I get all my models data
> > > and also the related models are shown somehow.
>
> > > i.e. if I choos from customer-index: view I get the customer details.
> > > I also get the orders he placed in some manner.
> > > Sadly instead of an item name I am only shown the indexnumbers.
>
> > > i.e.:
>
> > > Related Bookings
> > > Id      Name    Customer Id     Mealclass Id    Request Id
>
> > > I would like to show up other fields instead of the id.
> > > instead of requestID I prefer showing requestName
> > > instead of mealclassID I prefer showing mealclassKennung
>
> > > Might you please tell me how to change my code from
> > >                         
> > >                         
> > >                         
> > >                         
> > >                         
>
> > > to something doing as I want?
> > > I know I ll need to use the indexes to show up the fitting item out of
> > > the database.
> > > But still not that fit in cake to get the solution on my own.
>
> > > Thanks in advance..
>
> > > Michael

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

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


Re: Problem with counting records

2010-06-15 Thread cricket
On Jun 15, 2:41 am, Kiza  wrote:
>
> Here I have I problem, because  I got error when I try to display
> data. I apologize if this is blunder question but I'm new in Cake and
> struggling to cope with this.
> What argument I have to supply to view to correctly display data.

You've set a view variable, $locations, but your loop is:

foreach($rows as $row):

And you're trying to access an undefined loop variable, $location.

Change to:

foreach($locations as $location):

Personally, I've started always using the variable $data and doing
foreach($data as $d) so I avoid this mistake. Of course, now I need to
keep$data and $this->data separate in my head.

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: Need help in url rewriting in cake php code.

2010-06-15 Thread cricket
On Jun 15, 2:31 am, mirza ameer  wrote:
> Hi,
>
> i did not understand can you please tel me how to do this iam wating
> for your reply

Mirza, a "slug" is a part of a URL that denotes the name of some item,
person, title of article, etc. The spaces are translated to a hyphen
or underscore, punctuation is generally removed, "special" characters
are translated to ASCII, and the entire string is usually shifted to
all lowercase. So, if we had a members page for Mirza Ameer the URL
might look like:

/members/mirza-ameer

In your case, the names of the products can be used for slugs. The
database table will require an extra column for the slug.

To have Cake create the slugs automatically, download
SluggableBehavior from here:
http://cake-syrup.sourceforge.net/ingredients/sluggable-behavior/

See the tutorial for more info:
http://bakery.cakephp.org/articles/view/slug-behavior

in routes.php:

Router::connect(
'/products',
array('controller' => 'products', 'action' => 'index')
);

/* If you have other (non-admin) methods/actions in
ProductsController, you should
 * list them before this next route. Otherwise, the name of your
action
 * will be mistaken for a slug.
 */
Router::connect(
'/products/:slug',
array('controller' => 'products', 'action' => 'view'),
array('slug' => '[-a-z]+', 'pass' => array('slug'))
);

The regular expression will match on an lowercase word consisting of
hyphens and letters only. If your product names might include numbers,
you should change the regexp to:
[-a-z0-9]+

Note the "pass" part. This tells Cake that you expect the slug to be
passed as a parameter to your method.

in product.php (model):

var $actsAs = array(
'Sluggable' => array(
'translation' => 'utf-8',
'separator' => '-',
'label' => array('name'),
'length' => 64,
'overwrite' => true
)
);

in products_controller.php:

public function view($slug = null)
{
if (empty($slug))
{
$this->redirect(array('action' => 'index'));
}

$data = $this->Product->find(
'first',
array(
'conditions' => array(
'Product.slug' => $slug
)
)
);

$this->set(compact('data'));
}


To create a link to a particular product:

echo $html->link(
$d['Product']['name'],
array(
'controller' => 'products',
'action' => 'view',
'slug' => $d['Product']['slug']
),
array('title' => 'click to see this product')
);

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: 1.3 $scripts_for_layout not working

2010-06-15 Thread calvin
It depends on where you try to use the $scripts_for_layout to include
a script from. You can't use it from the layout or elements included
from the layout (because $scripts_for_layout has already been printed
out). So in those cases, your best bet is just to hard code it into
the document head.

On Jun 15, 1:45 am, Ragnis  wrote:
> In my header i have 
>
> But when i try to use this, then the script tag doesn't appear in the
> header:
> Html->script('general', array('inline' => false)); ?>

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


Access controller from model

2010-06-15 Thread Ragnis
Can i access controller from model?
I need it to get controllers $params variable.

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: Using query in the model

2010-06-15 Thread calvin
Matt, query() is a model method (as you can see in the cookbook:
http://book.cakephp.org/view/456/query ). So there is no need to
"guess" what the syntax should be.

If you're doing it from the model, then you'd call it using $this-
>query();

If you're doing it from the model, but need to call it from an
associated model, then it would be: $this->AssociatedModel->query();

If you're doing it from a controller, then you would do it like so:
$this->MyModel->query();

The $this 'pseudo-variable' represents the current calling-object:
http://us2.php.net/manual/en/language.oop5.basic.php

And if you are making an update, then query() will not return any
data. If you are trying to check if the query succeeded or not, you
need to do use the 'identical' comparison (=== or !==):

if ($this->query($query) !== false) {
  // success
} else {
  // failed
}

On Jun 15, 9:17 am, Matt Y  wrote:
> So I have searched for this, but the cookbook does not help me with my
> problem.
>
> I have been trying to write functions in my models that use the
> query() function that updates some HABTM tables
>
> i have copied many pieces of code to try and make this happen but have
> had no luck. I have tried
>
> $results = $this->query();
> $results = $this->Model->query();
> $this->query();
> $this->Model->query();
>
> What am I doing wrong, is it just not possible to do this in model
> code, must I put all calls to the query function in the controller?
>
> Thank you for your help,
>
> Matt

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: serious problem with cakephp about CakePHP Auth Component & Permissions

2010-06-15 Thread Jeremy Burns | Class Outfit
Why doesn't the solution you forwarded meet your needs?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com

http://www.classoutfit.com

On 15 Jun 2010, at 18:12, hoss7 wrote:

> hi
> 
> i have serious problem with cakephp about CakePHP Auth Component &
> Permissions
> 
> i am search in the internet and book.cakephp.org and cakeforge.org and
> cakeqs.org
> for find some easy and professional idea(source code) for create
> CakePHP Auth Component - Users, Groups & Permissions but i find noting
> 
> please help me and if you are professional in cakephp send some code
> to my email
> & explain step by step(i am new in cake)
> 
> i want sample code like this:
> http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions
> 
> 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: Automagic Form (Drop down list)

2010-06-15 Thread calvin
And also, if you have a nonstandard display field that isn't just
being used for this particular select input, then you will probably
want to set the $displayField property in your model so cake can
automagically display that field in find('list') results and in
tables.

On Jun 15, 8:46 am, euromark  wrote:
> usually you dont pass the dummy field via controller
> there is an empty field param for it
>
> echo $this->Form->input('category_id', array('options'=>$cats,
> 'empty=>'dummyName');
> or
> echo $this->Form->input('category_id', array('options'=>$cats,
> 'empty=>array('dummyFieldValue'=>'dummyName')));
>
> On 15 Jun., 17:35, leo  wrote:
>
> > You might also want to do this if you want to specify which fields to
> > return:
> > $this->set('categories', $this->Item->Category-
>
> > >find('list',array('fields'=>array('id','other_name'));
>
> > If you need to add a dummy field, try:
> > $categories = array(0=>'unassigned') + 
> > $this->Item->Category->find('list',array('fields'=>array('id','other_name'));
>
> > $this->set('categories', $categories);
>
> > And in the view, if your categories aren't appearing (because the
> > naming is different) try:
> > echo $this->Form->input('category_id',array('options'=>$cats));

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: : reuseable view

2010-06-15 Thread calvin
Yea, I think you'll be hard pressed to find a justification for
merging all the views together. It could become a maintenance
nightmare. Besides, cake bake makes generating views quick and
painless. It literally takes only 2-3 seconds to generate all the
views for a single controller/model.

If you're going to spend time working on views and want to eliminate
duplicate code, I would recommend breaking down repeated view code
into elements. For example, most of my edit and add views share a form
element. The element is usually named something like form.user or
form.rates (allows adding multiple rates at once) and contains
conditional logic for handling the differences between edit and add
actions.

Likewise, another good idea (IMO) I've found is to eliminate the
"actions" list that cake bake generates for each view. These actions
are hardcoded links that can be a pain to update. Some people just
rebake every time they make changes to model associations to update
the actions list, but this isn't really an option if you have
customized views that have been modified after baking. So instead of
that, I just have an element called "actions" that I place inside of
each view, which renders the actions that I specify inside of the
controller like so:

var $actions = array(
array(
'label' => 'Explore {%N}',
'url' => array('action' => 'explore'),
'pass' => true,
'on' => array('view', 'edit')
),
array(
'label' => 'View {%N}',
'url' => array('action' => 'view'),
'pass' => true,
'on' => array('explore', 'edit')
),
array(
'label' => 'Edit {%N}',
'url' => array('action' => 'edit'),
'pass' => true,
'on' => array('view')
),
array(
'label' => 'Delete {%N}',
'url' => array('action' => 'delete'),
'pass' => true,
'on' => array('view', 'edit')
),
array(
'label' => 'List {%Ns}',
'url' => array('action' => 'index')
),
array(
'label' => 'List {%Ns}',
'url' => array('controller' => 'media_files', 'action' => 
'index')
),
array(
'label' => 'New {%Ns}',
'url' => array('controller' => 'media_files', 'action' => 'add')
)
);

You can probably also turn "associated data" tables into elements or
create helpers that help you generate AJAX tables or something. All of
this will help you simply your views and reduce repetitive code.

On Jun 15, 8:44 am, leo  wrote:
> Yes, you can do that by having conditional code in the view and
> setting the template:
> $this->render('crudView');
>
> and a mode in a view variable:
> $this->set('mode','edit');
>
> In general, you be better off following the accepted way, though, as
> things can get terribly comfusing and complicated if you don't. You're
> not saving paper or electricity by combining into one view. Keep it
> simple and keep it clear.
>
> On 15 June, 09:35, Mario Simaremare  wrote:
>
> > dear all,
>
> > i am very new with php and the cake. i used to play with java
> > actually.
> > i would ask you, if there is a way in the cake to create a single view
> > file to view, add, and edit then reuse them.
> > i mean to use the same view with different models. the views
> > automatically detects the table columns and it's header then fill the
> > cell with the thrown models data?
>
> > thank you,
>
> > regards,

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: Custom pagination with plain SQL

2010-06-15 Thread cricket
On Jun 15, 10:17 am, Lucca Mordente  wrote:
> SearchableBehavior seems to be very nice indeed.
>
> I'd have to create a setup to index the existing data and modify it to
> match my needs, that which would spend a lot of time.
> Yes, I'll consider to use this behavior.
>
> However, I have no enough time to swap right now, facing the time
> spent creating my own.
>
> Isn't there a way to use CakePHP paginator to paginate a plain SQL?

I've no experience with that, although i'm sure it's come up before.
Can it be done? Dunno. This page seems to be at least related:

http://book.cakephp.org/view/249/Custom-Query-Pagination

Make sure to check the comments.

There seems to be a few other pages out there. Google "cakephp
paginate custom" and see if anything that comes up helps.

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


serious problem with cakephp about CakePHP Auth Component & Permissions

2010-06-15 Thread hoss7
hi

i have serious problem with cakephp about CakePHP Auth Component &
Permissions

i am search in the internet and book.cakephp.org and cakeforge.org and
cakeqs.org
for find some easy and professional idea(source code) for create
CakePHP Auth Component - Users, Groups & Permissions but i find noting

please help me and if you are professional in cakephp send some code
to my email
& explain step by step(i am new in cake)

i want sample code like this:
http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions

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: links point to wrong folder

2010-06-15 Thread Dr. Loboto
Return core.php to initial state and add "RewriteBase /project1" to /
app/webroot/.htaccess as first line of rewrites block. If won't help,
move this line to /.htaccess, I don't remember clearly where it should
be in which conditions.

On Jun 15, 3:27 pm, NickPick  wrote:
> When I cake bake a project it appears that all the links are pointing
> to a wrong folder.http://localhost/usersinstead 
> ofhttp://localhost/project1/users.
> Also the images are not displayed.
>
> I have added Alloworverride all in httpd.conf and also uncommented in
> core.php configure::write('App.baseURL'env(SCRIPT_NAME));, but of this
> seems to solve my problem.
>
> Any advice is appreciated.

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: Cake wants to describe tables without a table name

2010-06-15 Thread Dr. Loboto
$useTable = '' or $name = '' maybe.

On Jun 15, 5:48 pm, cakeuser  wrote:
> All the actions in my cake-project work perfectly, but the "subscribe"
> action for my newsletter goes crazy.
> After 3 houres i don't know how to fix it.
>
> The error messages:
> --
> Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
> check the manual that corresponds to your MySQL server version for the
> right syntax to use near '' at line 1 [CORE/cake/libs/model/
> datasources/dbo_source.php, line 673]
> Code | Context
>
> $sql    =       "DESCRIBE "
> $error  =       "1064: You have an error in your SQL syntax; check the manual
> that corresponds to your MySQL server version for the right syntax to
> use near '' at line 1"
> $out    =       null
>
> DboSource::showQuery() - CORE/cake/libs/model/datasources/
> dbo_source.php, line 673
> DboSource::execute() - CORE/cake/libs/model/datasources/
> dbo_source.php, line 263
> DboSource::fetchAll() - CORE/cake/libs/model/datasources/
> dbo_source.php, line 407
> DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php,
> line 284
> DboMysqlBase::describe() - CORE/cake/libs/model/datasources/dbo/
> dbo_mysql.php, line 125
> Model::schema() - CORE/cake/libs/model/model.php, line 925
> Model::hasField() - CORE/cake/libs/model/model.php, line 1011
> Model::hasField() - CORE/cake/libs/model/model.php, line 997
> Model::__construct() - CORE/cake/libs/model/model.php, line 477
> ClassRegistry::init() - CORE/cake/libs/class_registry.php, line 149
> AuthComponent::getModel() - CORE/cake/libs/controller/components/
> auth.php, line 821
> AuthComponent::hashPasswords() - CORE/cake/libs/controller/components/
> auth.php, line 926
> AuthComponent::startup() - CORE/cake/libs/controller/components/
> auth.php, line 333
> Component::triggerCallback() - CORE/cake/libs/controller/
> component.php, line 186
> Controller::startupProcess() - CORE/cake/libs/controller/
> controller.php, line 527
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 187
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
>
> Query: DESCRIBE
>
> Warning (2): Invalid argument supplied for foreach() [CORE/cake/libs/
> model/datasources/dbo/dbo_mysql.php, line 127]
> Code | Context
>
>         $cols = $this->query('DESCRIBE ' . $this-
>
> >fullTableName($model));
>
>         foreach ($cols as $column) {
>
> DboMysqlBase::describe() - CORE/cake/libs/model/datasources/dbo/
> dbo_mysql.php, line 127
> Model::schema() - CORE/cake/libs/model/model.php, line 925
> Model::hasField() - CORE/cake/libs/model/model.php, line 1011
> Model::hasField() - CORE/cake/libs/model/model.php, line 997
> Model::__construct() - CORE/cake/libs/model/model.php, line 477
> ClassRegistry::init() - CORE/cake/libs/class_registry.php, line 149
> AuthComponent::getModel() - CORE/cake/libs/controller/components/
> auth.php, line 821
> AuthComponent::hashPasswords() - CORE/cake/libs/controller/components/
> auth.php, line 926
> AuthComponent::startup() - CORE/cake/libs/controller/components/
> auth.php, line 333
> Component::triggerCallback() - CORE/cake/libs/controller/
> component.php, line 186
> Controller::startupProcess() - CORE/cake/libs/controller/
> controller.php, line 527
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 187
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
> [main] - APP/webroot/index.php, line 83
>
> Query: DESCRIBE
>
> Query: DESCRIBE
> --
>
> I don't understand why cake wants to describe some tables without the
> table names.
> I hope someone has an idea.

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: Using query in the model

2010-06-15 Thread John Andersen
In the model you use this:

[code]
$result = $this->query('your long and vinding query statemtent');
[/code]

Enjoy,
   John

On Jun 15, 7:17 pm, Matt Y  wrote:
> So I have searched for this, but the cookbook does not help me with my
> problem.
>
> I have been trying to write functions in my models that use the
> query() function that updates some HABTM tables
>
> i have copied many pieces of code to try and make this happen but have
> had no luck. I have tried
>
> $results = $this->query();
> $results = $this->Model->query();
> $this->query();
> $this->Model->query();
>
> What am I doing wrong, is it just not possible to do this in model
> code, must I put all calls to the query function in the controller?
>
> Thank you for your help,
>
> Matt

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: Cake wants to describe tables without a table name

2010-06-15 Thread John Andersen
Does one of your models not use a table?
It looks like CakePHP can't find out what is the name of your table.
Do you have obsolete models in your model folder?
   John

On Jun 15, 1:48 pm, cakeuser  wrote:
> All the actions in my cake-project work perfectly, but the "subscribe"
> action for my newsletter goes crazy.
> After 3 houres i don't know how to fix it.
>
> The error messages:
> --
> Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
> check the manual that corresponds to your MySQL server version for the
> right syntax to use near '' at line 1 [CORE/cake/libs/model/
> datasources/dbo_source.php, line 673]
> Code | Context
>
> $sql    =       "DESCRIBE "
> $error  =       "1064: You have an error in your SQL syntax; check the manual
> that corresponds to your MySQL server version for the right syntax to
> use near '' at line 1"
> $out    =       null
>
> DboSource::showQuery() - CORE/cake/libs/model/datasources/
> dbo_source.php, line 673
> DboSource::execute() - CORE/cake/libs/model/datasources/
> dbo_source.php, line 263
> DboSource::fetchAll() - CORE/cake/libs/model/datasources/
> dbo_source.php, line 407
> DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php,
> line 284
> DboMysqlBase::describe() - CORE/cake/libs/model/datasources/dbo/
> dbo_mysql.php, line 125
> Model::schema() - CORE/cake/libs/model/model.php, line 925
> Model::hasField() - CORE/cake/libs/model/model.php, line 1011
> Model::hasField() - CORE/cake/libs/model/model.php, line 997
> Model::__construct() - CORE/cake/libs/model/model.php, line 477
> ClassRegistry::init() - CORE/cake/libs/class_registry.php, line 149
> AuthComponent::getModel() - CORE/cake/libs/controller/components/
> auth.php, line 821
> AuthComponent::hashPasswords() - CORE/cake/libs/controller/components/
> auth.php, line 926
> AuthComponent::startup() - CORE/cake/libs/controller/components/
> auth.php, line 333
> Component::triggerCallback() - CORE/cake/libs/controller/
> component.php, line 186
> Controller::startupProcess() - CORE/cake/libs/controller/
> controller.php, line 527
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 187
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
>
> Query: DESCRIBE
>
> Warning (2): Invalid argument supplied for foreach() [CORE/cake/libs/
> model/datasources/dbo/dbo_mysql.php, line 127]
> Code | Context
>
>         $cols = $this->query('DESCRIBE ' . $this-
>
> >fullTableName($model));
>
>         foreach ($cols as $column) {
>
> DboMysqlBase::describe() - CORE/cake/libs/model/datasources/dbo/
> dbo_mysql.php, line 127
> Model::schema() - CORE/cake/libs/model/model.php, line 925
> Model::hasField() - CORE/cake/libs/model/model.php, line 1011
> Model::hasField() - CORE/cake/libs/model/model.php, line 997
> Model::__construct() - CORE/cake/libs/model/model.php, line 477
> ClassRegistry::init() - CORE/cake/libs/class_registry.php, line 149
> AuthComponent::getModel() - CORE/cake/libs/controller/components/
> auth.php, line 821
> AuthComponent::hashPasswords() - CORE/cake/libs/controller/components/
> auth.php, line 926
> AuthComponent::startup() - CORE/cake/libs/controller/components/
> auth.php, line 333
> Component::triggerCallback() - CORE/cake/libs/controller/
> component.php, line 186
> Controller::startupProcess() - CORE/cake/libs/controller/
> controller.php, line 527
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 187
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
> [main] - APP/webroot/index.php, line 83
>
> Query: DESCRIBE
>
> Query: DESCRIBE
> --
>
> I don't understand why cake wants to describe some tables without the
> table names.
> I hope someone has an idea.

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: i was defined one global variable in core.php how can i use that variable in my app controller

2010-06-15 Thread calvin
define() is a PHP function that defines a constant: http://us.php.net/define

So you can simply set $theme to xxx, e.g.:

var $theme = xxx;

On Jun 15, 5:11 am, Narendra Padala  wrote:
> Hi all I am new to cake php,
>
> I am created some themes like red, green blue etc.
>
> i have to use these themes in my appliaction.
>
> so i defined in my app controller like this
>
>     var $view = 'Theme';
>     var $theme = 'black'; // here i need global value.
>
> this value i have to set in the core .php
>
> like this i wrote
>
>         define('', 'blue');
>
> now i need use the '' value to
>
>     var $theme = $''  // here how can i use.
>
> Please any one can help me out to solove this problem

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


Using query in the model

2010-06-15 Thread Matt Y
So I have searched for this, but the cookbook does not help me with my
problem.

I have been trying to write functions in my models that use the
query() function that updates some HABTM tables

i have copied many pieces of code to try and make this happen but have
had no luck. I have tried

$results = $this->query();
$results = $this->Model->query();
$this->query();
$this->Model->query();

What am I doing wrong, is it just not possible to do this in model
code, must I put all calls to the query function in the controller?

Thank you for your help,

Matt

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: Automagic Form (Drop down list)

2010-06-15 Thread euromark
usually you dont pass the dummy field via controller
there is an empty field param for it

echo $this->Form->input('category_id', array('options'=>$cats,
'empty=>'dummyName');
or
echo $this->Form->input('category_id', array('options'=>$cats,
'empty=>array('dummyFieldValue'=>'dummyName')));


On 15 Jun., 17:35, leo  wrote:
> You might also want to do this if you want to specify which fields to
> return:
> $this->set('categories', $this->Item->Category-
>
> >find('list',array('fields'=>array('id','other_name'));
>
> If you need to add a dummy field, try:
> $categories = array(0=>'unassigned') + 
> $this->Item->Category->find('list',array('fields'=>array('id','other_name'));
>
> $this->set('categories', $categories);
>
> And in the view, if your categories aren't appearing (because the
> naming is different) try:
> echo $this->Form->input('category_id',array('options'=>$cats));

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: : reuseable view

2010-06-15 Thread leo
Yes, you can do that by having conditional code in the view and
setting the template:
$this->render('crudView');

and a mode in a view variable:
$this->set('mode','edit');

In general, you be better off following the accepted way, though, as
things can get terribly comfusing and complicated if you don't. You're
not saving paper or electricity by combining into one view. Keep it
simple and keep it clear.

On 15 June, 09:35, Mario Simaremare  wrote:
> dear all,
>
> i am very new with php and the cake. i used to play with java
> actually.
> i would ask you, if there is a way in the cake to create a single view
> file to view, add, and edit then reuse them.
> i mean to use the same view with different models. the views
> automatically detects the table columns and it's header then fill the
> cell with the thrown models data?
>
> thank you,
>
> regards,

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: Automagic Form (Drop down list)

2010-06-15 Thread leo
You might also want to do this if you want to specify which fields to
return:
$this->set('categories', $this->Item->Category-
>find('list',array('fields'=>array('id','other_name'));

If you need to add a dummy field, try:
$categories = array(0=>'unassigned') + $this->Item->Category-
>find('list',array('fields'=>array('id','other_name'));
$this->set('categories', $categories);

And in the view, if your categories aren't appearing (because the
naming is different) try:
echo $this->Form->input('category_id',array('options'=>$cats));

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: Automagic Form (Drop down list)

2010-06-15 Thread leo
You might also want to do this if you want to specify which fields to
return:
$this->set('categories', $this->Item->Category-
>find('list',array('fields'=>array('id','other_name'));

If you need to add a dummy field, try:
$categories = array(0=>'unassigned') + $this->Item->Category-
>find('list',array('fields'=>array('id','other_name'));
$this->set('categories', $categories);

And in the view, if your categories aren't appearing (because the
naming is different) try:
echo $this->Form->input('category_id',array('options'=>$cats));

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 programmer needed

2010-06-15 Thread spheroid
Looking for a CakePHP developer, must have solid CakePHP experience.
Developers residing in United States only please.

We have a website built on CakePHP that needs some modifications as
soon as possible. The site is built on CakePHP 1.2.6.

Please send a resume and samples of at least 3 sites (provide URL's)
you have done in CakePHP. Also please send code samples so we can see
your development style.

Please send all inquiries to:
posting-20100615-bae...@kmscreative.com

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


Re: SessionHandler error message

2010-06-15 Thread John Andersen
Are you sure you haven't mixed up your versions?

My own 1.3.2 version and the API clearly states that the code in 1.3.2
at your specified correction point, look like this:
[code]
215 /**
216 * Determine if Session has been started.
217 *
218 * @access public
219 * @return boolean True if session has been started.
220 */
221 function started() {
222 if (isset($_SESSION) && session_id()) {
223 return true;
224 }
225 return false;
226 }
[/code]

No mention of $_started!
Please clarify your issue!
Enjoy,
   John

On Jun 15, 12:44 am, AKim  wrote:
> Is anyone else getting the following error after upgrading to 1.3.2?
>
> Notice (8): Undefined property: SessionHelper::$_started [CORE\cake
> \libs\cake_session.php, line 222]
>
> It looks like the default $_started variable was removed between 1.3.0
> and 1.3.2.
>
> I'd recommend the following modification for line 222 of \lib
> \cake_session.php:
>
> from:
> if (isset($_SESSION) && $this->_started) {
>
> to:
> if (isset($_SESSION) && isset($this->_started) && $this->_started){
>
> 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


Re: Custom pagination with plain SQL

2010-06-15 Thread Lucca Mordente
SearchableBehavior seems to be very nice indeed.

I'd have to create a setup to index the existing data and modify it to
match my needs, that which would spend a lot of time.
Yes, I'll consider to use this behavior.

However, I have no enough time to swap right now, facing the time
spent creating my own.

Isn't there a way to use CakePHP paginator to paginate a plain SQL?

Thanks!



On 14 jun, 22:19, cricket  wrote:
> On Jun 14, 2:26 pm, Lucca Mordente  wrote:
>
> > The search is performed in about 40 tables.
> > Imagine instantiate 40 models to do this.
> > And I have some other tricks that force me to useplainSQL.
>
> > Any sugestions?
>
> Yes, take a look at the SearchableBehavior I linked to. It'll create
> an index, in a single table, of all your searchable model records.
>
> I think it really should be re-written as a plugin (and I've modified
> it myself in other ways) but it does the job.

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


Curl NOBODY problem

2010-06-15 Thread Manolet Gmail
Hi, i want to obtain the headers for this link

http://freedfd.googlecode.com/files/FreeDFD-1.1.zip

i set up this config for curl:

$ch = curl_init();
  curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, true);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE
5.01; Windows NT 5.0)");
curl_setopt ($ch, CURLOPT_NOBODY, 1); // and *only* get the header
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
curl_setopt ($ch, CURLOPT_FRESH_CONNECT, 1); // don't use a cached
version of the url
$resultado = curl_exec($ch);
$error = curl_error($ch);
$info = curl_getinfo($ch);

i dont want the file, just the headers, so i set NOBODY to 1, the problem is
that if i set it Google Servers return an error page. but if i dont set it i
receive the rights headers.

I dont want the body since is a file and can be so big and i just want to
verify if the link is working.

Some idea of how to cancel the download when headers are received?

Arnold

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


Validation - specifying which rules to use

2010-06-15 Thread WhyNotSmile
Is there any way to validate on a restricted set of rules in the
controller?

For instance, I have an email address which is validated in the model
like this:

var $validate = array(
 'email' => array(
 'maxlength' => array(
 'rule' => array('maxLength',100),
 'message' => 'Email address must be 100 characters or
less'
  ),
  'notEmpty' => array(
  'rule' => 'notEmpty',
  'message' => 'Please enter your email address'
   ),
  'validEmail' => array(
  'rule' => array('email', false),
  'message' => 'Please enter a valid email address'
   ),
  'unique' => array(
  'rule' => array('isUnique', false),
  'message' => 'This email address has already been
registered.  If you have forgotten your password, you can get a
reminder by clicking on the link on the login page'
   )
 )
)

At one point I want to validate an email address, but I don't want to
check that it's unique (because I'm not actually saving it, just
checking it's otherwise valid).

So far I have:

if($this->User->validates(array('fieldList' => array('email' {
 ...
}

Is there any way to define which rules I want it to validate against,
or does it have to do all of them?  I can't find anything on this in
the validation section of the manual (using v.1.2), so any directions
would be much appreciated.

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


Cake wants to describe tables without a table name

2010-06-15 Thread cakeuser
All the actions in my cake-project work perfectly, but the "subscribe"
action for my newsletter goes crazy.
After 3 houres i don't know how to fix it.

The error messages:
--
Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near '' at line 1 [CORE/cake/libs/model/
datasources/dbo_source.php, line 673]
Code | Context

$sql=   "DESCRIBE "
$error  =   "1064: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near '' at line 1"
$out=   null

DboSource::showQuery() - CORE/cake/libs/model/datasources/
dbo_source.php, line 673
DboSource::execute() - CORE/cake/libs/model/datasources/
dbo_source.php, line 263
DboSource::fetchAll() - CORE/cake/libs/model/datasources/
dbo_source.php, line 407
DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php,
line 284
DboMysqlBase::describe() - CORE/cake/libs/model/datasources/dbo/
dbo_mysql.php, line 125
Model::schema() - CORE/cake/libs/model/model.php, line 925
Model::hasField() - CORE/cake/libs/model/model.php, line 1011
Model::hasField() - CORE/cake/libs/model/model.php, line 997
Model::__construct() - CORE/cake/libs/model/model.php, line 477
ClassRegistry::init() - CORE/cake/libs/class_registry.php, line 149
AuthComponent::getModel() - CORE/cake/libs/controller/components/
auth.php, line 821
AuthComponent::hashPasswords() - CORE/cake/libs/controller/components/
auth.php, line 926
AuthComponent::startup() - CORE/cake/libs/controller/components/
auth.php, line 333
Component::triggerCallback() - CORE/cake/libs/controller/
component.php, line 186
Controller::startupProcess() - CORE/cake/libs/controller/
controller.php, line 527
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 187
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171

Query: DESCRIBE

Warning (2): Invalid argument supplied for foreach() [CORE/cake/libs/
model/datasources/dbo/dbo_mysql.php, line 127]
Code | Context

$cols = $this->query('DESCRIBE ' . $this-
>fullTableName($model));

foreach ($cols as $column) {

DboMysqlBase::describe() - CORE/cake/libs/model/datasources/dbo/
dbo_mysql.php, line 127
Model::schema() - CORE/cake/libs/model/model.php, line 925
Model::hasField() - CORE/cake/libs/model/model.php, line 1011
Model::hasField() - CORE/cake/libs/model/model.php, line 997
Model::__construct() - CORE/cake/libs/model/model.php, line 477
ClassRegistry::init() - CORE/cake/libs/class_registry.php, line 149
AuthComponent::getModel() - CORE/cake/libs/controller/components/
auth.php, line 821
AuthComponent::hashPasswords() - CORE/cake/libs/controller/components/
auth.php, line 926
AuthComponent::startup() - CORE/cake/libs/controller/components/
auth.php, line 333
Component::triggerCallback() - CORE/cake/libs/controller/
component.php, line 186
Controller::startupProcess() - CORE/cake/libs/controller/
controller.php, line 527
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 187
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83

Query: DESCRIBE

Query: DESCRIBE
--

I don't understand why cake wants to describe some tables without the
table names.
I hope someone has an idea.

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


[ask] : reuseable view

2010-06-15 Thread Mario Simaremare
dear all,

i am very new with php and the cake. i used to play with java
actually.
i would ask you, if there is a way in the cake to create a single view
file to view, add, and edit then reuse them.
i mean to use the same view with different models. the views
automatically detects the table columns and it's header then fill the
cell with the thrown models data?

thank you,

regards,

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


SessionHandler error message

2010-06-15 Thread AKim
Is anyone else getting the following error after upgrading to 1.3.2?

Notice (8): Undefined property: SessionHelper::$_started [CORE\cake
\libs\cake_session.php, line 222]

It looks like the default $_started variable was removed between 1.3.0
and 1.3.2.

I'd recommend the following modification for line 222 of \lib
\cake_session.php:

from:
if (isset($_SESSION) && $this->_started) {

to:
if (isset($_SESSION) && isset($this->_started) && $this->_started){

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


Re: Automagic Form (Drop down list)

2010-06-15 Thread Jeremy Burns | Class Outfit
Let's assume that you are working with Items, each of which is in a category - 
so you need a Category drop down.

In the items_controller action that calls your form, do the following:

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

In your view, type this:

echo $this->Form->input('category_id');

Cake will automatically tie up your $categories variable (created by 
this->set('categories', etc...) and use it as the option list for the drop 
down. The stored value will be 'id', the displayed value will be 'name'. This 
does - of course - assume that you have adhered to Cake's table and field 
naming conventions.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 15 Jun 2010, at 14:00, Shaz wrote:

> Probably something really simple but I can't figure it out / find
> information on it:
> 
> Got a form (add article) with a drop down list (categories). How do I
> get it to show the category names rather than id while still
> maintaining the id as the value?
> 
> 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


Automagic Form (Drop down list)

2010-06-15 Thread Shaz
Probably something really simple but I can't figure it out / find
information on it:

Got a form (add article) with a drop down list (categories). How do I
get it to show the category names rather than id while still
maintaining the id as the value?

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


i was defined one global variable in core.php how can i use that variable in my app controller

2010-06-15 Thread Narendra Padala
Hi all I am new to cake php,

I am created some themes like red, green blue etc.

i have to use these themes in my appliaction.

so i defined in my app controller like this

var $view = 'Theme';
var $theme = 'black'; // here i need global value.


this value i have to set in the core .php

like this i wrote

define('', 'blue');


now i need use the '' value to

var $theme = $''  // here how can i use.


Please any one can help me out to solove this problem


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: XML Helper

2010-06-15 Thread Jankeesvw
Thanks for you reply, I am aware that this could be a workaround. But
I hoped that there was another way to fix this. I think more people
want this.

On Jun 14, 4:41 pm, calvin  wrote:
> I don't think I've ever used the XML helper, but this seems like a
> pretty simple array manipulation problem:
>
> foreach ($data['news']['news_images'] as $newsImage) {
>    $data['news'][] = $newsImage;}
>
> unset($data['news']['news_images']);
>
> On Jun 14, 3:57 am, Jankeesvw  wrote:> Hi fellow Cake 
> bakers!
>
> > I have a question about the XML helper I have a model which has a
> > hasMany relationship. (News hasMany NewsImages). But when I use the
> > serialize function to render the data to XML I get a result I don't
> > really like. I would like cake to wrap a xml-node around the child
> > nodes of the images. Is this something that's possible? I really hope
> > so.
>
> > I created a pastie with how the current XML looks and how I would like
> > it to look:http://www.pastie.org/1003646
>
> > Thanks a lot!
> > Jankees
>
>

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: showing data in a popup in aftersave()

2010-06-15 Thread Sam Sherlock
>
> and the usual place

to do so might be the view.


the only place


if you intention is to be let the user print out the results of the model
save without menu etc
then you might be better off using a print stylesheet to hide the menu and
other such elements -
that way you can avoid the complexity of using popups

you could look at using a specific plainer layout for

$this->layout = 'plain';

views/layouts/plain.ctp - this plain layout does not include menu

a while back I created pdf version of a resume and used a plain layout for
this purpose

I would personally avoid using popups as this may have a bunch of problems
to solve.

but if that is no good for you then one of the following

either you'd have

1) the view set script to open the popup with the data (php would have to
create javascript that would create popup and write ouput to it)

-- or --

 2) you could save the relevant model id to session afterSave and then have
the view window.open a specific action that uses this session value to
display the data

I would opt for the 2nd of those myself (but only if I could not avoid the
popupless option)


others may have a much better suggestion for you :)

- S



On 15 June 2010 11:28, mivogt-LU  wrote:

> ok I see I need to explain what I aim on to get an answer fitting with
> the question in mind
>
> 1st you are right at all. php wont open an popup, and the usual place
> to do so might be the view.
>
> What I want to do is
> if a new dataset is stored to the model,
> I call the aftersave() function
> from there I want to show the data stored within the process
> to do a printout fitting the page
>
> if i do a printout within the cake site I will also have the menue be
> printed
> so I am looking for _any_ way to offer a PrintDataset function inside
> my app.
> later on I might lookup to use html2pdf lib to get it as pdf, too for
> mailing it...
>
> if I use JS to do a popup window, will I be able to access my app data
> within the window via $this-> ... or use the variable I set inside the
> controller some like this:: $this->set('mydatatobeused', ($this-
> >Customer->Request));
>
> and do the js popup to call me a php file to show up with echo my
> $mydatatobeused informations?
>
> thanks in advance
>
> michael
>
> On 15 Jun., 02:58, calvin  wrote:
> > You're getting server-side/client-side code confused. PHP code runs on
> > the web server, not on the visitor's web browser. It can't create pop-
> > up windows in the browser.
> >
> > If you want to use PHP to generate JavaScript in the _view_ to pop up
> > a window, then you need to do that in the view, not in the model. The
> > model is only for reading/writing/manipulating your data.
> >
> > On Jun 14, 12:03 pm, mivogt-LU  wrote:
> >
> > > HI @ all,
> >
> > > I would like to know if there is a way to settle some function inside
> > > my aftersave() (inside the modelcode) to open an popupwindow showing
> > > the modeldate in a printable format.
> >
> > > I am thinking on something like
> > > function aftersave()
> > > {
> > > doPopupwindows($this->data)
> >
> > > }
> >
> > > and inside the popup
> >
> > > echo $this->data->model->field;
> >
> > > Any suggestions on this?
> >
> > > Thanks
> >
> > > Michael
>
> 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.comFor
>  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


Offline Manuals

2010-06-15 Thread leo
I'm sure they've been posted before, but some of you might find these
links useful. They link to the manual in one page - useful for offline
use or creating a PDF using
Dardo Sordi Bogado's build script: 
http://rapidshare.com/files/218826372/manual-builder.zip

Also see this thread:
http://groups.google.com/group/cake-php/browse_thread/thread/5f45c1d0779c7163

1.2
http://book.cakephp.org/complete/3/The-Manual

1.3
http://book.cakephp.org/complete/876/The-Manual

If anyone can help with api-in-a-page, please post the links!

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: showing data in a popup in aftersave()

2010-06-15 Thread mivogt-LU
ok I see I need to explain what I aim on to get an answer fitting with
the question in mind

1st you are right at all. php wont open an popup, and the usual place
to do so might be the view.

What I want to do is
if a new dataset is stored to the model,
I call the aftersave() function
from there I want to show the data stored within the process
to do a printout fitting the page

if i do a printout within the cake site I will also have the menue be
printed
so I am looking for _any_ way to offer a PrintDataset function inside
my app.
later on I might lookup to use html2pdf lib to get it as pdf, too for
mailing it...

if I use JS to do a popup window, will I be able to access my app data
within the window via $this-> ... or use the variable I set inside the
controller some like this:: $this->set('mydatatobeused', ($this-
>Customer->Request));

and do the js popup to call me a php file to show up with echo my
$mydatatobeused informations?

thanks in advance

michael

On 15 Jun., 02:58, calvin  wrote:
> You're getting server-side/client-side code confused. PHP code runs on
> the web server, not on the visitor's web browser. It can't create pop-
> up windows in the browser.
>
> If you want to use PHP to generate JavaScript in the _view_ to pop up
> a window, then you need to do that in the view, not in the model. The
> model is only for reading/writing/manipulating your data.
>
> On Jun 14, 12:03 pm, mivogt-LU  wrote:
>
> > HI @ all,
>
> > I would like to know if there is a way to settle some function inside
> > my aftersave() (inside the modelcode) to open an popupwindow showing
> > the modeldate in a printable format.
>
> > I am thinking on something like
> > function aftersave()
> > {
> > doPopupwindows($this->data)
>
> > }
>
> > and inside the popup
>
> > echo $this->data->model->field;
>
> > Any suggestions on this?
>
> > Thanks
>
> > Michael

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: model-view - related data; choos fields to be displays?

2010-06-15 Thread mivogt-LU
@sam
thanks this seems to be working
I did my everyday mistake as so often in the past
just never know where to place wich part of my code :/

I added the find to the controller
and pass the data I got to the view and use and display it there

controller:
$this->set('meals', ($this->Customer->Request->Meal0->find('list')));

view:
$debug($meals);

solved :)

On 14 Jun., 21:49, Sam Sherlock  wrote:
> you can select which fields of a table you wish to retrive.
> if my model is Article then:
> $this->Article->find('all', array(
> ...
> 'fields' => array('Article.field1', 'DISTINCT Article.field2')
> ...
> ));
>
> seehttp://book.cakephp.org/view/1017/Retrieving-Your-Data
>
> you can use the containable behaviour to control the related models which
> find returns
>  http://book.cakephp.org/view/1323/Containable
>
> does that help?
>
> - S
>
> On 14 June 2010 19:26, mivogt-LU  wrote:
>
> > HI there,
>
> > if I choos in the index view the view button I get all my models data
> > and also the related models are shown somehow.
>
> > i.e. if I choos from customer-index: view I get the customer details.
> > I also get the orders he placed in some manner.
> > Sadly instead of an item name I am only shown the indexnumbers.
>
> > i.e.:
>
> > Related Bookings
> > Id      Name    Customer Id     Mealclass Id    Request Id
>
> > I would like to show up other fields instead of the id.
> > instead of requestID I prefer showing requestName
> > instead of mealclassID I prefer showing mealclassKennung
>
> > Might you please tell me how to change my code from
> >                        
> >                        
> >                        
> >                        
> >                        
>
> > to something doing as I want?
> > I know I ll need to use the indexes to show up the fitting item out of
> > the database.
> > But still not that fit in cake to get the solution on my own.
>
> > Thanks in advance..
>
> > Michael
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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.comFor
> >  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: How to add new language codes in the L10n::__l10nMap/L10n::__l10nCatalog

2010-06-15 Thread AD7six


On Jun 15, 10:49 am, bhupinderchd  wrote:
> Can anybody please help me there?

why not create a ticket+patch for the core and add the missing
languages (i.e. edit your local install and ensure the changes are at
least made available to be pulled into cake).

hth,

AD

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: model-view - related data; choos fields to be displays?

2010-06-15 Thread mivogt-LU
@calvin:
Thanks I am not that new to php, I know what an array and and array
index is
I can not du as you suppose as the data I need is not passed to the
$booking array.
$booking only contains the foreignkey in the field mealclassid
the field melclassKennung is not available.
I doublechecked this once by hardcoding it in and getting errors for
non available array index
once did the debug ($booking) to see what is contained.

This is why I asked for hot to do within cake.
I might do myselfe some php sql syntax and get my data from the db
directly
but this is no good style i was told.

My tryout using cakes find() also did not hit when I tired it inside
the view code
somhow I think it was the wrong place and might work if i do the
find() inside the controller

** might be a guess for the cake book: add in the api where to call
wich command **


cu

michael

On 15 Jun., 02:51, calvin  wrote:
> When you baked your models did you set the displayField property when
> cake bake asks you to? "requestName" and "mealclassKennung" are not
> standard display field names. Cake only knows to look for fields
> called "name" or "title" to use as display fields by default. If you
> want to display any other field, you need to tell cake which field to
> use.
>
> If you don't want to use cake bake to generate your views for you,
> then just edit the code manually. Replace $booking['mealclass_id']
> with $booking['mealclassKennung']. That's just basic PHP. If you can't
> understand what your code says, then I'd recommend getting a PHP book
> and skimming through it--particularly read the chapters about how
> arrays and associative arrays work. You're going to need to know that
> stuff to work with cake.
>
> On Jun 14, 11:26 am, mivogt-LU  wrote:
>
> > HI there,
>
> > if I choos in the index view the view button I get all my models data
> > and also the related models are shown somehow.
>
> > i.e. if I choos from customer-index: view I get the customer details.
> > I also get the orders he placed in some manner.
> > Sadly instead of an item name I am only shown the indexnumbers.
>
> > i.e.:
>
> > Related Bookings
> > Id      Name    Customer Id     Mealclass Id    Request Id
>
> > I would like to show up other fields instead of the id.
> > instead of requestID I prefer showing requestName
> > instead of mealclassID I prefer showing mealclassKennung
>
> > Might you please tell me how to change my code from
> >                         
> >                         
> >                         
> >                         
> >                         
>
> > to something doing as I want?
> > I know I ll need to use the indexes to show up the fitting item out of
> > the database.
> > But still not that fit in cake to get the solution on my own.
>
> > Thanks in advance..
>
> > Michael

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

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


Re: How to add new language codes in the L10n::__l10nMap/L10n::__l10nCatalog

2010-06-15 Thread bhupinderchd
Can anybody please help me there?

On Jun 10, 12:18 pm, bhupinderchd  wrote:
> How can I add a new language code in the L10n::__l10nMap/
> L10n::__l10nCatalog
>
> I am going to create a multi-lingual application. In the
> L10n::__l10nMap, I could not find ISO code for Swahili and other
> languages  that are not present in the L10n::__l10nMap and/or
> L10n::__l10nCatalog.
>
> My question is how can I add new locale configurations to the L10n?
>
> apologies for bad english.
>
> Thanks & Regards,
> Bhupinder
>
> Bhupinder Singh

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


1.3 $scripts_for_layout not working

2010-06-15 Thread Ragnis
In my header i have 

But when i try to use this, then the script tag doesn't appear in the
header:
Html->script('general', array('inline' => false)); ?>

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


links point to wrong folder

2010-06-15 Thread NickPick
When I cake bake a project it appears that all the links are pointing
to a wrong folder. http://localhost/users instead of 
http://localhost/project1/users.
Also the images are not displayed.

I have added Alloworverride all in httpd.conf and also uncommented in
core.php configure::write('App.baseURL'env(SCRIPT_NAME));, but of this
seems to solve my problem.

Any advice is appreciated.

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

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


Re: Pagination: Sort by count of related model (e.g. User -> Posts)

2010-06-15 Thread dtemes
Depending on how precise your information should be you can add a
number_of_posts field to your users table and update the count
periodically, you can also keep the field updated with database
triggers, or create an action to run the update query from cakephp
admin pages on demand.

That's just another way of dealing with it.

Regards


On 13 jun, 13:11, DigitalDude  wrote:
> Hey,
>
> I have a problem here and need to fix it. It's about the following
> situation:
>
> I have a model "User" that has a relation to some entrie, let's say
> "Posts". I want to paginate the User-Model and add a counting of the
> user's posts to my index of Users. So I will have the following table-
> structure in my view:
>
> Id Name Posts Actions
> 2  Ben      5       view/edit/delete
> 5  Mary    8       view/edit/delete
>
> The first two columns are easy to sort, but HOW can I sort my
> paginated user-array by the count of the related Post-entries?
>
> I would really appreciate some help here, because I just cannot find a
> way to do this... :(
>
> Regards,
>
> DD

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: Google Groups Related: Receiving Thread Activity Notifications

2010-06-15 Thread John Andersen
In the top of the thread, you see a link named "Option", click on it
and there should be an option to "Email updates to me"!
Enjoy,
   John

On Jun 15, 6:36 am, Jeff  wrote:
> Hello,
>
> As basic a question as this is, is it possible to receive emails from
> this group ONLY when there is new activity on a thread I have posted
> to?  The trouble is, I don't want a "summary" of activity every
> day  all I care about is the threads I have already been involved
> in.  Google Groups seems to be somewhat anemic in its options  Can
> someone point me in the right direction?
>
> Thanks,
> Jeff

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: find list, filtered

2010-06-15 Thread John Andersen
Good that you found it! I saw that I wrote "brackets" not "quotes",
short-circuit in my brain :D
Enjoy,
   John

On Jun 15, 5:41 am, cricket  wrote:
> On Jun 14, 9:16 pm, cricket  wrote:
>
>
>
> > ... it works fine. So, I tried Cake's query without the WHERE clause,
> > and also without the GROUP BY, but no change. There seems to be some
> > problem with the table aliases.
>
> OK, I got it. The problem was how I'd specified the condition. This:
>
> 'conditions' => array(
>         'Member.country_id' => 'Country.id'
> )
[snip]

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

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


Re: Problem with counting records

2010-06-15 Thread Kiza
Thanks for your quick replay. Here is what I did so far:

I created method listing() inside voters_controller:

function export_xls()
{
$this->layout = 'export_xls';
$locations = $this->Location->find('list');
   $report = array();
foreach ($locations as $locationId => $locationName)
{
foreach ($statuses as $status)
{
$report[$locationId][$status] = 
$this->Voter->find('count',
array(
'conditions' => array('Voter.location_id' =>
$locationId,'Voter.status' => $status)));
}

}

$this->set('locations','report');

}

Also I created layout named expost_xls iside layout directory and
inside view/voters folder I created file export_xls.ctp:

';
echo ''.$location['Location']['name'].'';






/*echo ''.$report['LocationName'][1].'';*/

echo '';

endforeach; ?>

Here I have I problem, because  I got error when I try to display
data. I apologize if this is blunder question but I'm new in Cake and
struggling to cope with this.
What argument I have to supply to view to correctly display data.

On Jun 14, 4:49 pm, calvin  wrote:
> $locations = $this->Location->find('list');
> $report = array();
> foreach ($locations as $locationId => $locationName) {
>   foreach ($statuses as $status) {
>     $report[$locationId][$status] = $this->Voter->find('count', array(
>       'conditions' => array(
>         'Voter.location_id' => $locationId,
>         'Voter.status' => $status
>       )
>     ));
>   }}
>
> $this->set(compact('locations', 'report'));
>
> I'd recommend reading the Cookbook and doing the blog example if
> you're still unsure as to how to send data from a controller to the
> view.
>
> On Jun 14, 5:04 am, Kiza  wrote:
>
> > Hello,
>
> > I'm currently working on app for Voters registering and it's pretty
> > much completed.
>
> > I have 5 tables in database: voters, locations, categories, users,
> > statuses.
>
> > Table voter is in "belongs to" relationship with other tables and
> > tables have following structure:
>
> > voters
>
> > id int(11) NOT NULL auto_increment,
>
> > firstName varchar(50) NOT NULL,
>
> > lastName varchar(50) NOT NULL,
>
> > phone varchar(50) NOT NULL,
>
> > status_id int(11) NOT NULL,
>
> > user_id int(11) NOT NULL,
>
> > location_id int(11) NOT NULL,
>
> > category_id int(11) NOT NULL,
>
> > locations
>
> > id int(11) NOT NULL auto_increment,
>
> > name varchar(50) NOT NULL,
>
> > statuses
>
> > firstName0 int(11) NOT NULL auto_increment,
>
> > firstName1 varchar(50) NOT NULL,
>
> > categories
>
> > firstName2 int(11) NOT NULL auto_increment,
>
> > firstName3 varchar(50) NOT NULL,
>
> > What I would like to do is display all locations names, each followed
> > with a count of the number of voters from that locations for status 1,
> > status 2 and so on
>
> > .
>
> > Basically I must generate report witch has following structure:
>
> > Location name| Number of voter in status 1 | Number of voters in
> > status 2 | etc.
>
> > Location 1
>
> > Location 2
>
> > Location 3
>
> > etc
>
> > I guessing that I should use find('count') or counterCache but I just
> > don't know how to write that query or how to send result to view. This
> > is really major problem for me so if anyone have some suggestion it
> > will be appreciated.
>
> > If you need some additional information I will be happy to provide it
> > in order to solve this problem.

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