Best practice for Auth / ACL / editing your own content

2011-07-20 Thread Shaz
At the moment I use Auth Component for users to login / logout - ACL is defined to sort between user groups (Guests, Users, Admins) - with obvious restrictions - Admin being able to access everything, the user can only access edit in the users controller and the guest being able to see just the dis

Setting a minMonth / minDay like minYear and maxYear?

2011-07-13 Thread Shaz
http://book.cakephp.org/view/1390/Automagic-Form-Elements ^^ It's possible for me to make sure a user doesn't choose beyond a minimum and maximum years, but whats the best way of putting limits on the months and days as well? Basically I want to make sure a user can only select a date in the futur

Only allow a single session per user account?

2011-06-24 Thread Shaz
Just wanted to ask what would be the best way of doing this? Essentially if a person logs in from one location, and then a while later from the other - I want them to immediately be logged out from the first location. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakeph

Re: I am using jQuery in my form BUT it relies on ProtoType to work???

2011-06-15 Thread Shaz
Use pure javascript vs the JS helper for jQuery - should sort it. On Jun 9, 8:48 am, OldWest wrote: > I could be missing something severely here, but this is just not adding up. > > I built an ajax form which is working perfectly fine with ProtoType and > Scriptaculous. > > I am migrating to Jque

Re: find list

2011-06-15 Thread Shaz
Try the "threaded" find? But "list" with fields specified correctly should do the job. Read the documentation carefully: http://book.cakephp.org/view/1022/find-list On Jun 11, 3:33 am, cake-learner wrote: > Can I get the search result so that it returns the id as key? > so if you are searching f

Re: How to inactive Acl

2011-06-15 Thread Shaz
http://book.cakephp.org/view/1545/Preparing-to-Add-Auth At the bottom it explains how to allow actions currently not initialised as ACO's. On Jun 13, 7:21 pm, taq wrote: > now I use acl component in my webapp > when I add new action I got you unauthorize to access this location > I must to build

Re: POST from external site

2011-06-15 Thread Shaz
Double check the URL you're sending the POST request to - and ensure the controller action is setup to receive it; especially if you're using Auth / ACL. Also post date in cake should be available in $this->params. On Jun 14, 3:53 pm, Ivan Rocha wrote: > Hi, > > I'm trying to integrate a CakePHP

Re: Validating HABTM

2011-06-15 Thread Shaz
I haven't actually made models for the Join table - I don't think you need to for a HABTM relationship On Jun 15, 1:41 pm, Rob Maurer wrote: > Interesting. What would happen if you put the validation in the model > for the join table? > > On Jun 14, 3:17 pm, Shaz wrot

Re: Validating HABTM

2011-06-14 Thread Shaz
that validation; where I only want the users to... Thanks! On Jun 14, 8:14 pm, hunny wrote: > Write the Validation Rule in Language Model instead of User Model > > On Jun 14, 9:56 pm, Shaz wrote: > > > > > > > > > I have User HABTM Language, and i want to ensure

Validating HABTM

2011-06-14 Thread Shaz
I have User HABTM Language, and i want to ensure during a User add / edit they choose a minimum of one language, upto a maximum of 3. In the user model, for $validate I've tried: 'Language' => array( 'multiple' => array( 'rule' => array('mult

Re: URL Params - Adding more value's for a key?

2011-06-05 Thread Shaz
e64_encode(serialize(array('value1', 'value2', 'value3'))) >  ) > ); > > and you can get the values with > > $values = unserialize(base64_decode($this->params['named']['yourkey'])); > > -- > Lep pozdrav, Tilen Majerlehttp://maj

URL Params - Adding more value's for a key?

2011-06-05 Thread Shaz
I know this is possible: site.com/controller/action/key1:value/key2:value etc Is there a way to add more than value to a key? For example: site.com/controller/action/key1:value1|value2|value3/key2:val1|val2/ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org

Re: Caching

2011-05-31 Thread Shaz
Use sessions to store your navigation data / parameters and call the appropriate method? On May 31, 1:44 pm, Jeremy Burns wrote: > I've raised a similar question before but got no responses, so I'll > try something more specific. > > I have an application that is pretty dynamic. With no caching t

Re: Error: Database table acos for model Aco was not found.

2011-05-30 Thread Shaz
Was it an sql dump or just the schema? It might be a case of rebuilding the ACL... On May 27, 5:11 am, 8vius wrote: > Hey all, I'm new to CakePHP and I'm using it at work. I have a Mac > running Mac OS X Leopard at work as well as at home and a PC at work > as well. > > I have the project I'm cur

Re: Form helper input select box customization

2011-05-30 Thread Shaz
Should be able to find what you're looking for at: http://book.cakephp.org/view/1390/Automagic-Form-Elements On May 29, 1:08 pm, Jae Choi wrote: > Hi all, > > Is there a way we can show multiple columns to select when selecting > belongsto values in edit.ctp view rather than just column named wi

Re: One-way relationship

2011-05-30 Thread Shaz
You need the relationship both ways: Item hasOne Unit Unit belongsTo Item Add a few items and units into the database. Then go back to the item controller, edit action and make sure you get a list of all the units: $this->Item->Unit->find('list')); Hopefully that helps. On May 29, 11:53 pm, M

Re: Saving ARO taking around 10 seconds, processing tree behavior.

2011-05-30 Thread Shaz
Index it! http://www.mainelydesign.com/blog/view/speeding-up-cakephp-acl-component On May 30, 7:29 pm, Tufla wrote: > After apply the change, the reading process has been improved a > little, but the writing process continue taking a lot time :S BTW I > checked and the AROS table is not fragment

Re: Find with $hasAndBelongsToMany

2011-05-30 Thread Shaz
I've just posted a similiar query! Googling around has given me the bindModel() method - which you can read at the bottom of the page here: http://book.cakephp.org/view/1044/hasAndBelongsToMany-HABTM But I wasn't able to get it to work for me. There's also a method using manual joins and creatin

HABTM Pagination

2011-05-30 Thread Shaz
I have the following relationships (habtm both ways): User HABTM Groups User HABTM Events User HABTM Locations So for example - I want to get users that belong to groupA, groupB and locationX and paginate the results - whats the best way of implementing it? I'm trying to avoid using bindModel(),

Re: Use a mysql read-replica in a high traffic site?

2011-05-09 Thread Shaz
alancing-suppo... > > On May 6, 3:18 pm, Shaz wrote: > > > > > > > > > Just wanted to ask if anyone knows how best to do this - essentially I > > want to be able to send all the cakephp mysql selects (read) to a read- > > replica database and all t

Use a mysql read-replica in a high traffic site?

2011-05-06 Thread Shaz
Just wanted to ask if anyone knows how best to do this - essentially I want to be able to send all the cakephp mysql selects (read) to a read- replica database and all the inserts/deletes/updates (writes) to the master database. For a bit of background - I've been tasked to build a site that will

Re: Small help required...

2011-03-21 Thread Shaz
http://book.cakephp.org/view/1414/checkbox http://book.cakephp.org/view/1031/Saving-Your-Data ^^ Have a quick read - it's explained there. On Mar 21, 10:45 am, Tapan Kumar Thapa wrote: > Hello Group, > > I am stuck in one situation and i don't know how to come out from that > issue. > > I have c

Re: searching recursively doesnt work

2011-03-21 Thread Shaz
Can you put up your $this->find() statements and the results you get with them? I would've thought (in the Agreement Model) you could do something along the lines of this->Definition->Article find(all) conditions(article.field => '%string%') contain( user, agreement, definition) groupBy(definition

Re: needed opinion from experienced cakephp user

2011-03-20 Thread Shaz
http://www.notgoingtouni.co.uk - on it's launch it took traffic more than what you describe and cakephp didn't crumble one bit. Just make sure your hosting is up to scratch and be really good friends with a sys admin! On Mar 20, 11:39 pm, cricket wrote: > On Sun, Mar 20, 2011 at 7:11 PM, Miloš V

Core Test Groups (All tests) Error

2011-03-20 Thread Shaz
I get the following when I try and run 'All Tests': Fatal error: Cannot redeclare class Article in /usr/local/cakephp/cake/ tests/cases/libs/model/models.php on line 283 I've setup cake slightly different (don't know if that's a factor - but you can see how i've done it here: http://groups.google

Advanced Install > Upgrading to 1.3.8

2011-03-20 Thread Shaz
Hi all, I've followed the instructions at http://book.cakephp.org/view/915/Advanced-Installation and essentially done the following on my Mac: 0 - Enabled mod_rewrite in my httpd.conf 1 - Forked CakePHP from git (cakephp/cakephp) into /usr/local/cakephp 2 - Setup Aliases for the cake console (ag

Re: Editor for Comments

2011-03-10 Thread Shaz
http://ckeditor.com/ - I have a minimalist version of it working on a few of my cakePHP websites. On Mar 10, 2:22 pm, rethab wrote: > You might want to use this PHP > function:http://ch.php.net/manual/de/function.nl2br.php > > As for WYSIWYG Editors: I thought TinyMCE could be used pretty light-

TDD Curiosity

2011-03-10 Thread Shaz
Just a random thought - I've been helping a friend get to grips with cake and I know later on he *needs* to be introduced to test-driven development;; wouldn't it be more interesting it to teach the methodologies the other way around? For example, the first thing he would ever write would be a test

Re: HABTM: has a related data

2011-03-10 Thread Shaz
Have you tried $this->Lot->paginate() ? Just seems like you're skipping the relationship if you're trying to paginate 'Lot' in 'Watches'? On Mar 7, 11:44 am, Angelo wrote: > Hello, > > I have a big problem, i've got the following structure: > > var $hasAndBelongsToMany = array( > >           'Ref

Re: HABTM: has a related data

2011-03-10 Thread Shaz
Have you tried $this->Lot->paginate() ? Just seems like you're skipping the relationship if you're trying to paginate 'Lot' in 'Watches'? On Mar 7, 11:44 am, Angelo wrote: > Hello, > > I have a big problem, i've got the following structure: > > var $hasAndBelongsToMany = array( > >           'Ref

Re: How to validate multiple fields with the same name?

2011-03-10 Thread Shaz
Sounds like a challenge! The only way I can think of is to write a custom validation rule that checks each of the submitted Product Names - have a read at: http://book.cakephp.org/#!/view/1179/Custom-Validation-Rules Let us know how you get one! Might be handy in the future... On Mar 9, 2:30 am,

Re: image layout cant be seen after installation

2011-03-10 Thread Shaz
http://book.cakephp.org/#!/view/917/Apache-and-mod_rewrite-and-htaccess On Mar 10, 2:24 pm, rethab wrote: > Does look like mod_rewrite was not activated. Did you check the > activated modules on your server? > > On 10 Mrz., 06:41, cake_beginner wrote: > > > i dont know what's the problem, > > i

Re: Site Development from Start to Finish

2010-11-12 Thread Shaz
It's better practice to use model relationships rather than $uses. i.e. $this->User->Drug->find(); On Nov 12, 4:30 pm, naidim wrote: > For the homepage controller, if User and Drug are not related but you > want to use those models, you have to include them both. Maybe I > should specify that, th

Build an API?

2010-11-10 Thread Shaz
Just wanted some idea's on how you would build an API for your application in Cake? An example of what I'm trying to achieve: Team A logs on - adds their players, what they scored and how on their site. Team B logs on and does the same. Both sites connect to each other and show the relevant scor

Re: Paginated Model Question

2010-11-10 Thread Shaz
Basically whats easier for you - can't think of any "standards" for pagination. Keep in mind that you may want to expand on it later on (add more conditions, fetch more data etc) so keep it flexible. On Nov 7, 5:12 pm, "Dave Maharaj" wrote: > Not sure if I have been looking at this all wrong. But

Re: Is there a better web interface for SimpleTest?

2010-11-10 Thread Shaz
I've only just gotten started with TDD - don't think many folks on here use the tests, but I do know exactly what you mean. I haven't come across anything better - it might be a case of having to improve it ourselves... On Nov 9, 1:16 pm, psybear83 wrote: > Hi all > > CakePHP's web interface is n

Re: Paginator->sort() on associated model field

2010-11-10 Thread Shaz
Are you using any containable behavior? Or is the data being passed along correctly when using $this->Paginate() - the main error that jumps out me is: Argument #2 is not an array. On Nov 9, 6:43 pm, "J. Argyl Plath" wrote: > My User model belongsTo Department. When looking at a view of Users > I

Multiple Forms in the same controller / model to be validated differently?

2010-09-08 Thread Shaz
Here's an old article that shows how to do exactly what I want - but doesn't quite work: http://bakery.cakephp.org/articles/view/multiple-forms-per-page-for-the-same-model Any other way of using CakePHPs form validation on different forms? I have an add, edit function/view/form for my controller

Re: cake flashing 2 different flash messages.

2010-09-08 Thread Shaz
Can you put up your code? ... crud really shouldn't be defined in app_controller - rather in the app/user_controller, it might be a headache lateron On Sep 6, 7:37 am, Ernesto wrote: > Hello. > > i have a problem that can't resolve. > > my app_controller::beforeFilter has a simple authorization s

Re: HELP! Design Review & Risk Management topics required

2010-09-08 Thread Shaz
Google around - there's quite a few. Best bet would also be to search Google Scholar / ebooks, or pop down to your local library. On Sep 7, 8:35 am, Kalyana Yogam wrote: > Hi, > > I have to take 2 one hour sessions on the following topics: > > * Project Design Review > * Project Risk Management >

Re: Cakephp and Facebook Help

2010-09-08 Thread Shaz
Steer clear of facebooks widgets and take the time out to learn their new protocol. It took me about 4 hours to get the swing of it, and by the end of the day I had properly integrated facebook into a website (pulling data, publishing information and so forth). http://developers.facebook.com/docs/

Re: Pass true or false as condition

2010-09-08 Thread Shaz
Also if I remember correctly cakephp doesn't read bolean from a database? http://nuts-and-bolts-of-cakephp.com/2008/10/06/cakephp-mysql-tinyint1-confusion/ On Sep 7, 10:11 pm, Miles J wrote: > Couldn't you just pass 1 and 0? > > Also your argument is backwards. True should be 1 and false shoul

Re: Interfacing with Android app (and/or iPhone)

2010-07-27 Thread Shaz
> * I expect to exchange data via JSON (services already in place for > some JS and Flex features) but as the request is not coming from a > browser, how do I get info about the user / phone? Some info are > contained in the HTTP request? How do I parse them? > * Authentication: which the best (an

Re: Problems with "controller not found"

2010-07-27 Thread Shaz
Create the DB table and use cakebake. On Jul 26, 10:44 pm, Anderson Valongueiro wrote: > Hi, guys! > > I have a problem. I never before use the pages_controller, because > never need this. > > But today i needed create the pages_controller, by first time, and > create the packages_controller too.

Re: Login Redirect

2010-07-27 Thread Shaz
Read the 1.2 to 1.3 migrating guide - a few things have changed here and there, enough to cause a few headaches but easily updated. On Jul 27, 12:10 am, "Dave Maharaj" wrote: > I am upgrading from 1.2 to 1.3 and when I try to login I get redirecting > forever message. I never changed anything fro

Re: Problem with Login Redirect

2010-07-27 Thread Shaz
Where does loginRedirect redirect you at the moment? Or no redirects at all? On Jul 27, 6:16 am, sebas46825 wrote: > hello, i have a problem with the login redirect i dont no why but when > i write the loginRedirect it not redirect me, just show me the login > page and i want to redirect to anoth

Re: CakePhp & Wordpress Integration

2010-07-27 Thread Shaz
You would be better off building the blog yourself using cake rather than integrating wordpress :) On Jul 27, 2:58 pm, euromark wrote: > i once stumpled upon > this:http://bitbucket.org/pixelastic/caracole-bbpress/src/a87149cbba0e > > maybe something similar could be created for wordpress? > > O

Re: $this->paginate() inside a Model?

2010-07-14 Thread Shaz
(Sorry I meant from my Controllers to my Models!) On 14 July, 12:12, Shaz wrote: > With my current craze of moving all logic from my models to my > controllers, a slight problem has risen - namely I can't seem to use > "$this->paginate()" in a Model function t

Re: updating views in ajax

2010-07-14 Thread Shaz
Read up on "call backs" and the cake's ajax "afterRender" or beforeRender/load - it'll give you a better understanding on how best to you use AJAX. On 14 July, 08:37, engine wrote: > Hi friends, > > i dont know this questions has been asked before or maybe straight forward. > But i am not able to

$this->paginate() inside a Model?

2010-07-14 Thread Shaz
With my current craze of moving all logic from my models to my controllers, a slight problem has risen - namely I can't seem to use "$this->paginate()" in a Model function thats called in a controller. $this->find() works perfectly find, and I'm trying to replace $this- >find( 'all', $conditions )

Re: saveAll changing $this->data

2010-07-13 Thread Shaz
Oo interesting - it's removed 5 from 'asked' ad added it onto saving and confusion. Post up the $this->save() code so we can see whats going on. On 13 July, 12:01, tersmitten wrote: > I'm trying to save my $this->data which is (already) a correct array. > But when I do and look at my queries it l

Re: Another model displayField

2010-07-12 Thread Shaz
class Model extends AppModel { var $name = 'Model'; var $displayField = 'name'; } Change 'name' to whatever you want to be shown (i.e. 'title' etc) On 10 July, 20:58, Samueljslg wrote: > Hello friends, I am starting with cakephp, I have a problem, you want > to show it in the fie

Re: Evolution of mini-controllers - thoughts??

2010-07-08 Thread Shaz
>From my understanding - elements are just there as an option to show common views - such as a site with a top-level navigation bar that's the same throughout a website. I'm not sure why you would wish to extend or make us of them as much as you explained above - and using your analogy of trying to

Re: Tree Reorder: What Does it Do?

2010-07-08 Thread Shaz
Nope sorry - I haven't any points during which I'd need to reorder a tree, and I'm struggling to think of where I'd need do it. On Jul 8, 1:02 pm, DragonFlyEye wrote: > Bump. Does anyone out there have any experience with this? > > On Jul 7, 9:04 am, DragonFlyEye wrote: > > > > > Better formatti

Re: consulting associations, post comments users commentaries

2010-07-08 Thread Shaz
User hasMany Post User hasMany Comment Post hasMany Comment Post belongsTo User Comment belongsTo Post Comment belongsTo User On Jul 6, 4:43 pm, Vinicius Núñez wrote: > How are you? Which way can I show a post, its comments, and users that > commented them? Do you know I'm talking about, don't

Re: Controller action calling another model, how to override ACLS?

2010-07-08 Thread Shaz
Not that I can think of - but it is a controller that should be collecting data from models and passing them onto a view - not the view trying to access a different controller/model. And you can call other models for data from within a model/controller, provided the recursive relationships are set

Re: Can Cake do this?

2010-07-08 Thread Shaz
Easily doable in CakePHP - it may take you a week or two to get around to Cake's way of doing things but stick with it. On Jul 7, 2:47 am, maxarbos wrote: > I am just getting into learning about cake and wanted to know if I am > going to be able to do the things I am hoping it can do, easily. > >

Re: Cannot get this find() to work :(

2010-07-08 Thread Shaz
http://book.cakephp.org/view/74/Complex-Find-Conditions On Jul 8, 8:21 am, Ernesto wrote: > Hello. > > i have this situation: > > Order hasMany Insertions hasOne Article > > i'm working in OrdersController > i want lo load all Articles with at least one Insertion in a specific > Order. > results

Re: Add to model conditions

2010-07-08 Thread Shaz
Use ternary php operators to check what the user selects, put them into a variable and attach that into the conditions; $condition = isset($this->data['Search']['Stars']) ? array('Offer.flag_stars' => $this->data['Search']['stars']) : ''; $results = $this->Offer->find('all', array(

Re: can't update data that is entered in form

2010-07-08 Thread Shaz
Also do a "Cake Bake" on a model to see how cake itself does pretty basic Create/Read/Update/Delete. On Jul 8, 10:17 am, Jon Bennett wrote: > > now if i hit the save button i get the error: > > UsersController::__updateProfile() cannot be accessed directly > > > whats wrong here? > > Cake assumes

Re: can't retrieve data from a form

2010-07-08 Thread Shaz
The form needs to be created with a name and then it also needs to end: $form->create('FormName'); $form->input( ... etc etc ); $form->end('Submit'); And you should be able to access your form data via $this- >data['FormName'][ inputfield ]. On Jul 8, 1:31 pm, Tomfox Wiranata wrote: > hi, > >

Re: filtering

2010-07-08 Thread Shaz
What sort of filtering and for what are you after? On Jul 8, 10:08 am, james wrote: > Hi I am also looking for some advice on filtering. Are these the best > tutorials? > > thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

Re: am i doing it right? for this question AND overall...

2010-07-06 Thread Shaz
Not quite what CakePHP would like you to do - have a read of the tutorial for a simple ACL application. http://book.cakephp.org/view/641/Simple-Acl-controlled-Application On Jul 5, 5:13 am, randy wrote: > it feels kind of yucky... > > in order to get my auth+acl setup working, i had to subclass

Re: How to use sql 'between' command with CakePhp requestAction()

2010-07-06 Thread Shaz
requestAction() is bad! Implement recursive relationship between models and use the find() with contain and conditions! On Jul 5, 2:38 pm, Ahmet Kemal wrote: > Hello, > > I have an element that grabs data from mysql. Here is my working code: > >     $this->requestAction('posts/index/sort:id/direc

Re: Inheritance of custom class

2010-07-06 Thread Shaz
CakePHP follows the MVC pattern. Each controller has an associated model and a view - you can specify in the model which database table to use, or to not use one at all - but unless you specify, you will keep getting errors. On Jul 5, 3:57 pm, "vaugh...@switchdesign.com" wrote: > Im really new to

Re: Something like ActiveMerchant?

2010-07-06 Thread Shaz
Interesting - I have come across ActiveMerchant when doing RoR applications - but never thought about something similar mostly because the API support of most payment gateways is pretty straightforward using php... On Jul 5, 11:51 pm, "iamcam (Cameron Perry)" wrote: > Has anyone seen anything lik

Re: Cakephp ACL Permission

2010-07-06 Thread Shaz
You need to either manually add the ACO to the database or run the build_acl() function provided in the tutorial. On Jul 6, 11:03 am, malu star wrote: > I have add a function named 'add'  in one of my controlller and then i > called that action that time i got this Notice > > ACO permissions key

Re: fatal error in create()

2010-07-06 Thread Shaz
Try $this->aro->create() instead. On Jul 6, 1:12 pm, Kanwal wrote: > i have one controller in which i have following function: > > var $components = array('Acl'); > function anyaction() > { >         $aro =& $this->Acl->Aro; > >         //Here's all of our group info in an array we can iterate th

Re: Auth 1.3.0 Auth->loginAction

2010-06-30 Thread Shaz
Are you following: http://book.cakephp.org/view/172/Authentication ? On Jun 30, 11:27 am, "brianclark...@btconnect.com" wrote: > Hi > > I have configured the Auth component and its working fine. I need to > save a User associated model in the session. > I assume the best way to do this is to ca

Re: image and a tag problem without mod_rewrite

2010-06-30 Thread Shaz
You'll have to use $_SERVER[] to get your path: http://php.net/manual/en/reserved.variables.server.php On Jun 30, 2:45 pm, kaushik wrote: > I have developed my site in a server where mod_rewrite and .httaccess > are available. I used '$this->webroot' variable for a tag and img path > extensively

Re: Functions in View could not able to load Helpers?

2010-06-30 Thread Shaz
.$html->link[$catName, You're using a square bracket? Should be: .$html->link($catName, On Jun 30, 5:13 pm, saidbakr wrote: > Hi, > I have a little function in one of my views. This function could not > able to use helpers. For example: > > //add.ctp > > // some html > function printCat(){ > >

Re: CakeFest 2010, who is going?

2010-06-30 Thread Shaz
It's the fear of the airfare that's more dominant! Fingers crossed my little start-up will kick off, and be able to come to the next one :) On Jun 30, 3:45 pm, "Larry E. Masters aka PhpNut" wrote: > Shaz, > > Are you afraid to fly? :) > > -- > /** > *

Re: CakeFest 2010, who is going?

2010-06-30 Thread Shaz
I'd come if it wasn't so far away from London! On Jun 30, 3:38 pm, "Larry E. Masters aka PhpNut" wrote: > Just want to start a thread and see how many people on the google group > would like to attend or are planning to attend CakeFest 2010? This is the > largest gathering of CakePHP developers a

Re: Session data not being displayed

2010-06-30 Thread Shaz
Very strange - can you put up the code from a controller where the session does work? I'm assuming they're identical - or they should be. Also it might be a case of overkill by using both: App::import('Core', 'l10n', 'Sanitize', 'CakeSession'); And: public $components = array('Session','Cookie'

Re: Need CSV import: best practices?

2010-06-30 Thread Shaz
CakePHP follows the MVC design pattern - most of the heavy lifting should be done in the model with the controller just being the intermediary between the model and view. Remember: Fat Model, Skinny Controller http://teknoid.wordpress.com/2009/01/06/another-way-to-think-about-mvc/ On Jun 30, 12:2

Re: Auth::authorize - controller -- How to handle guests?

2010-06-29 Thread Shaz
You can add $this->Auth->allowedActions = array('action'); to the app_controller.php for all controllers rather than having to set it for every single controller. Can't think of anything else other than that. On Jun 24, 2:52 pm, Melanie Sommer wrote: > Hello, > > I am using AuthComponent with au

Re: Auth, login, own validation of password

2010-06-29 Thread Shaz
Make a new action in the controller, call it "customLogin" or whatever you want, and in there call the function in the model (below), which would return true/false, and if(true){ do this } else { do this } For the model: Make a new function to be called in the controller, use $this- >field(Tablena

Re: find output array!

2010-06-29 Thread Shaz
Try find('list', array(contain => array( 'Model1', 'Model2' ))); On Jun 29, 1:23 am, saidbakr wrote: > Hi, > From documentation, find may output array like the following: > > Array > ( >     [0] => Array >         ( >             [ModelName] => Array >                 ( >                     [id]

Re: Cookies from CAKE and other branding

2010-06-29 Thread Shaz
... adding to the above, what's wrong with a little bit of CakePHP branding? Most clients I've had don't particularly care about the code as long as it works, let alone know what a framework is On Jun 29, 1:59 pm, AD7six wrote: > On Jun 29, 5:01 am, Vangel wrote: > > > I am quite sick of cak

Re: Need some help

2010-06-29 Thread Shaz
Can you be a bit more detailed on what you are trying to achieve? Outputting html in php is a simply matter of using echo ' '; On Jun 29, 7:25 am, sunny wrote: > Can anyone tell me how to add an html file to php script. Check out the new CakePHP Questions site http://cakeqs.org and help ot

Re: Can I read a session variable inside the model?

2010-06-29 Thread Shaz
There's been a lot of discussion about this - use the search box on the top right. I personally tend pass the session details as an argument through the controller: --- Model --- function whatEver ($session) { manipulate $session['User']; return something; } --- Controller --- function v

Re: Which is the best hosting server for CakePHP?

2010-06-29 Thread Shaz
It's actually pretty cheap now to get your own VPS, and set it up exactly how you want to. I can recommend both HostingZoom + 1&1, faultless service over a number of years for an excellent price. On Jun 29, 5:59 pm, nurvzy wrote: > I'm a fan ofhttp://www.downtownhost.com. > > On Jun 28, 1:27 am,

Re: Is "Beginning CakePhp from novice to professional" still valid with CakePhp version 1.3.2?

2010-06-29 Thread Shaz
Used the book myself on CakePHP 1.3.2 - had no problems. On Jun 29, 7:10 am, Jeremy Burns | Class Outfit wrote: > There are more differences than that, but if you read the migration guide > (http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3) you'll > very quickly be able to mo

SEO URL's (Slug?)

2010-06-22 Thread Shaz
Anyone have any documentation on the CakePHP slug? Can't seem to find much on it - just trying to get my URL's all nice and pretty for google without having to mess with Routing / creating seperate helpers and so forth to get 'em tarted up. Check out the new CakePHP Questions site http://cakeqs.or

Developing this darn function!

2010-06-22 Thread Shaz
More of a PHP / programming development question: I have an article that has (Category, Type, User, etc). Below the post I want to show the related articles, but I want them to relate together via the common attributes between articles (Category, type, user etc). At the moment I have a find('all'

Re: Mixing Sessions and Cookies?

2010-06-22 Thread Shaz
Cake cookies are session cookies. If you want to set browser cookies, use the php setcookie() function. http://php.net/manual/en/function.setcookie.php On Jun 21, 5:50 pm, DragonFlyEye wrote: > My cookie variables: > >         function beforeFilter() { >                 $this->Cookie->name = 'ma

Re: forms

2010-06-22 Thread Shaz
Try using $this->Form->create() instead of $form->create() in the view. Also make sure your form helper is enabled in the model. On Jun 22, 9:36 am, mirfan wrote: > This is the script > > $form->create("User",array('controller'=>'users','action'=>'register'));?> > >                              

Re: I want to create messaging system like facebook

2010-06-22 Thread Shaz
Do you already have a schema going for different users? Then it's just a matter of creating a new table with id, user_id, recipient_id, title, and message; cake bake the model/controller/view - add some authentication and checks to ensure user_id is taken from a session, recipient ID as an ajax pre

Re: efficiency vs conforming to standards

2010-06-18 Thread Shaz
Also with the find() make sure you have recursive set to -1 or 0 to cut back on the excess data collection. On Jun 18, 9:53 am, Shaz wrote: > $this->User->Photo->find() perhaps? > > From my understanding we should use the model associations (which > provide an efficient sq

Re: efficiency vs conforming to standards

2010-06-18 Thread Shaz
$this->User->Photo->find() perhaps? >From my understanding we should use the model associations (which provide an efficient sql query if i remember correctly) first to see if it gives us what we want, otherwise use findall/contain. On Jun 18, 7:21 am, "Alan Asher" wrote: > I have a users model a

Re: Automagic Form (Drop down list)

2010-06-16 Thread Shaz
Whoa! So much info! Thanks all; beginning to like cake more and more day by day. I settled for using $displayField in the model; am trying to keep the controller as skinny as possible. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions

Re: cakephp console, cake bake

2010-06-16 Thread Shaz
http://cakephp.org/screencasts/view/7 On Jun 15, 8:32 pm, jjnn wrote: > Do i have to change the enviroment path to my cakephp console > everytime i need to bake stuff on a new project? > > so like > /home/jonas/lampp/htdocs/cakephp_projectA/cake/console > /home/jonas/lampp/htdocs/cakephp_projectB

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://

Re: Containable() not working for $this->Model1->Model2->find('', array('contain') => 'Model3');

2010-06-03 Thread Shaz
      'contain' => array('Article', 'CommentRank'), >       'conditions' => array('Comment.article_id' => $id) >    ) > ); > [/code] > That should give you the comments in a threaded format, with the > article and comment

Re: How to pass array value from one ctp file to another ctp file

2010-06-02 Thread Shaz
Use elements, you can pass values between them: $this->element('whatever', $valuetobepassed); On 2 June, 13:16, Narendra Padala wrote: > Hi flocks, > I am,  new to cake php  actually i want display one report, in the down i > put the link download link for Excel. > > For that purpose , i have to

Re: Newbie question: URL linking

2010-06-02 Thread Shaz
Try: link($html->image('linkedin.gif', array ('alt' => 'LinkedIn' , 'align' => 'bottom')), "{$user['social_media'] ['linkedin']}", array(), null, false); ?> Essentially store the value you wish to act as a URL in a variable and call that variable. Also remember PHP treats

Re: Router not working as expected

2010-06-02 Thread Shaz
It should be: Router::connect( '/blog_post', array( 'controller' => 'posts', 'action' => 'view', 5 ) ); Notice it's only one array. On 1 June, 23:07, blasto333 wrote: > Router::connect( >     '/blog_post', >     array('controller' => 'posts'), >     array('ac

Re: saveAll/Save not saving associations

2010-06-02 Thread Shaz
Course has many course_tees CourseTee belongs to course I thought all model class names be singular and camel cased; as in: Course has many CourseTee CourseTee belongs to Course Might help? On 2 June, 01:05, jjunior wrote: > I'm having a problem trying to save/update some associated data. I've

Re: Containable() not working for $this->Model1->Model2->find('', array('contain') => 'Model3');

2010-06-02 Thread Shaz
se the containable behaviour... On 1 June, 18:30, John Andersen wrote: > I do hope it is only a typo in the post and not in your code! > > [code] > $this->Model1->Model2->find( >    'threaded', >    array('contain' => 'Model3') > );

Re: Paginator, belongsTo and a model using data from an external DB

2010-06-01 Thread Shaz
I'm hoping you've set the reverse relationships too? Customer hasMany Order But I think you may have to use the HABT relationship between Shipments and orders. On 31 May, 16:42, Ernesto wrote: > hello. > > my app has 3 models: > > - Order belongsTo Shipment > - Order belongsTo Customer > > Cu

  1   2   >