# |
Sep 21st 2011, 15:32 |
ujjain |
I want to keep my views clean. |
# |
Sep 21st 2011, 15:32 |
ujjain |
and would it be stupid to use beforefilter to set keywords, description and re-set it if needed in the controllers? |
# |
Sep 21st 2011, 15:32 |
jbaanus |
ujjain: don't think so |
# |
Sep 21st 2011, 15:32 |
ujjain |
Can you use this->set for same variable name multiple times? |
# |
Sep 21st 2011, 15:31 |
Oldskool |
Hey guys, I have a forum in my Cake app under /app/webroot/forum, which functions just fine, but I was wondering if there is a simple way to have the URL's to show just /forum, instead of redirecting to /app/webroot/forum/ as it does now. |
# |
Sep 21st 2011, 15:29 |
jbaanus |
franki: you can do UNION manually - makes sorting easier |
# |
Sep 21st 2011, 15:28 |
friskd |
but not sure how to make what would be a redirect (HTML) become a json response with "user is not logged in" |
# |
Sep 21st 2011, 15:27 |
jbaanus |
franki: then just merge in PHP... sorting is pita tho :) |
# |
Sep 21st 2011, 15:27 |
friskd |
i want to have auth enabled. |
# |
Sep 21st 2011, 15:27 |
franki |
yea i thought about it too but i cant really touch the db |
# |
Sep 21st 2011, 15:27 |
friskd |
Is there a way to have the Auth component work nicely nicely with a RESTful api |
# |
Sep 21st 2011, 15:26 |
jbaanus |
or create a view in database that merges results from both databases and create a new Model for that View - fake a database table ) |
# |
Sep 21st 2011, 15:25 |
ADmad |
Oleander: anyways, setting the post_type_id in beforeSave is the proper way of doing it |
# |
Sep 21st 2011, 15:25 |
franki |
oki |
# |
Sep 21st 2011, 15:25 |
franki |
aaah |
# |
Sep 21st 2011, 15:25 |
jbaanus |
and then merge the results |
# |
Sep 21st 2011, 15:25 |
jbaanus |
franki: create a new controller and make it use both models |
# |
Sep 21st 2011, 15:25 |
ADmad |
franki: no, each request is handled by single controller, but you can use multiple models in a controller |
# |
Sep 21st 2011, 15:24 |
franki |
or whatever was called..default.ctp |
# |
Sep 21st 2011, 15:24 |
franki |
should i use home.ctp? |
# |
Sep 21st 2011, 15:24 |
jbaanus |
franki: I can't see why not |
# |
Sep 21st 2011, 15:23 |
Oleander |
I just throught cake could get post_type_id in save if i specified a condition |
# |
Sep 21st 2011, 15:23 |
ADmad |
Oleander: so how are you going to decide what post type to use? |
# |
Sep 21st 2011, 15:23 |
Oleander |
becuase the user isnt selecting the post type |
# |
Sep 21st 2011, 15:23 |
franki |
if i have 2 distict controllers and 2 models for 2 tables of same db,is it possible to have 1 single webpage which gives results from both controllers? |
# |
Sep 21st 2011, 15:23 |
ADmad |
whats wrong with the standard way to putting a select box for the post types on the form |
# |
Sep 21st 2011, 15:22 |
ADmad |
and what parameter are you gonna use to retrieve it dynamically? |
# |
Sep 21st 2011, 15:21 |
Oleander |
well i didnt want to have it in form. i wanted to retrieve it dynamically, im new to cake and thought perhaps this is how you do it. if not i can put it in form. |
# |
Sep 21st 2011, 15:21 |
ADmad |
sounds liek you have a Post belongsTo PostType so why don't you have the post_type_id in form itself? |
# |
Sep 21st 2011, 15:20 |
ADmad |
Oleander: well i dont know your models, but yes |
# |
Sep 21st 2011, 15:19 |
Oleander |
Admad: that would mean i need to query PostType before save to find the id of the type i want to save Post as, yes? |
# |
Sep 21st 2011, 15:17 |
ADmad |
Oleander: if $data is the var you are passing to model->save() you can set $data['Foo']['post_type_id'] = x |
# |
Sep 21st 2011, 15:14 |
Oleander |
when saving a post, i need to set post_type_id, do i only have two options. 1. set post_type_id in form as hidden value, or get find post_type_id in model before save? Is it possible for cake when saving to find the id $this->data['Post'Type]['name'] = 'foo' ? |
# |
Sep 21st 2011, 15:14 |
jbaanus |
I might have had a typo in the model variable then |
# |
Sep 21st 2011, 15:14 |
jbaanus |
ah, nice, it does support it |
# |
Sep 21st 2011, 15:13 |
ADmad |
jbaanus: https://github.com/cakephp/cakephp/blob/1.3/cake/libs/model/datasources/dbo/dbo_postgres.php#L275 |
# |
Sep 21st 2011, 15:10 |
ADmad |
) |
# |
Sep 21st 2011, 15:10 |
jbaanus |
Actually it was just easier to alter sequence name |
# |
Sep 21st 2011, 15:09 |
jbaanus |
Model has primary key (ID usually) and PostgreSQL has sequence for it. When it is automatically created, the the sequence name is usually table_id_seq. I have a differently named sequence but Cake does not recognise it |
# |
Sep 21st 2011, 15:08 |
ADmad |
jbaanus: you mean primary key? |
# |
Sep 21st 2011, 15:06 |
Oleander |
hey |