Re: CakePHP Helper

2010-06-12 Thread nurvzy
Hi Marc, First I'd like to thank you for taking the time to submit your article. I've seen and posted feedback on your original article. I see you've posted the same article again. I respectfully ask that in the future you do not post duplicate articles in the bakery, as all it does is cause

Re: CakePHP Helper

2010-06-12 Thread calvin
In case you don't get a response here, you might try the CakePHP IRC channel (I think it's on Freenode). Someone there will likely be able to help you. On Jun 12, 10:35 am, Marc wrote: > Hi There, > > This is Marc Fernandez, I've been programming with CakePHP a couple > years ago and recently I n

CakePHP Helper

2010-06-12 Thread Marc
Hi There, This is Marc Fernandez, I've been programming with CakePHP a couple years ago and recently I needed to do a Google Map with the last V3 Google Map API, and because there is no any helper in the Bakery I decided to create one and publish it. The thing is that I've posted the helper like

Re: Login and Registration form on same page/view

2010-06-12 Thread Sam
You need to manually set the view in your register action At the end of your action add $this->render('../pages/welcome'); On Jun 10, 9:42 am, Andrei Mita wrote: > I did that but I'm having problems with data validation and form processing. > I have my forms in pages/welcome.ctp, the controller i

Re: used model in AppController gives error in vendor/shells/xyz.php file.

2010-06-12 Thread Sam
Have you instantiated the Myemail model? AFAIK App::Import basically includes the php file... to get an instance of the class you still need to do something along the lines of $this->Myemail = new Myemail Also, make sure you have the model name correct(since if your table was my_emails, cake wou

Re: Updating is creating new record

2010-06-12 Thread Zaky Katalan-Ezra
$this->data->['User']['id'] = $user['User']['id']; On Sat, Jun 12, 2010 at 7:57 PM, WhyNotSmile wrote: > I'm trying to update a field in a record, using the following code: > > $this->id = $user['User']['id']; > $this->set('friends_list', $friendslist); > $this->save(); > > The record with

Re: find list, filtered

2010-06-12 Thread calvin
Ah, I misunderstood you. I think you should be able to just use the 'join' and 'group' keys, e.g.: $countries = $this->Country->find('list', array( 'joins' => array( array( 'table' => 'cake_members', 'alias' => 'Member', 'type' => 'inner', 'foreignKey' => 'Member.coun

Re: Modification of a helper method?

2010-06-12 Thread calvin
Well, you could create a helper that doesn't modify the helper method, but simply uses it. E.g. in your views: echo $myHelper->link('delete', $id); // generate a delete link for $id for the active controller echo $myHelper->link('edit', $id); // generate an edit link for $id for the active control

Re: controller and view extention problem.

2010-06-12 Thread calvin
Yes, there is an HTTP status code specifically for that: Status: 301 Moved Permanently Location: http://yoursite.com/new/page/location http://www.somacon.com/p145.php On Jun 12, 2:30 am, Sam Sherlock wrote: > seo redirect old url to new one. > > new one being cake address > - S > > On 12 June 2

Re: Modification of a helper method?

2010-06-12 Thread cricket
On Jun 12, 6:14 pm, saidbakr wrote: > In other word, > > In the controller action some logic will be done and it will return > either true or false. If it true, I need something to call the html > helper in the view and then changing all links with title contains the > text "Edit" or "Delete" to r

Re: Custom pagination with plain SQL

2010-06-12 Thread cricket
On Jun 10, 3:34 pm, Lucca Mordente wrote: > Hello there > > I have a Search model which uses no database table that makes a > fulltext search in some tables using plain SQL. Have you explored having the model use those tables? Or, you could bind to the other model(s) on the fly. Or implement some

Re: Modification of a helper method?

2010-06-12 Thread saidbakr
In other word, In the controller action some logic will be done and it will return either true or false. If it true, I need something to call the html helper in the view and then changing all links with title contains the text "Edit" or "Delete" to return null or empty string instead of html link.

Re: Custom pagination with plain SQL

2010-06-12 Thread Ed Propsner
Have you checked out the section of the book on custom query pagination? http://book.cakephp.org/view/1237/Custom-Query-Pagination Even though in the end I ended up not using it I was able to paginate a custom query working from the e

Re: Custom pagination with plain SQL

2010-06-12 Thread Lucca Mordente
Anybody? On 10 jun, 16:34, Lucca Mordente wrote: > Hello there > > I have a Search model which uses no database table that makes a > fulltext search in some tables using plain SQL. > > How can I paginate the results of a $this->query($plainSQL) call ? > > Precisely, how do I implement the paginat

Re: find list, filtered

2010-06-12 Thread cricket
On Jun 12, 5:07 pm, cricket wrote: > On Jun 11, 12:39 pm, calvin wrote: > > > Wouldn't a simple GROUP BY work?: > > > SELECT Country.* FROM cake_countries AS Country JOIN cake_members AS > > Member ON Country.id=Member.country_id GROUP BY Country.id > > or > > SELECT Country.* FROM cake_members A

Re: find list, filtered

2010-06-12 Thread cricket
On Jun 11, 12:39 pm, calvin wrote: > Wouldn't a simple GROUP BY work?: > > SELECT Country.* FROM cake_countries AS Country JOIN cake_members AS > Member ON Country.id=Member.country_id GROUP BY Country.id > or > SELECT Country.* FROM cake_members AS Member JOIN cake_countries AS > Country on Count

Modification of a helper method?

2010-06-12 Thread saidbakr
Hi, What could I do if I want to modify the link method of the Html helper? Of course I don't want to touch the core lib. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the

Re: Updating is creating new record

2010-06-12 Thread John Andersen
Did you still use the setting of the id in the model first? [code] $this->id = $user['User']['id']; $this->saveField( ... ); [/code] It should work! Enjoy, John On Jun 12, 11:05 pm, WhyNotSmile wrote: > Thanks John, but saveField isn't doing the job either. > > Sharon > > On 12 June, 18:07,

Re: Updating is creating new record

2010-06-12 Thread Ma'moon
Are you doing it AJAX? and what is the data type of the coolumn friends_list? On Sat, Jun 12, 2010 at 4:05 PM, WhyNotSmile wrote: > Thanks John, but saveField isn't doing the job either. > > Sharon > > > On 12 June, 18:07, John Andersen wrote: > > Can you just use $this->saveField('friend_list',

Re: Updating is creating new record

2010-06-12 Thread WhyNotSmile
Thanks John, but saveField isn't doing the job either. Sharon On 12 June, 18:07, John Andersen wrote: > Can you just use $this->saveField('friend_list', $friendslist) instead > of $this->save()? > Enjoy, >    John > > On Jun 12, 7:57 pm, WhyNotSmile wrote: > > > I'm trying to update a field in

Re: 3 models and search condition

2010-06-12 Thread viciat
Tried that: $locations = $this->Location->find( 'all', array( 'contain' => array( 'Offer' => array( 'conditions' => array('Offer.category_

Re: 3 models and search condition

2010-06-12 Thread John Andersen
No, it should not, I wrote that I made the find from within the Location model, thus it will find each Location record once, with X number of Offer records. Are you sure that is what you tried? If you are using Containable, then don't use recursive! Enjoy, John On Jun 12, 8:50 pm, viciat wrote

Re: 3 models and search condition

2010-06-12 Thread viciat
True. Tried that. But, like I said, it gets the location_id of every offer. If there are 10 offers for a location, it will get all 10 location_id's. On top of that, it won't get the information for the Location model, since the Location model is related to the Offer model. Settings recursive to 2

Re: 3 models and search condition

2010-06-12 Thread John Andersen
A correction to part of the pseudo-code :) [code] > 'Offer' => array( > 'Offer.category_id' => $id > ) [/code] should be: [code] 'Offer' => array( 'conditions' => array( 'Offer.category_id' => $id ) ) [/code]

Re: 3 models and search condition

2010-06-12 Thread John Andersen
You should be able to make a find with conditions on the category even if you are retrieving the data from the Location model. Something like: [code] find( 'all', array( 'contain' => array( 'Offer' => array( 'Offer.category_id' => $id ) ) ) ); [/code]

Re: 3 models and search condition

2010-06-12 Thread viciat
Yeap, I know about the Containable behaviour. The problem with retrieving the categories is another. If I get all the categories, I'm gonna probably need to retrieve the location from the offers associated with the Category. If I have 100 offers for a category (with the same location), I'm gonna

Re: 3 models and search condition

2010-06-12 Thread John Andersen
I suggest you study the section about retrieving data in the CakePHP book at: http://book.cakephp.org/view/1017/Retrieving-Your-Data Set the recursive parameter to 2 when you retrive the data in the Category model, like: [code] $this->find( 'all', array( 'conditions' => array( 'C

Re: 3 models and search condition

2010-06-12 Thread viciat
Yes. I want to display the locations that are found in the offers of a particular category. When the user selects the Category with, let's say id 3, I want to display the locations that are found in the offers of that category and I don't know how. -- View this message in context: http://old.n

Re: 3 models and search condition

2010-06-12 Thread John Andersen
Ok, I understand what you want to do! So you have the three models, they are related as: Category hasMany Offer Location hasMany Offer Offer belongsTo Category Offer belongsTo Location So what is your issue? Do you have a problem with the find() statement? Enjoy, John On Jun 12, 7:44 pm, vicia

Re: Updating is creating new record

2010-06-12 Thread John Andersen
Can you just use $this->saveField('friend_list', $friendslist) instead of $this->save()? Enjoy, John On Jun 12, 7:57 pm, WhyNotSmile wrote: > I'm trying to update a field in a record, using the following code: > >    $this->id = $user['User']['id']; >    $this->set('friends_list', $friendslist

Updating is creating new record

2010-06-12 Thread WhyNotSmile
I'm trying to update a field in a record, using the following code: $this->id = $user['User']['id']; $this->set('friends_list', $friendslist); $this->save(); The record with id $user['User']['id'] exists in the db; I'm just trying to update the friends_list field. When I do this, though

3 models and search condition

2010-06-12 Thread viciat
I have 3 tables (travel agency): Categories (Mountain, Sea etc.) Locations (London, Paris etc.) Offers (id,category_id,location_id) When I select a category, I want to display the locations that are found in the offers of that category. Categories and Locations are not related. -- View this me

Re: How to get admin home page?

2010-06-12 Thread Zaky Katalan-Ezra
$this->redirect(array('action'=>'index', 'admin'=>0)); On Sat, Jun 12, 2010 at 2:44 PM, saidbakr wrote: > The situation is different. Indeed there is no really mysite/admin/ > the admin here is an action from pages controller. But there is admin > routs such as mysite/admin/users/add. What I nee

Re: Cakephp 1.3 not logging when debug set to 1 or 2

2010-06-12 Thread John Andersen
It works with debug set to either 0, 1 or 2. Could it be a Linux rights issue? Enjoy, John On Jun 12, 5:22 pm, Junaid wrote: > And thats with debug on 1 or 2? > > On Sat, Jun 12, 2010 at 2:11 PM, John Andersen wrote: > > > Ok, I just updated to 1.3.2 and tried this. > > Works flawlessly on my

Re: How to get admin home page?

2010-06-12 Thread saidbakr
Hi Sam No I don't try to get mysite.com/admin for specific controller's action. I try to get mysite.com/admin as an independent page to act as a home page or a dashboard for the rest of admin routes. In other word, I try to make this page to have some links to some admin actions of controllers bes

Re: Cakephp 1.3 not logging when debug set to 1 or 2

2010-06-12 Thread Junaid
And thats with debug on 1 or 2? On Sat, Jun 12, 2010 at 2:11 PM, John Andersen wrote: > Ok, I just updated to 1.3.2 and tried this. > Works flawlessly on my Windows XP machine, using: > [code] > $this->log('Arrived at '.get_class().'->'.__FUNCTION__.'()', 'debug'); > [/code] > > And the debug log

Re: URL is showing wrong

2010-06-12 Thread Davor Ilic
hmmm i try this to comment it and it worked with pretty url from cakePHP : Configure::write('App.baseUrl', env('SCRIPT_NAME')); now html->link shows the right url which i wont. It seems i didn´t understand what they mean because of my bad english, i didn´t read it well and i uncomment it. Sorry

Re: Cakephp 1.3 not logging when debug set to 1 or 2

2010-06-12 Thread John Andersen
Ok, I just updated to 1.3.2 and tried this. Works flawlessly on my Windows XP machine, using: [code] $this->log('Arrived at '.get_class().'->'.__FUNCTION__.'()', 'debug'); [/code] And the debug log contains: [code] 2010-06-12 13:08:40 Debug: Arrived at: ServicesController- >tell_a_friend() [/code]

Re: How to get admin home page?

2010-06-12 Thread Sam Sherlock
Hi Saidbakr I think some meaning is lost in translation are you trying to have mysite.com/admin display a specific admin controller / action? if so I use the following to display a user dashboard Router::connect('/admin', array('prefix' => 'admin', 'controller' => 'users', 'action' => 'dashboar

Re: Cakephp 1.3 not logging when debug set to 1 or 2

2010-06-12 Thread Junaid
Hello, I tried that (changing the log name) and it still doesn't work! (only when debug = 0). CakeLog::write('trace', 'test'); $this->log('A debugging message.', 'trace'); For instance these commands do not seem to do anything when debug > 0 Any other ideas? Appreciate any help

Re: Migrating to 1.3 - error "undefned property: view::$session in default.cpt

2010-06-12 Thread Jeremy Burns
Add the Session helper and component to your app_controller, then call it with $this->Session... Jeremy Burns jeremybu...@me.com On 12 Jun 2010, at 13:01, Melanie Sommer wrote: > Sorry I forgot the second part of the error message: > > Fatal error: Call to a member function flash() on a non-o

Re: Migrating to 1.3 - error "undefned property: view::$session in default.cpt

2010-06-12 Thread Junaid
Hello, Have a look at this: http://blog.room34.com/archives/4480 The key section: After following the migration docs, I was overly optimistic that things would just *work.* They didn’t. First up, I encountered this: Notice (8): Undefined property: PagesController::$Session [APP/controllers/app_

Re: Migrating to 1.3 - error "undefned property: view::$session in default.cpt

2010-06-12 Thread Melanie Sommer
Sorry I forgot the second part of the error message: Fatal error: Call to a member function flash() on a non-objekct in / app/views/layouts/default.ctp on line 43 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this m

Migrating to 1.3 - error "undefned property: view::$session in default.cpt

2010-06-12 Thread Melanie Sommer
Hello, I tried to migrate from 1.2.7 to 1.3.2. I downloaded cake 1.3.2 and ran the console to create a new project. All I did in this new project is edit the app_controler.php file and include the line var $helpers = array('Html'); I then get the error message (when calling cake/myapp) "Notice:

Re: How to get admin home page?

2010-06-12 Thread saidbakr
The situation is different. Indeed there is no really mysite/admin/ the admin here is an action from pages controller. But there is admin routs such as mysite/admin/users/add. What I need to achieve is to set or make an index page for admin and when the user is being on mysite/ admin/users/add and

Re: CakePHP and Custom Tag/Codes

2010-06-12 Thread euromark
by the way: if you take a look at the core test cases to this specific file you will see right away how you can use [ and ] as before and after parameters its always a good idea to learn from the test cases anyway On 12 Jun., 10:05, ramonmaruko wrote: > I want to be able to input like this in a

Re: CakePHP and Custom Tag/Codes

2010-06-12 Thread euromark
check out http://api.cakephp.org/class/string this will do the trick On 12 Jun., 10:05, ramonmaruko wrote: > I want to be able to input like this in a textarea: > > [videos] > > and when the field containing that is displayed, the [videos] tag will > instead be replaced with a call to the video

Re: controller and view extention problem.

2010-06-12 Thread Sam Sherlock
seo redirect old url to new one. new one being cake address - S On 12 June 2010 10:07, fadhli - wrote: > I have to use www.example.com/home/index.php address because it was used > in the website address rating. > > On Thu, Jun 10, 2010 at 12:12 AM, cricket wrote: > >> On Jun 8, 11:44 pm, fad

Re: controller and view extention problem.

2010-06-12 Thread fadhli -
I have to use www.example.com/home/index.php address because it was used in the website address rating. On Thu, Jun 10, 2010 at 12:12 AM, cricket wrote: > On Jun 8, 11:44 pm, fadhli - wrote: > > hi everyone. > > > > i'm new in cakephp and i want to know how to makehttp:// > www.example.com/home

Re: controller and view extention problem.

2010-06-12 Thread fadhli -
> and to view page i must use php > (index.php not index.ctp) extextion. >>There's no need to have index.php in the URL. And your URLs should not >>ever have "something.ctp" in them. The .ctp files are templates; >>they're not supposed to be accessed directly through a URL. I have to use that add

CakePHP and Custom Tag/Codes

2010-06-12 Thread ramonmaruko
I want to be able to input like this in a textarea: [videos] and when the field containing that is displayed, the [videos] tag will instead be replaced with a call to the videos element. echo $this->element('videos'); How would I be able to do this? Check out the new CakePHP Questions site htt

Question on encoding on database.php

2010-06-12 Thread marco.rizze...@gmail.com
Hi I have a old DB.Now I must do a CakePHP app on this Db. For the moment I do the scaffolding but I have noted that in edit.php I see all fields empty. If I set encoding in database.php like 'encoding' => 'utf8' all works fine. Can someone explain me why is this and what is the difference? Then I