From ea79ba81a4988cc399f34a084d0986168d7d86ee Mon Sep 17 00:00:00 2001
From: Jose Lorenzo Rodriguez
Date: Mon, 20 Feb 2012 15:39:03 -0430
Subject: [PATCH] Adding a simpler solution to the missing view files problem
without altering the built paths in App
---
.../Templates/skel/View/Pages/home.ctp | 188 ++++++++++++++++++
lib/Cake/Test/Case/View/ViewTest.php | 5 +-
lib/Cake/View/View.php | 5 +-
3 files changed, 194 insertions(+), 4 deletions(-)
create mode 100644 lib/Cake/Console/Templates/skel/View/Pages/home.ctp
diff --git a/lib/Cake/Console/Templates/skel/View/Pages/home.ctp b/lib/Cake/Console/Templates/skel/View/Pages/home.ctp
new file mode 100644
index 000000000..cb409a043
--- /dev/null
+++ b/lib/Cake/Console/Templates/skel/View/Pages/home.ctp
@@ -0,0 +1,188 @@
+
+
+
+
+ 0):
+ Debugger::checkSecurityKeys();
+endif;
+?>
+
+
+ 1) Help me configure it
+ 2) I don't / can't use URL rewriting
+
+
+=')):
+ echo '';
+ echo __d('cake_dev', 'Your version of PHP is 5.2.8 or higher.');
+ echo '';
+ else:
+ echo '';
+ echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.8 or higher to use CakePHP.');
+ echo '';
+ endif;
+?>
+
+
+ ';
+ echo __d('cake_dev', 'Your tmp directory is writable.');
+ echo '';
+ else:
+ echo '';
+ echo __d('cake_dev', 'Your tmp directory is NOT writable.');
+ echo '';
+ endif;
+ ?>
+
+
+ ';
+ echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit APP/Config/core.php ', ''. $settings['engine'] . 'Engine');
+ echo '';
+ else:
+ echo '';
+ echo __d('cake_dev', 'Your cache is NOT working. Please check the settings in APP/Config/core.php');
+ echo '';
+ endif;
+ ?>
+
+
+ ';
+ echo __d('cake_dev', 'Your database configuration file is present.');
+ $filePresent = true;
+ echo '';
+ else:
+ echo '';
+ echo __d('cake_dev', 'Your database configuration file is NOT present.');
+ echo '
';
+ echo __d('cake_dev', 'Rename APP/Config/database.php.default to APP/Config/database.php');
+ echo '';
+ endif;
+ ?>
+
+
+
+ isConnected()):
+ echo '';
+ echo __d('cake_dev', 'Cake is able to connect to the database.');
+ echo '';
+ else:
+ echo '';
+ echo __d('cake_dev', 'Cake is NOT able to connect to the database.');
+ echo '
';
+ echo $connectionError->getMessage();
+ echo '';
+ endif;
+ ?>
+
+
+';
+ echo __d('cake_dev', 'PCRE has not been compiled with Unicode support.');
+ echo '
';
+ echo __d('cake_dev', 'Recompile PCRE with Unicode support by adding --enable-unicode-properties
when configuring');
+ echo '
';
+ }
+?>
+
+
+
+To change its layout, create: APP/View/Layouts/default.ctp.
+You can also add some CSS styles for your pages at: APP/webroot/css.');
+?>
+
+
+
+
+ Html->link(
+ sprintf('%s %s', __d('cake_dev', 'New'), __d('cake_dev', 'CakePHP 2.0 Docs')),
+ 'http://book.cakephp.org/2.0/en/',
+ array('target' => '_blank', 'escape' => false)
+ );
+ ?>
+
+
+ Html->link(
+ __d('cake_dev', 'The 15 min Blog Tutorial'),
+ 'http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html',
+ array('target' => '_blank', 'escape' => false)
+ );
+ ?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php
index cdeca753f..1ea1d70ef 100644
--- a/lib/Cake/Test/Case/View/ViewTest.php
+++ b/lib/Cake/Test/Case/View/ViewTest.php
@@ -395,7 +395,7 @@ class ViewTest extends CakeTestCase {
$View = new TestView($this->Controller);
$paths = $View->paths();
- $expected = array_merge(App::path('View'), App::core('View'));
+ $expected = array_merge(App::path('View'), App::core('View'), App::core('Console/Templates/skel/View'));
$this->assertEquals($paths, $expected);
$paths = $View->paths('TestPlugin');
@@ -404,7 +404,8 @@ class ViewTest extends CakeTestCase {
CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
$pluginPath . 'View' . DS,
CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS,
- CAKE . 'View' . DS
+ CAKE . 'View' . DS,
+ CAKE . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'View' . DS
);
$this->assertEquals($paths, $expected);
}
diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php
index 6142b8fc2..f2ae7372c 100644
--- a/lib/Cake/View/View.php
+++ b/lib/Cake/View/View.php
@@ -1082,7 +1082,8 @@ class View extends Object {
}
$paths = array();
$viewPaths = App::path('View');
- $corePaths = array_flip(App::core('View'));
+ $corePaths = array_flip(array_merge(App::core('View'), App::core('Console/Templates/skel/View')));
+
if (!empty($plugin)) {
$count = count($viewPaths);
for ($i = 0; $i < $count; $i++) {
@@ -1099,7 +1100,7 @@ class View extends Object {
$count = count($paths);
for ($i = 0; $i < $count; $i++) {
if (strpos($paths[$i], DS . 'Plugin' . DS) === false
- && strpos($paths[$i], DS . 'Cake' . DS . 'View') === false) {
+ && strpos($paths[$i], DS . 'Cake' . DS) === false) {
if ($plugin) {
$themePaths[] = $paths[$i] . 'Themed'. DS . $this->theme . DS . 'Plugin' . DS . $plugin . DS;
}