cakephp-2.2

Add class to pagination links at CakePHP 2.2

随声附和 提交于 2019-12-11 16:26:31
问题 I can add a class ("myclass") to the link (previous or next) which does not contain a link.(current page) I just add the class following the default ones: echo $this->Paginator->prev('< ', array(), null, array('class' => 'prev disabled myClass')); And it generates something like this: <span class="prev myClass disabled ">prev</span> But, when the previous or the next links have a link, then i the class is not added and it generates something like this: <span class="prev"> <a href="/tickets

Define global variable for Models and Controllers at CakePHP 2.2

坚强是说给别人听的谎言 提交于 2019-12-11 09:43:37
问题 Currently i am using something like this: //at bootstrap.php file Configure::write('from', 'mymail@mydomain.com') //at controllers or models files $var = Configure::read('from') The thing is, i would like to manage that variable through the database to be able to modify it in a simpler way. I was thinking about doing it with AppModel but then it would only be accessible for Models and not controllers. What should I do in this case? Thanks. 回答1: You can create a separate model / plugin which

CakePHP 2.2 with PostgreSQL Failed new row insert - Database Error: Undefined table: 7 ERROR: relation “table_id_seq” does not exist

非 Y 不嫁゛ 提交于 2019-12-11 07:37:26
问题 My problem is as follows. After deleting multiple rows from table, inserting new record into same table results in error. Database Error Error: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "order_details_id_seq" does not exist Table CREATE TABLE schema.order_details ( id serial NOT NULL, order_id integer NOT NULL, field_1 integer, field_2 real, field_3 character varying(15), CONSTRAINT order_details_pkey PRIMARY KEY (id ) ) WITH ( OIDS=FALSE ); Insert is INSERT INTO "schema"."order

My cakephp 2.2 site not working on subdomain

╄→尐↘猪︶ㄣ 提交于 2019-12-11 06:29:56
问题 My cakephp 2x site working fine on my local machine. But i have upload on sub domain server it is not working. I want my cakephp site working on sub domain with admin Prefix http://vertaxtechnology.com/ => is my domain http://dev.vertaxtechnology.com/ = is my sub domain http://dev.vertaxtechnology.com/eventapp = is my cake directory This is my Root htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteBase /eventapp/ RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] <

Htaccess and CakePHP 2 on windows IIS7

邮差的信 提交于 2019-12-11 03:07:39
问题 I was having problems trying to configure the mod rewrite over windows and II7: CakePHP 2.2.2 not working on Windows IIS7 but finally i could import the htaccess in order to create the web.config file for IIS7. The thing is: Now that file has been created in cakephp folder and i can access to the main page BUT it has not been created inside app/ or app/webroot in which you can find 2 more .htaccess files. Now, i can not access any other view than the main site, it shows a 404 page not found

Best way to filter access to controller actions according to a specific client id

一曲冷凌霜 提交于 2019-12-10 17:38:20
问题 Using CakePHP 2.2, I am building an application in which each client has it's own "realm" of data and none of the other data is visible to them. For example, a client has his set of users, courses, contractors and jobs. Groups are shared among clients, but they cannot perform actions on groups. All clients can do with groups is assign them to users. So, an administrator (using ACL) can only manage data from the same client id. All my objects (except groups, of course) have the client_id key.

Load Javascript files in CakePHP Layout at “bottom”

我们两清 提交于 2019-12-09 05:45:33
问题 Currently, I have a big CakePHP application with a layout and a lot of views. In the layout, I load Javascript files in the head which are needed by most views. In the views themself, I either load additional Javascript files (e.g., load a library file that is only needed there), or I add some Javascript code that is only relevant for this view in a script tag, for example if I need a click handler. Since it is a known fact that loading Javascript files in the HTML head blocks loading the

User sessions and two CakePHP applications running in the same machine

坚强是说给别人听的谎言 提交于 2019-12-07 12:32:17
问题 I have 2 CakePHP applications running on the same machine. Both of them need a previous registration to have access to them and the first thing users see is the login form. I have realized that when I do login in one of them, then, I can access to the other web application without being asked for my credentials to login. (which is not correct) In my Controllers of both applications I have this to deny access without a previous login. public function beforeFilter(){ parent::beforeFilter();

Getting names to show in dropdown list with cakephp

匆匆过客 提交于 2019-12-06 10:37:50
I want to show the names of all our project leaders in a dropdown list. The project leaders are only some of the employees that work in the company. Here are my tables: project_leaders ,----,----------------, | id | hr_employee_id | |----|----------------| | 1 | 18 | '----'----------------' projects ,----,------,-------------------, | id | name | project_leader_id | |----|------|-------------------| | 1 | cake | 1 | '----'------'-------------------' hr_employees ,----,------,---------, | id | name | surname | |----|------|---------| | 18 | joe | dirt | '----'------'---------' My

User sessions and two CakePHP applications running in the same machine

跟風遠走 提交于 2019-12-05 20:29:33
I have 2 CakePHP applications running on the same machine. Both of them need a previous registration to have access to them and the first thing users see is the login form. I have realized that when I do login in one of them, then, I can access to the other web application without being asked for my credentials to login. (which is not correct) In my Controllers of both applications I have this to deny access without a previous login. public function beforeFilter(){ parent::beforeFilter(); $this->Auth->deny(); } But this seems not to work properly when I use the same browser and I do login in