Be sure to review the changes made to the blog tutorial.
Some specific changes to note we pass model names in inputTag().
was: $html->inputTag('title', 40)
now: $html->inputTag('post/title', 40)
Also in the tagErrorMsg() we pass the model name.
was: $html->tagErrorMsg('body', 'Body is required.')
now: $html->tagErrorMsg('post/body', 'Body is required.')
https://trac.cakephp.org/wiki/Cake/Tutorials/BlogPosts
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@306 3807eeeb-6ff5-0310-8944-8be069107fe0
It looks like the way you where coding it was to be used as a Singleton.
In Controller::render() I am setting all View() attributed by pass reference.
I do not think it will effect other parts of the system.
You can see why I did this by uncommenting the print_r function in View::render().
Reload url in browser.
Then in Controller::render() remove the & from:
$view->autoRender =& $this->autoRender;
This is the only one that seems to cause array to print.
This may also caused in the Router::connect().
Look at this if you get time.
I noticed that each setting in the conf/routes.php file calls outer::connect();
Tee profiler show this happening 6 times on current install from trunk
Router::parse() is called 2 times.
We really need to get some good unit test in place.
Also speeded things up a little.
Profiler test:
Before changes on default install from trunk
Between:
Total Request Time: 13013.4 Milliseconds
Total Request Time: 13065.84 Milliseconds
28 files
After changes
Between:
Total Request Time: 10230.99 Milliseconds
Total Request Time: 10511.59 Milliseconds
27 files
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@304 3807eeeb-6ff5-0310-8944-8be069107fe0
The first one is for consistency (no UppperCase filenames, please), the second is because while I'm no enemy of application security, the application has to be safe _after_ it's written, not before. And to easily write an application, the developer should have the DEBUG mode set to 1 or 2.
Other than that, I think it's a very good idea to put the tag generators in helpers :)
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@271 3807eeeb-6ff5-0310-8944-8be069107fe0
I am not finished with copying methods out of template.php, but it will come - also data validation would not be a problem helpers inclusion happens in the Template::_render().
Also, there was a bug with error functions (as Controller::missingView) - on linux, calling $this->render('../errors/missingController'); rsulted in an error - beacouse apparently is_file() cannot work with '..'. I added a simple fix in Template::_getViewFn.
I've also made some cleanups. Will continue to work tonight.
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@264 3807eeeb-6ff5-0310-8944-8be069107fe0
- Time::daysAsSql returns SQL limits for a set of days, perhaps should be in DBO,
- cleanups
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@259 3807eeeb-6ff5-0310-8944-8be069107fe0
- "public" cannot be defined as constant (PHP5 keyword)
- Cannot re-assign $this in libs/template.php on line 217...
Other:
- Started on refactoring as described in #27 - but this feels like fooled aproach. We need to modularize HTML and AJAX stuff to be included only on-call.
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@256 3807eeeb-6ff5-0310-8944-8be069107fe0
The point is to provide custom error messages for Cake. As you will see, the quality of documentation is astounding.
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@255 3807eeeb-6ff5-0310-8944-8be069107fe0
- added a new class, File, currently only used by the Log class and Compressed CSS (CCSS) caching; aims to support easy reading and writing of files
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@252 3807eeeb-6ff5-0310-8944-8be069107fe0
- Dispatcher sets a Controller::here variable with the real URL used to access the page, so that tag generators can that use an url (linkTo and formTag for example) use the real url, not guess it from the controller and action names which often fails
- Log class works more reliably and a LogError() shortcut function was added
- Nstring class added, to store string-related functions (there are just four yet, including a random password generator and an string-to-array splitter
- SimpleTest library (with Rephlux) included in /vendors; I've tweaked SimpleScorer::inCli() function, because it didn't work on my setup, it should work everywhere now (it checks for empty REQUEST_METHOD, which should only be empty in CLI)
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@248 3807eeeb-6ff5-0310-8944-8be069107fe0
- new Controller::linkEmail() tag generator, with binary encoding (not UTF-8 compatibile)
- Controller::parseHtmlOptions() accepts a new second parameter -- options to exclude
- fixed DBO::farr() (ticked #23)
- fixed and cleaned up DBO layers NEEDS TESTING!
- fixed Template::renderElement(), it didn't use the controller's view vars
- models are loaded only if a database configuration is present
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@247 3807eeeb-6ff5-0310-8944-8be069107fe0
- vendor() function to load a vendor library
- uses() is simple again
- config() treats database config differently (needs to because database config is a class, not a great idea after all)
- moved DBO layers into their own subfolder in /libs -- there's too many of them already
- AdoDB and Pear::DB support much better, although needs testing
- fixes in Flay URL parsing
- Model::findAll() uses the new DBO::selectLimit() method for wider database compatibility
- changed Template::_page_title into _pageTitle
- /public/index.php cleaned up
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@245 3807eeeb-6ff5-0310-8944-8be069107fe0
- Link tag generator fixed for compatibility with XHTML (& => &)
- prepare() and tables() methods renamed to prepareField() and tablesList() in database layers, prepare() and tables() meta-methods created in Model. The first one so that prepare() can accept both strings and arrays, the second one to fix Ticket #26 (case-sensitive table names didn't work for DB2).
- Few minor changes of includes() to requires() and the other way, to prevent unnecessary program terminations, and potential crashes.
- Time::toAtom() and Time::toRss() to format dates for XML feeds.
- Some code cleanups (unnecessary __construct()'s), also, I'm changing the parentheses into:
if (true)
{
}
I hope that's ok with everybody? I find it easier to understand code with that formatting. Does anyone know a highly configurable tool that would format PHP code automatically?
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@241 3807eeeb-6ff5-0310-8944-8be069107fe0
- Controller accepts $params as a constructor parameter (for Larry).
- DBO::prepare() returned an array even when a string was passed to it, fixed.
- Flay and Folder tests fixed, DBO_Factory test disabled (no database config by default, so do database access to test).
-
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@238 3807eeeb-6ff5-0310-8944-8be069107fe0
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
Added docblocks to some methods that were missing in the trunk/cake/libs/basics.php
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@224 3807eeeb-6ff5-0310-8944-8be069107fe0
- A limit (default: 200 lines) on query log size in DBO.
- A fix for Flay's url guessing.
- Removed application specific code from /libs/legacy.php
- A fix for /libs/model.php
- An unfinished /libs/dbo_pear.php; if anyone can help out finishing it, it would be great -- I don't know Pear::DB too well
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@218 3807eeeb-6ff5-0310-8944-8be069107fe0
- default set of routes no longer routes all unknown requests to Pages controller (/pages/* is used now for that)
- Pages::index is used as default home, I'll try to make it read all the controllers and methods and present them as a website menu
- added tag definitions for cssTag and charsetTag
- extended NeatArray class with some more methods
- DbFactory auto-loads database configuration
- missing error message added (for no action set)
- /logs directory added (at least, I hope)
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@165 3807eeeb-6ff5-0310-8944-8be069107fe0
- Helpers for controllers -- each controller has it's own helper in the /app/helpers directory
- /logs and /modules directories
- The application runs just fine without /config/database.php if controllers don't ask for db access
- Changed the name of /public/dispatch.php to /public/index.php, it's nicer and more standard, won't you agree? Kamil's fix for no-mod_rewrite needs to be re-implemented
- Cleanups, fixes, and even one or two comments ;)
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@158 3807eeeb-6ff5-0310-8944-8be069107fe0