In my CakePHP project, I put all my css and js files in the "app / webroot" folder, and index.ctp is loaded by all projects. But add.ctp and edit.ctp files are loaded without css / js files in "../webroot".
$this->layout = 'newlayout';
I put this code in my actions in the andex (), add () and edit () file in the 'controller' file.
My code is newlayout.ctp
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title_for_layout; ?></title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<link href="dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<link href="dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
<link href="plugins/iCheck/flat/blue.css" rel="stylesheet" type="text/css" />
<link href="plugins/morris/morris.css" rel="stylesheet" type="text/css" />
<link href="plugins/jvectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" />
<link href="plugins/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />
<link href="plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<link href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css" />
</head>
<body class="skin-blue sidebar-mini">
<div class="wrapper">
<header class="main-header">
<a href="#" class="logo">
<span class="logo-lg"><b>POS</b> App</span>
</a>
<nav class="navbar navbar-static-top" role="navigation">
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
</ul>
</div>
</nav>
</header>
<aside class="main-sidebar">
<section class="sidebar">
<div class="user-panel">
</div>
</section>
</aside>
<div class="content-wrapper">
<section class="content-header">
<h1>
<?php echo $this->Session->flash(); ?>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li class="active">Dashboard</li>
</ol>
</section>
<section class="content">
<?php echo $this->fetch('content'); ?>
</section>
</div>
<footer class="main-footer">
<strong>Copyright © 2014-2015 .</strong> All rights reserved.
</footer>
<div class='control-sidebar-bg'></div>
</div>
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js" type="text/javascript"></script>
<script>
$.widget.bridge('uibutton', $.ui.button);
</script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="plugins/morris/morris.min.js" type="text/javascript"></script>
<script src="plugins/sparkline/jquery.sparkline.min.js" type="text/javascript"></script>
<script src="plugins/jvectormap/jquery-jvectormap-1.2.2.min.js" type="text/javascript"></script>
<script src="plugins/jvectormap/jquery-jvectormap-world-mill-en.js" type="text/javascript"></script>
<script src="plugins/knob/jquery.knob.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js" type="text/javascript"></script>
<script src="plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>
<script src="plugins/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src='plugins/fastclick/fastclick.min.js'></script>
<script src="dist/js/app.min.js" type="text/javascript"></script>
<script src="dist/js/pages/dashboard.js" type="text/javascript"></script>
<script src="dist/js/demo.js" type="text/javascript"></script>
</body>
</html>
I checked the request response for 'add' pageload and I got this answer -
The action bootstrap is not defined in controller
and each request for the css and js file received such an error response! I have no idea!
source
share