Re: error handling: how to handle missing secondary database gracefully

2012-02-09 Thread qwanta
Thanks for the idea, I looked into it a little, but I don't want to mess too much with the innards of my app as someone else will be taking it over soon. What I ended up doing was placing a link next to the empty job number textbox that opens a new browser tab/window with the job number list in it

error handling: how to handle missing secondary database gracefully

2012-02-07 Thread qwanta
I am reading a list of job numbers from a mysql database on an old server on my intranet. This server is completely independent from the server for my cakephp app and database. If the server is there, I populate a combobox with the list of job numbers, however, if it is down, I would like to handle

Re: Conceptual problem Model on View ..

2010-01-06 Thread qwanta
You would put the code to calculate the can_close values for each row in the model or in the controller. To put the code in the model, do not use find('all') but create your own method in the model, for example find_all_model_a. Now in this function, call $r = $this->find('all'), then iterate thro

Re: Problem handling search form fior multiple values

2009-08-03 Thread qwanta
If you print out the contents of the $this->data array ( debug($this- >data) ). You should see: [vendor_id] => Array ( [0] => 1 [1] => 2 ) So that's where you access those values, they are in the array. On Jul 27, 3:31 pm, N

Re: saving a view to .htm file

2009-06-05 Thread qwanta
Experimenting a bit more, it seems that another straightforward way to do this is use the php function "file_get_contents" to get a string with the view. The advantage is that any view can be accessed even in a different cake app (as mine is). On Jun 5, 10:13 am, qwanta wrote: > Th

Re: saving a view to .htm file

2009-06-05 Thread qwanta
yourself to write to > the file and see if Cake wwill still call it automatically for browser > output, as normal. > > > > On Wed, Jun 3, 2009 at 8:10 PM, qwanta wrote: > > > I am drawing a blank on this one, any help appreciated. Basically my > > view is a calibr

saving a view to .htm file

2009-06-03 Thread qwanta
I am drawing a blank on this one, any help appreciated. Basically my view is a calibration record that also needs to be saved in a folder for backup purposes. Is it possible to save the view as an htm file, just as if you selected "Save Page As" in Firefox? --~--~-~--~~~---

sorting a table with javascript (no page reloads)

2009-05-13 Thread qwanta
I was looking for a way to sort a table without requerying the database for the data with a new ORDER clause. This javascript library I found did just that, so I thought I would share it. http://www.kryogenix.org/code/browser/sorttable/ All you have to do is download sorttable.js and place in t

Re: Poll: what do you hate about CakePHP?

2009-05-11 Thread qwanta
There are a lot of things to like in cakephp, but if I had to say what aggravates me the most it's the seemingly wasteful and inefficient SQL calls that cake makes. The first time I turned on debug = 2 I was astounded at the close to 100 sql calls on a basic page that 1 or 2 SQL statements should

containable behavior nested conditions

2009-05-11 Thread qwanta
Well, I finally got to grips with containable behavior and have successfully been able to write my find queries to return just the information I need. Now I am trying to take this to the next level and put conditions in the contain array, but I am running into problems. I have found quite a few po

Re: Is it possible to set the index of a select box after populating it with find('list')?

2009-05-05 Thread qwanta
x27;, array('options' => array($listvalue), > 'selected' => 'desiredselectvalue') ); > > On May 4, 3:56 pm, qwanta wrote: > > > In the controller I do a find('list') to get an array ready for > > populating a select box. I am quite stumped

Is it possible to set the index of a select box after populating it with find('list')?

2009-05-04 Thread qwanta
In the controller I do a find('list') to get an array ready for populating a select box. I am quite stumped as to how I would set the selected index of the select box in the view. This is a case where the automagic situation (editing a record) is not applicable - it is a log entry form and a new r

Cakephp does same SQL query multiple times (foreign key)

2009-04-28 Thread qwanta
I have a simple database set-up and have optimized the query using cakephp's containable behavior to where I get only the fields I need (I check this with a debug command to see the array). However when I set the debug level to 2 in core.php, I notice many repeat SQL calls on foreign keys. For ex

Re: Pulling data to use in default.ctp menu

2009-04-25 Thread qwanta
I had a similar problem (display the logged in username in the default.ctp header), and used the beforeFilter function in the app_controller. This is a function that when defined in a controller will execute before any controller action, so if you place it in app_controller.php the same code will

Re: easy way to find out if onetomany record is used (before deleting it)?

2009-04-14 Thread qwanta
instead > of a database. > > Richard > > On Tue, Apr 14, 2009 at 3:41 PM, qwanta wrote: > > > In the case where If I have a one to many relationship like Authors- > > >Books and I would like to delete an author - but only if this author > > has no books -

easy way to find out if onetomany record is used (before deleting it)?

2009-04-14 Thread qwanta
In the case where If I have a one to many relationship like Authors- >Books and I would like to delete an author - but only if this author has no books - is there a buiilt-in way to check? I find that I run into this situation a lot (every time a table has a foreign key), and at the moment manual

Re: simple authentication with roles

2009-04-10 Thread qwanta
I also wanted to mention that if you try this out with a controller called TestsController, the authentication doesn't seem to work - everyone (even not logged on) is given access to all functions. I found this out the hard way! That's why I renamed it to TrestsController. --~--~-~--~~

simple authentication with roles

2009-04-10 Thread qwanta
After struggling a bit with Auth, especially in terms of doing "role" or "group" authentication, I thought I would post what I found out. Basically each user belongs to a group ("admin", "calibration", etc...) and I wanted to set the authorized controller functions for each group in each individu

Re: pass variable from beforeFilter in app_controller to child controller

2009-04-10 Thread qwanta
OK, nevermind. Sure enough the second I post, I come up with a solution (after struggling all morning on the problem). class AppController extends Controller { var $auth_role; } then refer to it as $this->auth_role in all controllers. On Apr 10, 11:16 am, qwanta wrote: > I am set

pass variable from beforeFilter in app_controller to child controller

2009-04-10 Thread qwanta
I am setting a variable value that in app_controller beforeFilter, and I would like to access it in all child controllers beforeFilter function. class AppController extends Controller { var $components = array('Auth'); var $uses = array('User'); $auth_id = $this->Auth->user('id'); if (

Re: Accessing Model From another Controller

2009-04-02 Thread qwanta
I thought the preferred way was to add the models at the top of the controller: var $uses = array('Product', 'Category'); But investigating briefly, it seems like there is a performance hit for this nice syntax - I found the following post at nabble: >Don't use $uses, ever. It is terrible for p

Re: Access a returned AJAX value

2008-12-02 Thread qwanta
Hi tobi_one, I had the exact same problem and never got an answer: http://groups.google.com/group/cake-php/browse_thread/thread/6a8bca31cbc37600/68463ae52185dd1a http://groups.google.com/group/cake-php/browse_thread/thread/e96a87bb82267767 In the end, I abandoned the CakePHP ajax helper and did

Re: TCPDF and Cake PHP

2008-12-01 Thread qwanta
I couldn't get that tutorial to work either. It was a while ago, so I don't remember so well, but here are the notes I took to get something to work: *** 1) Download the TCPDF files from TCPDF.org (php5 is OK) 2) Extract to app/vendors/tcpdf (t

Re: Use Ajax without using library: like prototype.js, jquery.js

2008-10-17 Thread qwanta
For a pure javascript/ajax template, go here http://ajaxphp.packtpub.com/ and download the sample chapter http://ajaxphp.packtpub.com/1825_01_Final.pdf This should give you a basic working xmlhttprequest that should be easy to modify to do what you need. On Oct 17, 11:57 am, bookme <[EMAIL PROTE

Re: simple AJAX

2008-10-14 Thread qwanta
Before looking at the cakephp ajax helper, and the different js frameworks (prototype, script.aculo.us, jquery etc) I suggest doing a simple AJAX example in pure PHP/javascript. There's a great tutorial here: http://ajaxphp.packtpub.com/1825_01_Final.pdf which is a chapter from this book http://a

Re: New to CakePHP

2008-10-13 Thread qwanta
Also, don't forget to restart apache after making the httpd.conf changes. On Oct 12, 2:16 pm, imran k <[EMAIL PROTECTED]> wrote: > Hi everyone! I am Imran k and very new to CakePHP. I have downloaded > cake_1.2.0.7692-rc3  and installed on XAMPP server but the 'welcome > screen' appears without a

Re: how to create table in database from cakephp

2008-10-10 Thread qwanta
You can do this with the query method of the model. http://book.cakephp.org/view/456/query It seems like you need to create a dummy table in the database for the controller so that you can access the method: for the following example, I had to create the table "qs" to avoid an "Error: Database t

Re: How to update two divs with $ajax->link ??

2008-10-09 Thread qwanta
I am not an authority on this, but I had a similar problem that I had to solve. Basically, it helps to understand that an ajax call gets a simple text string back from the server. This text string is generated by the controller function specified in your ajax call. So really what you want to do i

Re: Conventions regarding "people" and "Person"

2008-10-05 Thread qwanta
Note that you can use the $useTable property in the model to explicitly define what table to use in case of doubt/ambiguity. http://manual.cakephp.org/view/436/useTable On Oct 5, 11:47 am, Sentinel <[EMAIL PROTECTED]> wrote: > Hello everybody. > > I have a question regarding the convention withi

Re: Notice (8): Undefined index: abc [APP\views\......\index.ctp

2008-10-04 Thread qwanta
uot;S/*\\L/*\\L/*\\M" <[EMAIL PROTECTED]> wrote: > qwanta yes the relationship is that u mentioned.i had did these all > things as u mention, but the error r stuck there and couldnt remove so > 4..this error is not from table syntax nor from cake php..but as i > think i didnt

Re: Notice (8): Undefined index: abc [APP\views\......\index.ctp

2008-10-03 Thread qwanta
at htmlhelper is easy way to genrate tables cell and > headers.. > but i m trying to learn some code myself.. :p > - i m trying to made relationship b/w books and authors tables...i think its > relation is not make properly. > -how to make foreign key?..i think thats the problem. > t

Re: Notice (8): Undefined index: abc [APP\views\......\index.ctp

2008-10-03 Thread qwanta
Note also you have to have your tables defined according to the CakePHP syntax. Each one should have an "id" key column. Then the Book table should have an author_id field to link the author. On Oct 3, 2:54 pm, qwanta <[EMAIL PROTECTED]> wrote: > If it's a one to many

Re: Notice (8): Undefined index: abc [APP\views\......\index.ctp

2008-10-03 Thread qwanta
What you probably want to do is take a look at what you have in the $books array at the end of your controller. A quick and dirty way is to put a var_dump($books); as last statement in your controller function. The contents will then show up at the top of your view. Check if the ['Author']['name']

AJAX callback function "complete" - how do I access the XMLHttpRequest response text?

2008-10-02 Thread qwanta
In traditional javascript you can get the text of the message of an XMLHttpRequest by doing something like this: xmlResponse = xmlHttp.responseXML; // xml textResponse = xmlHttp.responseText; // text where xmlHttp is an XMLHttpRequest Object that has received a message from the server. How do

Re: AJAX: is it possible to update the src parameter of an image directly?

2008-10-02 Thread qwanta
gure it out from perusing the docs. Anyway, thanks, I'll post back if I figure it out! (I think I'll post another topic with this specific question in it) On Oct 2, 9:12 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > Sorry, try request.responseText. >

Re: AJAX: is it possible to update the src parameter of an image directly?

2008-10-02 Thread qwanta
On Oct 1, 11:59 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > 'callback' doesn't exist, the only names of callbacks you can use are > listed on the page in my last message. :-) Oooops, it was getting late > Other than that, you pretty much got it. I always forget what the > variable

Re: AJAX: is it possible to update the src parameter of an image directly?

2008-10-01 Thread qwanta
;t get the callback one. Is there anything special to be set up? Thanks. On Oct 1, 10:23 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > I guess the AJAX helper doesn't have this ability built-in, but you > could simply write your own JS for the 'compl

AJAX: is it possible to update the src parameter of an image directly?

2008-10-01 Thread qwanta
Using pure php/javascript without cakephp, I am able to use the javascript function === document.getElementById("pic").src = imageName; === to update an image (when a button on the web page is clicked). this results in very smooth image updates. In CakePHP, I have been able to update the

Re: help me understand cakaphp

2008-10-01 Thread qwanta
There's also a couple good tutorials: http://www.sitepoint.com/article/application-development-cakephp/ http://www.davidgoldingdesign.com/newbie-cakephp.pdf But they are from 2006, so a little outdated (use .thtml instead of .ctp extension). Still worth reading for the concepts, and the code sti

Re: Simple Ajax link to update div

2008-09-30 Thread qwanta
$this->autoRender = false; echo "aaa"; echo "bbb"; echo "ccc"; } Now navigate to http://127.0.0.1/[cakephpapp]/tests/simple_text You should see t

Re: Simple Ajax link to update div

2008-09-30 Thread qwanta
r' => 'tests', 'action' => 'ajaxfcn1', 1 ), > array( 'update' => 'divout', 'complete' => 'alert( "Executed > OK" )' ) > ); > ?> > > in your controller function: > > ec

Simple Ajax link to update div

2008-09-30 Thread qwanta
Hi, I have been struggling a bit to get a simple Ajax link working. I have searched this group for help in older posts, but it seems like a key tutorial (the grahambird one) is no longer available - perhaps because it no longer works with 1.2. If there is a tutorial somewhere that covers this, pl

bakery not taking comments?

2008-09-03 Thread qwanta
Not sure if this is the best place to report this, but I couldn't find any contact info for the bakery. Basically, it seems like comments cannot be left for articles at the bakery. There is some problem with the title validation as it reports a blank field even when there is text in there. I was