Re: Plugin callbacks and controller hooks

2009-12-18 Thread Jamie
To add to the options already presented: I wrote a Plugin Callback component that executes callbacks in special plugin callback classes: http://jamienay.com/2009/11/an-easy-plugin-callback-component-for-cakephp-1-2/ This works well for the large-scale CMS I built at work. Walther's solution also

Re: Applying permissions in fetch time?!

2009-12-18 Thread Vahid Alimohamadi
Last night i thought on this problem and I solved it with this logic: ( SQL Syntax) [code] SELECT * FROM posts WHERE id IN( SELECT foreign_key FROM acos WHERE id IN( SELECT aco_id FROM aros_acos WHERE aro_id=(SELECT id FROM aros WHERE alias='User:2') A

Re: Plugin callbacks and controller hooks

2009-12-18 Thread Walther
I have done something similar for a CMS that I am busy writing. First look here: http://cakealot.com/2009/04/eventful-a-cakephp-event-system/ That was my inspiration. Then look here: http://github.com/dakota/CMScout/tree/master/controllers/ That is my event component. Basically, each plugin has a

RE: HABTM Additional Field / Checkbox

2009-12-18 Thread Dave
I tried what you said with unbinding then bind as hasMany but all I get is the skills they selected. I have my $list = find list which returns all the skills then my data find has the selected skills. But cant get the selected skills to be pre-checked and cant get the full list to appear although I

Re: Help with Redirect

2009-12-18 Thread kdubya
Oops - I hit Send before I meant to. Anyway, the line of code you posted: link('edit', array('action' => 'edit', 'id' => $compatible['Compatible']['id'], 'product_id' => $product['Product']['id']))?> What line of HTML does it generate? I think you will find the URL generated is not what you want.

Re: Help with Redirect

2009-12-18 Thread kdubya
You are going to have to post more of your code before we can help more. What is on line 24 of edit.ctp? Show the entire edit() function from your compatibles controller. The line of code you supplied: >link('edit', array('action' => 'edit', 'id' => $compatible['Compatible']['id'], 'product_id' =>

ajax, can't find bug!

2009-12-18 Thread Tom
I can't find bug in this source code? Help! /Nothing happens when I select a client/ Thanks. --- /views/elements/activity_filter.ctp --- Select Activities create('Activity', array('type' => 'get', 'action' => 'select')); ?> input('

Pagination with 2nd order recursive conditions filter

2009-12-18 Thread thomaus
Hi, I have to do a 2nd order filter por pagination. My pagination var: var $paginate = array( 'limit' => 10, 'fields' => array('Campaign.id', 'Campaign.name', 'Campaign.description'), 'order' => array( 'Campaign.id' => 'asc'), ); My controller function: $thi

RE: bindModel, unbindModel, updateModel?

2009-12-18 Thread Dave
Im no expert but I have my model function to get recent posts something like this $this->ModelName->getSomeData($id, $count, $order, ???); And in the model function 'count' => $count So depending on the controller / view I need 5 posts, other grab 10 and just change the count to what I need. Da

CakePHP and subdirectories

2009-12-18 Thread Kareem Sabri
Hello, I'm trying to rebuild my application using CakePHP, but I have a relatively unique issue (I think). I need to be able to create numerous subdirectories and have them all inherit the same functionality as the webroot. So, for example, I have a class Users. Then I can go to http://mydomain.

bindModel, unbindModel, updateModel?

2009-12-18 Thread Alan Asher
Has anyone run across a function similar to bindModel and unbindModel which to me would be called updateModel() Basically, I've run across several situations where I just need to update the model's limit or ordering and finding that I have to use the bindModel and repeat everything that was in

Re: Plugin callbacks and controller hooks

2009-12-18 Thread Aargh
In the mean time i found this : http://teknoid.wordpress.com/2009/08/10/observer-pattern-the-cakephp-way Should be easy following the same idea to make the interesting apps controllers "observable", the interested plugin controllers "observers", and based on some observers's side config to initia

Re: Help with Redirect

2009-12-18 Thread Dewayne Pinion
On Fri, Dec 18, 2009 at 12:13 PM, kdubya wrote: > Try either: > $this->redirect(array('controller' => 'compatibles', 'action' => > 'index', 'product_id:'.$product_id)); > which should result in a URL like: > productsadmin/compatibles/index/product_id:3365 > This would be the right address, but

Re: Plugin callbacks and controller hooks

2009-12-18 Thread Aargh
I already used them. Right now I am starting a new project, which I would like to opensource, so other developers can write plugins without messing with the core app. So instead of "to install this plugin add x lines in the user controller file in before filter function and y lines in the posts con

Re: Default __() parameters causes problems

2009-12-18 Thread Miles J
Because your not returning from __(). On Dec 18, 9:07 am, djogo wrote: > Yes we're getting issues. Specially when we use __ and sprintf > combined, as in > > > > In cake1.2 it renders: > > "djogo Username:%s" > > Speaking of that, I would like to post a (perl) script I used to > change _(..)  

Re: Best practise to manage user's selections and user's views

2009-12-18 Thread John Andersen
I use the following ER model in order to register when an item was viewed, downloaded, etc. Collection HABTM Item Collection hasMany CollectionItem Item HABTM Collection Item hasMany CollectionItem So I have the following CakePHP models: Collection CollectionItem Item The Collection is a classif

Re: Plugin callbacks and controller hooks

2009-12-18 Thread Miles J
I don't see why you just don't use the callbacks? On Dec 18, 8:04 am, Aargh wrote: > Hi, > > I know how to use them. The idea was to have something like > > MyController { > > beforeFilter () { > defineHook('myHook'); > > } > } > > And in the plugin to have something like { > > PluginController {

Re: Database encryption & security

2009-12-18 Thread WhyNotSmile
I am doing this for a client. He has access to the database through his control panel of his web host. I want it to be encrypted so he can't read the data. It's not that I don't want him to see it, but that there is data which clients might not want him to see. I also have access to the databas

Re: Help with Redirect

2009-12-18 Thread kdubya
On Dec 17, 3:30 pm, Dewayne Pinion wrote: > Ok, apparently I am braindead, because I am still not grasping the concept > of a redirect in cake. I have this page: > >    productsadmin/compatibles/index/product_id:3365 Where does the above syntax come from (specifically the "product:3365" part)? Ty

Re: Default __() parameters causes problems

2009-12-18 Thread djogo
Yes we're getting issues. Specially when we use __ and sprintf combined, as in In cake1.2 it renders: "djogo Username:%s" Speaking of that, I would like to post a (perl) script I used to change _(..) to __(..). It would be improved, adding (or removing) a ",true)" to the end of the call. --

strange situation

2009-12-18 Thread kicaj
I create very simple Cake search, I use find function, and i get different result when I use 'www' in url...!? Check: http://pcb-polska.pl/szukaj/wzornik (empty) http://www.pcb-polska.pl/szukaj/wzornik (many results) Searcher in the right side, You can use many words in polish for check: dyspersj

Re: Plugin callbacks and controller hooks

2009-12-18 Thread Aargh
Hi, I know how to use them. The idea was to have something like MyController { beforeFilter () { defineHook('myHook'); } } And in the plugin to have something like { PluginController { function addCustomLogicToHook(&$controller,$hook,$params){ } } so the requestAction("/bla/bla/addCustomLogi

Re: Default __() parameters causes problems

2009-12-18 Thread euromark
the switching process will be causing quite a few new bugs i imagine :) at least without really good regexp substitutions On 18 Dez., 16:43, djogo wrote: > That's good news indeed. > > In which version this feature is planned to be in? > > I guess I'll just use a patched version of cake 1.2.5 un

Re: Default __() parameters causes problems

2009-12-18 Thread djogo
That's good news indeed. In which version this feature is planned to be in? I guess I'll just use a patched version of cake 1.2.5 until this version comes out. On Dec 17, 10:45 pm, euromark wrote: > nice to hear that > especially as it is used in controllers, components etc too > and there the

Re: How to implement Comet in CakePHP ?

2009-12-18 Thread nacho4d
I have been search this (comet in cakephp) for some time, but I couldn't find anything really helpful I would appreciate your help. ;) On Dec 17, 5:22 pm, cherif_Gsoul wrote: > hi, you have to learn more about cakephp is not so hard to learn > ajax's implementation in  cakephp who is made to wor

Re: Help with Redirect

2009-12-18 Thread Foroct
I'm in the same boat as Dewayne. If you are on the edit page for that product and click submit doesnt the product id get passed into the controller? If so then the redirect specified $this->redirect(array('controller' => 'compatibles', 'action' => 'index', 'product_id' => $product_id)); should

Re: Plugin callbacks and controller hooks

2009-12-18 Thread robustsolution
m sorry, captcha plugin is also considered as a very small separate application plugin, I gave a wrong example. but you still have the option number 2 but you need to specify the plugin key/prefix in the url array/string On Dec 18, 1:54 pm, robustsolution wrote: > AFAIK, > > plugin could be use

Re: Database encryption & security

2009-12-18 Thread robustsolution
of course you are talking about two-way encryption not hashing (one way). by the way what do you mean by the database owner? either the guy have a full access to the database or a custom access. if you are the one who has full access, give him a mysql account with custom access to all tables exc

Re: Plugin callbacks and controller hooks

2009-12-18 Thread robustsolution
AFAIK, plugin could be used -1-to be a ~~~separate application : example the blog plugin, the auth plugin, the forum plugin, etc... -2-to be called from anywhere by using a requestAction: example captcha plugin is used to be called via requestAction to import the "prove that you are human" image

Re: Authentication (cookies?) across different domains

2009-12-18 Thread Chad Smith
I have to completely agree with John here, set it as a subdomains. That way you have http://italian.mysite.com, http://www.mysite.com (english), http://french.mysite.com ... or you can always do http://it.mysite.com, http://en.mysite.com, http://fr.mysite.com Either way here's how you set the sess

Re: Can I initialize a component within a function?

2009-12-18 Thread euromark
well right, manja, i forgot that part - and sometimes you need init() too but there are components which dont have init() or startup() then you dont need to pass the controller as reference On 18 Dez., 14:14, majna wrote: > You can put this method this in app_controller for cleaner > importhtt

Re: Can I initialize a component within a function?

2009-12-18 Thread majna
You can put this method this in app_controller for cleaner import http://bin.cakephp.org/view/1494579178 On Dec 18, 12:13 pm, number9 wrote: > Thanks very much for the replies guys thats worked great, I knew there > must have been some way of doing it! > > On Dec 18, 10:28 am, majna wrote: > > >

Re: cache prefix

2009-12-18 Thread Kawina
Any help? Thanks. On Dec 17, 9:12 am, Kawina wrote: > I'm new to CakePHP and my little knowledge is derived from  minor > modifications to an app created by someone else. Accordingly, my > familiarity with the cache system is limited. > > My search of this group on the issue only yielded old bugs

Plugin callbacks and controller hooks

2009-12-18 Thread Aargh
I would like to know if there is any official (or at least supported / under development) mechanism that would allow me to create hooks so that i can hook certain plugin functions into a controller. What would be sweet : Controller hooks For example let-s say we have a two statistics plugins. On

Best practise to manage user's selections and user's views

2009-12-18 Thread marco.rizze...@gmail.com
Hi In my application I have the model "Item" and the model "User". Every item is visible by some users and it isn't visible by other users. So I have a HABTM between "User" and "Item". Now I must register when a user views an item and when a user selects a item (a user can select some visible items

Re: Can I initialize a component within a function?

2009-12-18 Thread number9
Thanks very much for the replies guys thats worked great, I knew there must have been some way of doing it! On Dec 18, 10:28 am, majna wrote: > ..and add Controller reference: > > App::import('Component', 'Own'); > $this->Own = new OwnComponent(); > $this->Own->startup($this); > > On Dec 18, 1:16

Database encryption & security

2009-12-18 Thread WhyNotSmile
Hi, I was wondering whether anyone could help me out with some database encryption. The app stores a bit of personal info in the MySQL database - name, address, phone number, email address & password. I think I should probably encrypt this in the database so that even the owner of the database c

Count column in index view

2009-12-18 Thread Jeremy Burns
I have a model that uses the Tree behaviour, so it has a self join in the database (parent_id to id). In my index view I'd like to add a column that shows the count of direct children for 'this' row. I know I can get that number on a row by row basis using childCount, but how do I use that as part

Re: Caching a pagination data

2009-12-18 Thread HK
Thanks a lot!!! How stupid of me! I didn't include the Cache helper. On Dec 18, 11:00 am, robustsolution wrote: > I meant why arent you using the cache helper...etc > > On Dec 18, 8:58 am, robustsolution wrote: > > > hi HK, > > Aren't you the cache helper in the controller? because AFAIK it sho

Re: Can I initialize a component within a function?

2009-12-18 Thread majna
..and add Controller reference: App::import('Component', 'Own'); $this->Own = new OwnComponent(); $this->Own->startup($this); On Dec 18, 1:16 am, euromark wrote: > sure > nothing easier than that > > App::import('Component', 'Own'); > $this->Own = new OwnComponent(); > > On 17 Dez., 22:28, numbe

Re: Caching a pagination data

2009-12-18 Thread robustsolution
I meant why arent you using the cache helper...etc On Dec 18, 8:58 am, robustsolution wrote: > hi HK, > Aren't you the cache helper in the controller? because AFAIK it should > be used also. > > caching view is something server-side (done on the server), it caches > the whole (browser request)'s

Re: Caching a pagination data

2009-12-18 Thread robustsolution
hi HK, Aren't you the cache helper in the controller? because AFAIK it should be used also. caching view is something server-side (done on the server), it caches the whole (browser request)'s page answer (the html source code) caching images is another thing, it is something done on the client si