A couple thoughts? Your suggestions?

2008-05-20 Thread rloaderro

Hello, I am a big fan of Cake. Recently I have been having to use
other MVC frameworks and came across a couple bits that I would love
to see duplicated in Cake (my framework of choice).

- Symfony function name caching

When Symfony is in development mode it compiles an index of every
function of every class that exists in it's folder hierarchy. That is
to say, by merely placing an external class (example.php) in one of
the folders Symfony knows to search in, you can use all the methods of
that class without having to "include" the class first. I think this
would be great for Cake to use in the case of Components, Helpers (esp
Helpers), etc. Meaning I could reference Helper function from my Views
without having to first include them in the Controller - Cake would
reference the function name index and create the instance of the
appropriate Helper class (if it doesn't exist already) all
automatically.

- Model-Glue 3 automagic controllers

Now we're getting far from the PHP path - but this great MVC framework
for Coldfusion features "automagic" controllers. That is, if the
application is running in development mode and you reference a
controller that doesn't exist, rather than get a 404 you get a page
offering you different options to create the missing controller. While
MG3 mostly deals with event creation / broadcast and XML config, Cake
could benefit from a GUI frontend to the Bake script. It is like
mating the functionality of a Wiki with a programming framework.

Thoughts? Anyone?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: swfupload cakephp 302 error

2008-01-14 Thread rloaderro

On Jan 14, 3:00 pm, booboobenny <[EMAIL PROTECTED]> wrote:
> swfupload does not need ajax,  its pure flash. The flash movie does a
> post submission there is no page reload.

Sorry - I was interpretting your usage of AJAX to mean being able to
submit the form without using Javascript. SWFUpload/SWiff are not
technically AJAX because there is no XML - but good luck using them
without Asynchronous Javascript ;)

> The flash movie is getting back a 302 from apache, in the log i see:
>
> "POST /foo/upload/ HTTP/1.1" 302 673 "-" "Adobe Flash Player 9"
>
> Note the actual URL of the page is /foo/edit/56/56
>
> Its very strange that I can set the header manually on local machine
> but not on mediatemple. They do have a funky way of running php5.

So if I understand you correctly the form is working - the file is
being uploaded correctly and appears on the server, etc.. the only
problem is the server is returning a 302 instead of a 200?

Or.. it's not actually working?

BTW - did you see this entry: http://swfupload.org/forum/generaldiscussion/157

--~--~-~--~~~---~--~~
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: swfupload cakephp 302 error

2008-01-14 Thread rloaderro



On Jan 14, 8:47 am, booboobenny <[EMAIL PROTECTED]> wrote:
> I am hoping someone here can help me out with this one.
>
> I am using swfupload and cake, I implemented using the articles on the
> bakery as a starting point.
>
> I have a controller /foo and in that controller I have a method
> upload. So the upload url is:
>
> /foo/upload
>
> When the form submits I get a 302 error. Does anyone know a way to
> submit the form (i would prefer to avoid ajax) to /foo/upload and not
> get a 302 error.

I think the SwfUpload is meant specifically for use with AJAX. The
problem with AJAX and file uploads is that you normally need to submit
the form in order to send file data to the server. Since the page
reloads with a form submit the only previous solution was to submit
the form to a hidden iframe and parse the server response when the
iframe loads. Flash is actually a great interface for uploading files
since it doesn't require a form submit and can even provide feedback
in so far as upload progress, etc.. I don't think using SwfUpload
without AJAX would provide any benefits over using a conventional form
file input - if it even is possible.

Anyway, I implemented a similar thing using Mootools and
Swiff.Uploader and I can tell you that using the controller->log
function is invaluable for debugging. My implementation is a little
different than the one on the bakery, but if it helps, my controller
looks like:

http://pastebin.com/f457cfcf

And the component looks like:

http://pastebin.com/f2a167234

You might notice my implementation is for single files only - however
I have tested it on a number of server setups - with PHP in safemode,
root-jailing, etc.. - and it has worked for me so it might be useful
for you? Good luck!

--~--~-~--~~~---~--~~
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: How to implement code to download files

2007-05-07 Thread rloaderro

I created a component for this - based on code I found in Textpattern
CMS. Basically you pass your data (string) to the component, it
creates a temporary file in the cache and feeds the contents to the
user as a stream. Maybe it works for you:


function download($data = null, $filename = 'download', $extension =
'tab') {
if (!$data) return;

$path = 'persistent' . DS . $filename . '.' . $extension;

cache($path, $data);

$fullpath = CACHE . $path;

if (!is_file($fullpath)) {
debug("Error Download: unable to create cache at $fullpath");
die;
}

$filesize = filesize($fullpath);
$sent = 0;

header('Content-Description: File Download');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . $filesize);
header('Content-Disposition: attachment; filename="' .
basename($path) . '"');

@ini_set("zlib.output_compression", "Off");
@set_time_limit(0);
@ignore_user_abort(true);

if ($file = fopen($fullpath, 'rb')) {
while(!feof($file) && (connection_status() == 0)) {
echo fread($file, 1024 * 64);
$sent += (1024 * 64);
flush();
}
fclose($file);
}

die;
}


On May 6, 11:50 pm, Anil <[EMAIL PROTECTED]> wrote:
> Hi,
> I need the help to implement code for downloading files. If you know
> how to do that, please do me the favour.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---