Welcome to your new Wikidot site

Random Notes

I dunno how to make this publicly editable. You can contact me simoncpu at gmail.

How to upload files in Agavi Framework

14:29 < simoncpu> hi... how can i upload files in agavi?
14:29 < simoncpu> $rd->getFile() doesn't seem to work
14:38 -!- benschi [n=benjamin@78.52.189.64] has joined #agavi
14:42 < benschi> simoncpu: If sent via POST executeWrite is ya friend
14:43 < benschi> then in ze Action $rd->getFile('file')
14:44 < benschi> but be sure to validate the file first
14:47 < simoncpu> benschi: $rd->getFile('fieldname') returns null...
14:47 < simoncpu> validation is set to conditional
14:48 < benschi> simoncpu: I remember that there was something special about the form
14:48 < benschi> let me check
14:49 < benschi> enctype="multipart/form-data"
14:49 < benschi> try that
14:50 < simoncpu> <form method="post" enctype="multipart/form-data">

How to move uploaded file to desired location

$rd->getFile('foo')->move('/path/to/dest');

Agavi Filesize

I hope it's possible to strip down Agavi.

10K    ./model
 34K    ./view
612K    ./build
728K    ./config
 76K    ./controller
 24K    ./core
 76K    ./database
366K    ./date
 96K    ./exception
106K    ./filter
 52K    ./logging
200K    ./validator
 56K    ./renderer
 12K    ./action
 60K    ./response
138K    ./routing
 72K    ./storage
 92K    ./testing
3.2M    ./vendor
7.4M    ./translation
 24K    ./user
 84K    ./util
122K    ./request

vendor/ and translation/ make up 10.6MB out of Agavi's 14MB size. PHPUnit (located inside vendor/) is not needed in production environments, and some projects require only one or two languages.

Manually specifying a template in Agavi

17:11 < simoncpu> houmenta
17:11 < simoncpu> in agavi, how do you guys use the same template in both your Success and Error views?
17:11 < simoncpu> i just want to display a line of error message in my Error view
17:14 < Seldaek> $this->getLayer('content')->setTemplate('BlahSuccess');
17:14 < Xylakant> $this->getLayer('whateverthenameofyourcontentlayeris')->setTemplate('whateverthenameofyourtemplatefileis');

Redirecting a page inside a Controller

18:08 < simoncpu> i'm not sure if i'm doing this correctly, but is it advisable to redirect the page from the Controller?
18:08 < simoncpu> i mean, do i need to create a new View just to redirect a page?
18:08 < sth> In other frameworks I do it fromt he controller, I don't see why agavi would be any different.
18:09 < sth> from the*
18:09 < simoncpu> cool, cool
18:09 < simoncpu> btw, i just do a setRedirect(), right?
18:10 < sth> Sounds right, but check with the API
18:10 -!- icyt is now known as IcyT
18:11 -!- fnordfish [n=Adium@78.52.130.23] has joined #agavi
18:11 < simoncpu> $this->getResponse()->setRedirect() works inside a view but inside a controller
18:11 < simoncpu> i guess i need to check with the api
18:13 < _cheerios> in agavi you redirect in ze view
18:13 < sth> Ok Furhurer cheerios
18:14 < simoncpu> mvc purists....
18:14 < simoncpu> mwahahahaha
18:14 < sth> heh
18:15 < sth> Mind you I guess other frameworks don't have sections for the view like agavi does
18:15 < sth> Zend's version of a view is to allow you to make a .phtml file

Zen of Agavi

17:12 < simoncpu> ei, i have this epiphany a while ago
17:13 < simoncpu> i realized that web app frameworks are simply web apps... there's nothing "magical" about it
17:13 < simoncpu> then you extend the framework by adding modules
17:14 < simoncpu> the project is a subset of the framework, not the other way around
17:14  * simoncpu speaks to the wind to talk to himself
17:14 < sth> No, a app based on a framework by definition is a superset.
17:14 < sth> Since you're adding functionality.
17:15 < simoncpu> hmmmm
17:15 < sth> A subset would be taking a small group of the functionality provided in the framework
17:15 < sth> But with say, an agavi project, you're adding so it makes it a superset
17:16 < simoncpu> i think a framework is a web app that you extend... it's a skeleton web app that forces you to structure your code in a specific way
17:16 < sth> since all the original functionality is there plus more
17:16 < graste^china> agavi's not a web app since you may use it as a console ab etc
17:16 < graste^china> s/ab/app/
17:16 < sth> Yeah
17:16 < simoncpu> ah... that makes sense
17:17  * graste^china has the epiphany, that everything is just code and can be rewritten, modified, read, deleted, forgotten and rediscovered over the years... =)
17:17 < simoncpu> i have this perspective a while ago, that frameworks are "hidden underneath" the project
17:17 < simoncpu> with agavi, i realized that the framework is a part of the project
17:17 < simoncpu> something like that
17:18 < simoncpu> an action is simply a class that inherits classes from agavi
17:18 < sth> Yeah, without a doubt
17:18 < sth> But that's how MVC should be implemented
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License