Re: Need a lightbox type app

2008-05-30 Thread brammeleman

On May 29, 6:42 pm, Kyle Decot <[EMAIL PROTECTED]> wrote:
> I'm making an app where I need to be able to have a link that when
> clicked, dims the windows(like lightbox) and then brings up an ajax
> calendar. I know that lightbox is for photos, so does anyone have any
> suggestions on apps that could be used for this?

Try this one: http://modalbox-cakephp-demo.nerdnotes.org/

Bram
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



cakephp 1.2 form

2008-02-23 Thread brammeleman

I'm trying to create a simple Ajax based form. These are the steps
I've taken along with the questions that came up:

I've managed to get the forms' content into a div element. Done by
creating an 'ajax' instead of an 'html' link. When I submit the form,
I get redirected back to the index view showing the modified or added
record. All fine!
But, when the form validation fails, I get redirected to the form
directly rendered into the layout (instead of in the div element).

To solve this problem, I've replaced the $form->create helper call by
the $ajax->form helper call in the form view.  Telling the $ajax->form
function to update the div element.

Q1) what's the difference in using $ajax->form and $ajax->submit?
should one of them be used exclusively? or do they need to be used in
a pair (like $form->create and $form->end)?

Now it works nice when the form validation fails. But when the
submitted data validates, the redirected (index) page gets rendered in
the div. The funny thing is that somehow the requesthanler doesn't
know it's an ajax request. It renders the content in the default
layout.

I'm obviously missing the point somewhere
Q2) how can you make sure that form stays in the div, but when it
validates you get a non-ajax redirect?

Thanks for your help,

Bram

ps: someone else apparently posted a similar question in the bin:
http://bin.cakephp.org/saved/521
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $form->file() renders: Array to string conversion [COREcakelibs/view/helper.php, line 296]

2007-08-16 Thread brammeleman

I'm getting the same error with cake 1.2 5427. I'm not doing any
validation / upload behaviors or what so ever.

This is my code:
controller action:

function add_picture() {
if (!empty($this->data)) {
$this->Post->create();
if ($this->Post->save($this->data)) {
$post_id = $this->Post->getInsertID();
// store uploaded file

move_uploaded_file($this->data['Post']['upload']['tmp_name'],
IMAGES_PATH . $post_id . '.jpg');
$this->Session->setFlash('The picture is 
saved!');
$this->redirect('/posts');
} else {
$this->Session->setFlash('The Picture upload 
failed. Please, try
again.');
}
}
}

view (views/posts/add_picture.ctp):
create('Post', array('action' => 'add_picture',
'type'=>'file'));

echo $form->input('title');
echo $form->file('upload', array('label' => 'Picture'));

echo $form->end('Submit');

?>

After submitting the empty form it returns the error:

Notice (8): Array to string conversion [CORE/cake/libs/view/
helper.php, line 298]

The problem seems to be caused by the file() function of the
formHelper class. A simple fix is adding the following lines to [CORE]/
cake/libs/view/helpers/form.php:

find (line ~829):
function file($fieldName, $options = array()) {
$options = $this->__initInputField($fieldName, $options);
$this->__secure();

insert:
if (isset($options['value'])) {
unset($options['value']);
}

Note that this is a fix that "works for me" but might a fix for a side
effect of the real problem.

Bests,

Bram

On Jun 27, 7:42 am, abba bryant <[EMAIL PROTECTED]> wrote:
> I was getting this same issue. What fixed it for me was making sure the app
>
>
>
> dardosordi wrote:
>
> > Can you post your entire model,  I want to see your $valdiatearray.
> > Try removing the validation from the file field, if that works, try
> > the new version of the upload behaviour (http://bin.cakephp.org/saved/
> > 20438).
>
> > On Jun 20, 9:05 pm, mastorna <[EMAIL PROTECTED]> wrote:
> >> I believe this topic has come up few times, but after searching the
> >> archives, I'm at a complete loss at how to solve it.  I'm doing a file
> >> upload and I repeatly receive the same error.
>
> >>Arraytostringconversion[CORE/cake/libs/view/helper.php,line296]
>
> >> so i've got an input type of file using the view and formHelper:
>
> >> VIEW:
>
> >> $form->file(Model.name);  // in this case: Mixtape.filename
> >> echo $form->label('Mixtape.artist',"Artists:");
> >> echo $form->input('Mixtape.artist',array('div' => true, 'label' =>
> >> false, 'class'=>'required', 'error' =>array( 0 => 'Please provide a
> >> valid artist', 1 => 'The artist must have at least 2 or more
> >> characters' )));
>
> >> CONTROLLER:
>
> >> if ($this->Mixtape->save($this->data))
> >> {
> >>  $this->flash('Your post has been saved.','/mixtape');
>
> >> }
>
> >> So when the controller passes this to the model, its going to pass the
> >> file ($_FILES) as anarray, which is understood.
>
> >> var $actsAs =array('Upload' =>array(
> >> 'filename' =>array(
> >> 'dir' => 'files/images',
> >> 'overwrite_existing' =>
> >> false,
> >> 'create_directory' =>
> >> false,
> >> 'allowed_mime' =>
> >>array('audio/mpeg','image/jpeg', 'image/
> >> pjpeg', 'image/gif', 'image/png'),
> >> 'allowed_ext' =>
> >>array('.mp3','.jpg', '.jpeg', '.png', '.gif'),
> >> )
> >> )
> >> );
>
> >> When I hit submit, the data passes to the model and cakePHP spits out
> >> out this error.  How do I solve for this?
>
> --
> View this message in 
> context:http://www.nabble.com/%24form-%3Efile%28%29-renders%3A-Array-to-strin...
> Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: class.paths.php

2007-08-14 Thread brammeleman

On Aug 13, 3:39 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> I'm really not sure what could be causing the issue.  However, when
> you run your site in production mode (DEBUG 0) then this file will not
> be written to - only read from.  So as long as it's not corrupted when
> you first switch to DEBUG 0 it'll remain ok regardless of load.
Does this mean that you need to run your cake app at least once with
DEBUG > 0 before running in production mode?

I moved app/tmp to /tmp and created a symbolic link to this location.
This means that I don't have to tell cake about a different location,
while temporary files are created on a local file system.
This solved the problem (still having debug > 0).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



class.paths.php

2007-08-13 Thread brammeleman

I just made an ajax app that has a couple of refreshing divs in it,
using  $ajax->remoteTimer. The elements usually update with the right
content, but once and a while, this error message is served instead:

> Warning: Unexpected character in input: ' in 
> [...]/app/tmp/cache/persistent/class.paths.php on line 25

or

> Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in 
> [...]/app/tmp/cache/persistent/class.paths.php on line 14

Looking at snapshots of the file app/tmp/cache/persistent/
class.paths.php, shows that it's written incorrectly:

23 > $config['Components']['Core']['RequestHandlerComponent'] =
array('path' => './cake/libs/controller/components/
request_handler.php', );
24 > ller.php', );
25 > $config['Components']['Core']['RequestHandlerComponent'] =
array('path' => './cake/libs/controller/components/
request_handler.php', );

and:

12 > $config['Components']['Core']['SessionComponent'] = array('path'
=> './cake/libs/controller/components/session.php', );
13 > ndler.php', );
14 > $config['Components']['Core']['RequestHandlerComponent'] =
array('path' => './cake/libs/controller/components/
request_handler.php', );

My entire app is hosted from an NFS mounted directory.
Could that be causing these problems?

Would it help to move the app/tmp directory to a local file system?
Then my next questions are: how to do that / is there a configuration
setting?
And, how can I be certain that these errors won't pop up when for
example the load on my site get's higher?
Is it possible to switch off using the class.paths.php file which is
obviously some sort of cache file?

Any suggestions?

Bram


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ideas on [EMAIL PROTECTED]

2007-05-23 Thread brammeleman

Don't know if this is the right thing to discuss here:

I do really like the idea to be able to post and download code
snippets from http://cakeforge.org/snippet.

But every time I want to try some of the code, I have to solve the
same kind of problems:
- How should the files be named after downloading (save as... or wget
"link" results in files named "download.php")?
- where should they be placed? in controllers, helpers, elements?
It takes a lot of time to sort those things out, especially when you
are new to cakephp. In the comments  you see a lot of questions
related to files in the wrong location or missing.

Wouldn't it be handy (especially with multiple files) to have snippets
in a tgz / zip file with paths  "relative to ./app"?

Bests,

Bram


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---