Filter on BelongsTo relationship

2008-11-26 Thread AngeloZanetti
Hi all, i have 2 tables: competition, competition choices. In my model the definitions are as follows: Competition: var $hasMany = array( 'CompetitionChoice' => array('className' => 'CompetitionChoice',

ACL Deny Allow issue

2008-11-26 Thread jst4fun
Hello All, I am struck with a weird situation. I have a page which allows a user (admin) to create a group, set and deny permission to an controller action for that group. If it is a new group I am able to set and deny the permissions to certain actions of controller without any issues. But when i

Re: Getting started with themes and static files

2008-11-26 Thread Arthur Pemberton
On Wed, Nov 26, 2008 at 7:20 PM, Dan Bair <[EMAIL PROTECTED]> wrote: > > If you're going to be having a lot of static pages, it may be worth > your while to use Cake's Folder and File objects. You can loop through > the .ctp files assign the routes dynamically. > > Here's a quick snippet that will

Re: stay on current page once delete an item in CMS

2008-11-26 Thread AngeloZanetti
Kyo-2 wrote: > > > Try $this->redirect($this->referer()); > > > This did the trick, thanks very much. -- View this message in context: http://www.nabble.com/stay-on-current-page-once-delete-an-item-in-CMS-tp20679009p20713704.html Sent from the CakePHP mailing list archive at Nabble.com

Re: With Debug = 0, Ajax effects not working...

2008-11-26 Thread SF
In case anyone else needs it, this was solved by adding $this->autoRender=null; to the delete action in the controller. Still not sure why it gave a 404 error only in debug 0. SF On Nov 21, 12:00 pm, SF <[EMAIL PROTECTED]> wrote: > I have seen a few postings about this but none seemed to ever

Re: Security handling details - customers keep asking!!!

2008-11-26 Thread Adam Royle
Security is something that is left to the developer to implement. If you follow conventions you can avoid sql injection attacks. If you use the Security component you can prevent CSRFattacks. If you use proper methods to escape any user input you can prevent XSS attacks. So cakephp has features t

Re: Getting started with themes and static files

2008-11-26 Thread Dan Bair
If you're going to be having a lot of static pages, it may be worth your while to use Cake's Folder and File objects. You can loop through the .ctp files assign the routes dynamically. Here's a quick snippet that will go through all of the .ctp files in the pages directory. This will be in app/co

HABTM pagination

2008-11-26 Thread aron
Hi Guys, Read the faq and such and this seems bizarre this can't be done with out special code. I cannot get this to paginate. The following is my controller action. Why wont paginate work on this. function cuisine($searchby = null) { $this->Listing->recursive

Re: Getting started with themes and static files

2008-11-26 Thread Sam Sherlock
If you want to remove the /pages/ from the url you'd need to write some custom routes see the preset example for the home page which sets yourdomain.com/ to display views/pages/home.ctp eg Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); so /about -> views/

Re: Getting started with themes and static files

2008-11-26 Thread Arthur Pemberton
On Wed, Nov 26, 2008 at 4:18 PM, James K <[EMAIL PROTECTED]> wrote: > > For static pages, just add them to views/pages/ > > Name them with a .ctp extension > > You should be able to reach those pages by simply going to > yourdomain.com/pages/staticpagename and it'll wrap that content in the > defa

Re: belongsTo via form

2008-11-26 Thread thatsgreat2345
instead of company do Company.name or whatever field you have called to save the name. On Nov 26, 2:18 pm, Sebastian Göttschkes <[EMAIL PROTECTED]> wrote: > Hi there, > > I got a problem I cannot solve using the docs or google. > > I have a Model User, which contains all users. Every User belongs

belongsTo via form

2008-11-26 Thread Sebastian Göttschkes
Hi there, I got a problem I cannot solve using the docs or google. I have a Model User, which contains all users. Every User belongs to a Company, so I added a foreign key company_id to the users table and added a table companies. Everything is working well to this point. Know I want to add the

Re: Getting started with themes and static files

2008-11-26 Thread James K
For static pages, just add them to views/pages/ Name them with a .ctp extension You should be able to reach those pages by simply going to yourdomain.com/pages/staticpagename and it'll wrap that content in the default layout. - James On Nov 26, 4:14 pm, Arthur Pemberton <[EMAIL PROTECTED]> wr

Getting started with themes and static files

2008-11-26 Thread Arthur Pemberton
I'm just looking into CakePHP for a small website I need to build (mostly static pages, but some logic with persistent data). The screencasts and tutorials I have looked through so far provide good starting information, but not much on making use of CakePHPs themeing engine, and how it deals with

$javascript->object problem

2008-11-26 Thread Fabio Kreusch
Hello all, I'm starting with CakePHP, and I'm having this problem: When I use $javascript->object() to convert an array to a json object, it simply cut out my values with accents (áêé etc). Is there an option to stop doing this? Thanks! --~--~-~--~~~---~--~~ You

Is there a way not to escape special chars?

2008-11-26 Thread Vitaly
Hi, Is there a way not to escape special chars? What I do is: $onClick = '$(\'#postAddForm\').ajaxSubmit()'; echo $form->button('Upload Text', array('onClick' => $onClick)); The resulting HTML looks like: while I need it to look like this: http://groups.google.com/group/cake-php?hl=en -~

Add new record based on existing record ie saveas

2008-11-26 Thread grahamk
I have two models - Rotas and Lines. Rotas have many lines and Lines belongs to Rotas. I am trying to create a function that will take an existing record (a rota with n lines) and save it as a new rota complete with the associated lines. I can create a new rota and add new lines, I can create a n

Multi tenant authentication

2008-11-26 Thread P
Hello, i've been reading and reading, but cannot find insight on how to achieve the following: I'm (trying to...) designing a multi tenant application where i will: - host multiple organisations - each organisation will have access to a range of modules (not all will have access to all modules).

paginate related model's data

2008-11-26 Thread aron
When i bake my models and controllers it adds the related models in the view , how would you add pagination to these? thanks for any help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post

Security handling details - customers keep asking!!!

2008-11-26 Thread Tim
I am looking for a webpage or something that details what security issues Cake handles. Customers ask how secure their sites are going to be and I assure them that since I'm using the CakePHP framework that their site is being built on a secure foundation. I need some details though. I looked thro

Re: Just getting started and have a problem with relationships

2008-11-26 Thread thatsgreat2345
You do not use print_r in your controller unless you have turned off the rendering of the view. Use debug and it will print it out the variable at the top. Do you really have a table named blogs? If you are trying to add the users and posts you have told blog to use them. Add var $uses = array('Us

Re: single or multiple category models/tables - which is better?

2008-11-26 Thread majna
You can add into "categories" table "model" filed (like article, product) acting as flag. On Nov 26, 4:30 pm, keymaster <[EMAIL PROTECTED]> wrote: > forgot to mention, the categories are heirarchical using the tree > behavior. > > On Nov 26, 5:27 pm, keymaster <[EMAIL PROTECTED]> wrote: > > > Sup

Re: use tree behavior and link another model

2008-11-26 Thread austin
for those who need it, here is correct code to have in the controller: $machineParts = $this->Machine->MachinePart->generatetreelist(array ('machine_id' => $id), '{n}.Part.id', '{n}.Part.name', '-', true); $this->set('machineParts', $machineParts); --~--~-~--~~~---~-

Re: Just getting started and have a problem with relationships

2008-11-26 Thread austin
can you point out which is line 7 of your controller, please? austin On Nov 23, 11:33 pm, "James.Diss" <[EMAIL PROTECTED]> wrote: > Okay, well this gets weirder. > > I've started on the blog tutorial on the website, and I'm working > through is successfully apart from validate isn't appearing in

Re: CakePHP Unit Test Model Woes :(

2008-11-26 Thread pragna
Mark: Yeah, but the fixture file I've posted was created using the 'fixturize' script from the guys at debuggable: http://debuggable.com/posts/fixturize-shell---generate-your-fixtures-automatically:48c12ad0-2350-4b5a-94d4-5f424834cda3 It reads from an existing table (in the default db) and also r

Re: CakePHP Unit Test Model Woes :(

2008-11-26 Thread pragna
Hi Matt, Thanks very, very much for sharing this. I now have a working model unit test :) As the next step it would be nice to see a documented solution in the Cookbook. I know there are many ways to skin a cat, but I'm still searching for some concensus from CakePHP unit testers as to the optim

Re: CakePHP Unit Test Model Woes :(

2008-11-26 Thread mark_story
Your fixture doesn't define a var $fields nor does it use import. Therefore the fixture has no way of creating a table schema. You need to define fields information or import a table definition. See http://book.cakephp.org/view/360/Creating-fixtures -Mark On Nov 26, 10:43 am, pragna <[EMAIL PR

Re: Agregating multiple databases

2008-11-26 Thread Rafael Bandeira aka rafaelbandeira3
For sure that's a way to do that. > > Can I create a model that will show me a list of all users in Ohio and > Kentucky? > Are both dbs on same host and can they be accessed by same app's db client and therefore be used in a same sql query? --~--~-~--~~~---~--~~

Re: Just getting started and have a problem with relationships

2008-11-26 Thread James.Diss
Still having problems with this. I've now deinstalled and reinstalled PHP5 and Apache2 (mainly to cure an unrelated problem connected with the non-retention of sessions, but that's another container of marine vertebrates). So I've gone from enthusiasm to abject disappointment over Cake. It's a

Re: CakePHP Unit Test Model Woes :(

2008-11-26 Thread pragna
mark_story: thanks - i've changed fixture to 'app.user' & removed $this->loadFixtures. valikeys: thanks - i've removed the redundant App::import. Test now is: User = ClassRegistry::init('User'); } function testEnabledUsers() { $result = $this->User->enabledUsers(a

Re: CakePHP Unit Test Model Woes :(

2008-11-26 Thread Matt Curry
Here you go: http://github.com/mcurry/cakephp/tree/master/test_sample This is the template for tests that I uses. It took me like 2 days to get it working, even though there are only like two differences from the standard baked tests. One note: You have to include all the fixtures for associat

Re: single or multiple category models/tables - which is better?

2008-11-26 Thread keymaster
forgot to mention, the categories are heirarchical using the tree behavior. On Nov 26, 5:27 pm, keymaster <[EMAIL PROTECTED]> wrote: > Suppose one has a need for categories of articles, products, > downloads, etc., within the same application. > > What would be a better approach to implementing t

single or multiple category models/tables - which is better?

2008-11-26 Thread keymaster
Suppose one has a need for categories of articles, products, downloads, etc., within the same application. What would be a better approach to implementing this? 1. having a different categories table/model for each, like article_categories, product_categories, download_categories, etc. 2.

Agregating multiple databases

2008-11-26 Thread Johnathan Henderson
If I have more than one database with identical tables, is there a way for CakePHP to combine them? Example: DB1 has information for Ohio DB2 has information for Kentucky Both databases have a table that contains a list of Users (let's assume that the primary key was setup so that there wouldn'

Re: Mambo on CakePHP brainstorm

2008-11-26 Thread Elpie
We have already felt the pain Nate ;) Mambo has a core + core extensions. With the release of Mambo 4.6 a couple of years ago we began releasing two versions, which were called "Mambo" (or, in the earlier days, "Mambo Complete") and "Mambo Lite". Mambo Lite is the core with no core extensions. All

Re: CakePHP Unit Test Model Woes :(

2008-11-26 Thread validkeys
RE: 3) I don't think you need to App::import your model if you use ClassRegistry::init. Not 100% on that, and it shouldn't hurt even if you do. You don't, ClassRegistry::init handles the App::import On Nov 26, 9:15 am, mark_story <[EMAIL PROTECTED]> wrote: > Your fixture name needs to be 'app.u

Re: Mambo on CakePHP brainstorm

2008-11-26 Thread Elpie
I don't see that as an option. One thing that has to be done well, right from the outset, is the planning. A lot of work is currently being done in that area. I agree with the comments made by James K. on that - if Mambo is not planned well we will limit ourselves too much. The current developmen

Re: CakePHP Unit Test Model Woes :(

2008-11-26 Thread mark_story
Your fixture name needs to be 'app.user'. Also you only need to manually load fixtures is you have var $autoFixtures set to false. -Mark On Nov 25, 5:04 pm, MattC <[EMAIL PROTECTED]> wrote: > This may or may not fix your problem but: > 1) You test db should be empty.  The framework will automat

Re: stay on current page once delete an item in CMS

2008-11-26 Thread DM
Would an Ajax delete work for you? When you click the link for delete, you can send the delete via Ajax and the user will not have to leave the page. On the server side, just detect the Ajax request within the controller's delete action and remove the appropriate record. If correctly deleted, your

Re: stay on current page once delete an item in CMS

2008-11-26 Thread DM
I thought my post when through, I guess it didn't. You could try an ajax delete from your table. From the server side, in your controller's delete action, detect the ajax request with the request handler component and delete the record. Then post back to the browser a success and you could gray o

AW: retrieve value of a "select" in the controller

2008-11-26 Thread Liebermann, Anja Carolin
$this->data['Site']['site_id'] Presuming you are wroking in the sites_controller.php Anja -Ursprüngliche Nachricht- Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von pkclarke Gesendet: Mittwoch, 26. November 2008 12:57 An: CakePHP Betreff: retrieve value of a "sele

retrieve value of a "select" in the controller

2008-11-26 Thread pkclarke
I have an uber-noob question: My view has a "select" that is not associated with any models: echo $form->select('site_id', array('1'=>'Site 1', '2'=>'Site 2'), '1', array('id' =>'sites', 'label'=>'Site:')); How do I get the value of the "select" from the controller? The most logic solution i

Re: ACL/tree problem rc3

2008-11-26 Thread AD7six
On Nov 26, 12:29 pm, Rob <[EMAIL PROTECTED]> wrote: > I did use my own slightly modified version of TreeBehavior->recover() > to repir tree and it was succesful, thou  for 5000 acos it had done > 500k queries to database and took about an hour to complete so i guess > its not optimized at all. >

Re: ACL/tree problem rc3

2008-11-26 Thread Rob
I did use my own slightly modified version of TreeBehavior->recover() to repir tree and it was succesful, thou for 5000 acos it had done 500k queries to database and took about an hour to complete so i guess its not optimized at all. Another thing is i cant afford repairing broken tree every time

Re: stay on current page once delete an item in CMS

2008-11-26 Thread Kyo
Try $this->redirect($this->referer()); --~--~-~--~~~---~--~~ 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 [EMA

Re: use tree behavior and link another model

2008-11-26 Thread AD7six
On Nov 26, 10:38 am, austin <[EMAIL PROTECTED]> wrote: > new to cake. tried searching for this topic but couldn't find anything > that addressed my situation. > - > tables: > - > CREATE TABLE IF NOT EXISTS `t_machine` ( >   `id` INT(11) UNS

Re: Best way to localize URL

2008-11-26 Thread AD7six
On Nov 26, 10:43 am, AD7six <[EMAIL PROTECTED]> wrote: > On Oct 2, 1:50 am, Joel Perras <[EMAIL PROTECTED]> wrote: > > > The best way is to localize the *content* on all your pages, and leave > > the URLs alone. Provide your users with a method of switching locales > > (i.e. a link), which calls

Re: Best way to localize URL

2008-11-26 Thread AD7six
On Oct 2, 1:50 am, Joel Perras <[EMAIL PROTECTED]> wrote: > The best way is to localize the *content* on all your pages, and leave > the URLs alone. Provide your users with a method of switching locales > (i.e. a link), which calls an AppController function / Component / > Whatever which then se

use tree behavior and link another model

2008-11-26 Thread austin
new to cake. tried searching for this topic but couldn't find anything that addressed my situation. - tables: - CREATE TABLE IF NOT EXISTS `t_machine` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(255), `description` t

Re: Changed table -> cake bake -> Views represent old table structure

2008-11-26 Thread volka
h, yes!!! thanks a lot!! On 26 Nov., 10:34, Adam Royle <[EMAIL PROTECTED]> wrote: > Probably cached... empty your tmp/cache/models and tmp/cache/ > persistent folders > > On Nov 26, 7:08 pm, volka <[EMAIL PROTECTED]> wrote: > > > > > Hey all, > > I'm quite new to cakePHP, so my questions migh

Re: Best way to localize URL

2008-11-26 Thread Pentla
I think the best way is use cake-related links with _() function. For example: array('controller' => _('pages', true), 'view' => _ ('display', true)) and then deal with the links in routes file. What do you think? Did you handle this issue? On Oct 2, 1:50 pm, Sliv <[EMAIL PROTECTED]> wrote: > >

saveField removes associations

2008-11-26 Thread AngeloZanetti
Hi all, i have a $hasAndBelongsToMany relationship between 'clubs' and 'competitions'. Now when I create a 'competition' i can allocate many clubs to it and save it and it saves correctly. The default for any newly created item is active=0, so after adding I want to activate the competition a

stay on current page once delete an item in CMS

2008-11-26 Thread AngeloZanetti
hi guys, I have quite a few listings and pagination for these listings. Now when a user deletes an item it redirects the user to the index page (page 1), which is incorrect. Therefore if a user was on page 3 and deleted an item on page 3 it should just delete the item and keep the user on tha

Re: Changed table -> cake bake -> Views represent old table structure

2008-11-26 Thread Adam Royle
Probably cached... empty your tmp/cache/models and tmp/cache/ persistent folders On Nov 26, 7:08 pm, volka <[EMAIL PROTECTED]> wrote: > Hey all, > I'm quite new to cakePHP, so my questions might be stupid... > > I had a table for which I created CRUD views and they worked properly. > Today I chan

Changed table -> cake bake -> Views represent old table structure

2008-11-26 Thread volka
Hey all, I'm quite new to cakePHP, so my questions might be stupid... I had a table for which I created CRUD views and they worked properly. Today I changed by table: I dropped some fields/columns and added a few new ones. After having this done, I did a cake bake and re-baked my Model, Views an

Re: A new cakesite...

2008-11-26 Thread AD7six
On Nov 26, 9:27 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote: > > The thing is suggestions are for content, not requests to get someone > > else to write something :). That may not have been your intention of > > course, but the submission itself had no real content. > > Aah, didn't know

Re: connecting the many to many dots - going from table1 -> table1_table2 -> table 2

2008-11-26 Thread kai
Thank you. Searching for 'modelizing the join table' brought me to the Mariano Iglesias article "Modelizing HABTM join tables in CakePHP 1.2: with and auto-with models". here: http://www.cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1 This t

About session_id

2008-11-26 Thread luigi7up
Hi all, can someone please tell me out of which session_id is made of? I need an answer because all of my visitor add products to a cart table and these entries must be unike for each visitor. What I mean is if visitor A adds 4 products to a cart within 2 hours or so they all have to be conected

Re: Help with populating SELECT drop down

2008-11-26 Thread luigi7up
@Alexandre C. I tried your code but all I got is one field from database table: id My debug array looks like this: [1]=> 1 [3]=> 3 And what I need is: [1] => array(sex=>male,size=>L) I found something about using your method and then set::combine or something similar but this seems too complic

Re: Help with populating SELECT drop down

2008-11-26 Thread luigi7up
Sorry, all.. I found a simple solution with foreach() etc. so I didn't come back after my last post. thank you all. Ill try solution Alexander offers too... @ grigri: thanks for suc a explination. Gri gri is a belaying device if someone wondered :) bye On Nov 21, 1:15 pm, Alexandru Ciobanu <[E

Re: A new cakesite...

2008-11-26 Thread dr. Hannibal Lecter
> The thing is suggestions are for content, not requests to get someone > else to write something :). That may not have been your intention of > course, but the submission itself had no real content. Aah, didn't know that, I probably did submit an empty section. But if one has to submit full con

Using PHP to export MySQL data MS excel files

2008-11-26 Thread liaogz82
Hi, I am looking into ways to use cakePHP to query into MySQL database to extract out the relevant data, then export out a report in MS excel that will include several pie charts. Such reports are to review by user on the browser first before it is being exported. Is there anyway to do it? --~--