Tnx Mark, This code can be optimized for 1.2.4 by looking for "thtml" extension after all paths for default "ctp" are checked.
About requestAction: I can override requestAction for controllers in AppController, models in AppModel, views by extending View class, helpers in AppHelper, but not for components. I would like to contribute to cake, but i don't know how. I think book has outdated information: http://book.cakephp.org/view/585/How-to-help-close-existing-tickets http://book.cakephp.org/view/585/How-to-help-close-existing-tickets Cake is now on git and Trac is now Chaw clone. Is there any documentation on "how to contribute" and how to commit patches and changes? On Aug 22, 5:39 pm, mark_story <[email protected]> wrote: > You can easily extend requestAction by overriding it in your > classes... There is no need for additional callbacks, just use normal > inheritance / object oriented paradigms. > > As for the view pathing, the .thtml extension is deprecated and will > be removed, we normally don't deprecate and remove all at once, as it > make migration harder. So there is often a version of compatibility. > With the additional paths I can see the cake\libs\view\plugins\pizza\ > being extra, however app/plugins/pizza provides a way to override > plugin views inside your app and offers good flexibility. > > -Mark > > On Aug 21, 11:39 am, majna <[email protected]> wrote: > > > On plain cakePHP 1.2.3.8166 installation with only one dummy "pizza" > > plugin, > > View class seeks view and element files on strange places. > > > Output of $path variable in View::_paths() > > Array > > ( > > [0] => C:\AppServ\cake\app\views\plugins\pizza\ > > [1] => C:\AppServ\cake\cake\libs\view\plugins\pizza\ > > [2] => C:\AppServ\cake\app\plugins\pizza\views\ > > [3] => C:\AppServ\cake\app\views\ > > [4] => C:\AppServ\cake\cake\libs\view\ > > ) > > > I can se many "file_exists()" in View class when profiling cake with > > xdebug, > > and I think this could be improved much. > > > Cake will seek foreach above path when rendering view or element. > > > Snippet form View::element() method: > > foreach ($paths as $path) { > > if (file_exists($path . 'elements' . DS . $name . $this->ext)) { > > $file = $path . 'elements' . DS . $name . $this->ext; > > break; > > } elseif (file_exists($path . 'elements' . DS . $name . '.thtml')) > > { > > $file = $path . 'elements' . DS . $name . '.thtml'; > > break; > > } > > > } > > > Snippet form View::_getViewFileName() method: > > foreach ($paths as $path) { > > if (file_exists($path . $name . $this->ext)) { > > return $path . $name . $this->ext; > > } elseif (file_exists($path . $name . '.ctp')) { > > return $path . $name . '.ctp'; > > } elseif (file_exists($path . $name . '.thtml')) { > > return $path . $name . '.thtml'; > > } > > > } > > > Snippet form View::_getLayoutFileName() method: > > $exts = array($this->ext, '.ctp', '.thtml'); > > foreach ($paths as $path) { > > foreach ($exts as $ext) { > > if (file_exists($path . $file . $ext)) { > > return $path . $file . $ext; > > } > > } > > } > > > My conclusion: > > 1. As you can see from snippets above, there will be many failed > > file_exists() calls. > > 2. Something is wrong with path order from which cake seeks files (see > > Output of $path from above). First two paths are strange.Is it a bug? > > 3. "thtml" extension should be deprecated for performance improvement > > (I/O) > > > Consider following scenario: > > Pizza plugin has it's own layout and "index" view with 3 elements: > > Cake will find: > > - "index" view on 7th attempt! > > - layout on 5th attempt > > - first element on 5th attempt > > - second element on 5th attempt > > - third element on 5th attempt > > ---------------------------------------- > > SUM= 22 failed file_exist, only for one view render > > If you setup additional view paths in Configure (bootstap $viewPaths > > array), things got even worse.(Many CMS apps do that) > > > This file seeking takes most of View render process time (xdebug) > > I'm not sure if this calculations are correct, please correct me. > > Other files (controller, models, helpers) are cached (paths) once > > found by App::import, > > so I thnik that view rendering logic is far from optimal. > > > PS: > > Option to extend requestAction or at least have some callback > > beforeRequestAction() would be very nice. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
