I am trying to use the Media Plugin (http://www.ohloh.net/p/cakephp-media)
I placed the media folder contents in app/plugins/media
then in bootstrap.php in the app/config/ folder added the following code.
Configure::load('media.core');
Now when i run any controller and any action am getting the following error.
Configure::load() - no variable $config found in core.php [CORE\cake\libs\configure.php, line 266]
I am using Cakephp 1.3.7
loading config files with cakes Configure::load() has a requirement that the configs be in a variable called $config
eg
<?php
$config['Meh'] = array('foo' => 'bar');
?>
Related
Pardon me as this is my first questions.
I tried to install a plugin for haml in cakephp 3 manually, and found this k-motoyan/cake-haml
I can't install it using composer because I use cakephp 3.3.*
k-motoyan/cake-haml dev-master requires cakephp/cakephp 3.0.*-dev ->
no matching package found.
So, I tried to install it manually, downloading the zip and put it in [app]/plugins/kmotoyan/cakephp
I follow the readme setup
Setup
Add plugin load line to config/bootstrap.php file:
diff
+ Plugin::load('CakeHaml', ['bootstrap' => true]);
Set the default ViewClass on the src/Controller/AppController.php
file:
```diff class AppController extends Controller {
public $viewClass = 'CakeHaml\View\CakeHamlView'; ```
You can use haml on all your view files with .haml extension.
and put this code below in my config/bootstrap.php
Plugin::load('kmotoyan/CakeHaml', ['bootstrap' => true]);
and this code below in my src/Controller/AppController.php
public $viewClass = 'CakeHaml\\View\\CakeHamlView';
when I load the server, i get this error
Error: Class 'CakeHaml\View\CakeHamlView' not found File
C:\xampp\htdocs\qolega\vendor\cakephp\cakephp\src\View\ViewBuilder.php
Line: 363
when I see line 363 there's this line
return new $className($request, $response, $events, $data);
what should I do?
I'm having troubles to compress my Javascript files using Asset Compress Plugin for CakePHP 2.X. I'm currently using CakePHP 2.2.2 over IIS 7.
It tries to add the compressed js file but it doesn't exist:
<script type="text/javascript" src="/cakephp/cache_js/jquery-combined.v1379067166.js">
I have downloaded and placed the plugin under app/Plugin/AssetCompress/
I have dowloaded YUI build tool and placed the file contained in lib/yuicompressor/yuicompressor-2.4.2 in vendors/yuicompressor/
I have made the folder webroot/cache_js/ writable.
This is my asset_compress.ini:
[General]
cacheConfig = false
[js]
timestamp = true
path = WEBROOT/js/*
cachePath = WEBROOT/cache_js/
filters[] = YuiJs
[jquery-combined.js]
files[] = jquery.tipsy.js
files[] = web.js
And I am adding the plugin in bootstrap like this with debug mode set to 0:
Configure::write('Dispatcher.filters', array(
'AssetDispatcher',
'CacheDispatcher'
));
CakePlugin::load('AssetCompress', array('bootstrap' => true));
Also, I'm loading it from the AppController:
var $helpers = array('AssetCompress.AssetCompress');
And using it on the layout template in this way:
echo $this->AssetCompress->script('jquery-combined');
The only error I'm getting on the error.log is the following one:
2013-09-13 14:16:10 Error: [MissingControllerException] Controller
class CacheJsController could not be found.
C:\inetpub\wwwroot\cakephp\app\webroot\index.php(92): Dispatcher-> dispatch(Object(CakeRequest), Object(CakeResponse))
C:\inetpub\wwwroot\cakephp\index.php(42): require('C:\inetpub\wwwr...')
{main}
Any clue about what can be happening?
Should I have Java SDK installed ? Am I picking the wrong .jar file from YUI?
Thanks.
Before you can set debug = 0 you need to use the CLI tool to build static versions of the assets. I'm pretty sure this is in the documentation.
I'm very new to Fat-Free and Backbone.js. I've been searching and reading articles and searching and reading articles trying to find a way to route to individual PHP files containing the database communications. The code below works, and I can use it, but it seems hackish. Is there a way to call an external PHP file (in the server/models/ directory) and a specific method from the $f3-route(...) line?
<?php
// File: /index.php
define("PATH",1);
$f3 = require('server/fatfree/lib/base.php');
$uri = explode('/', $_SERVER["REQUEST_URI"]);
require_once "server/models/{$uri[PATH]}.php";
$f3->route('GET /hello/#file', 'HelloModel->doSomething');
$f3->route('GET /project/#file', 'ProjectModel->doSomething');
$f3->route('GET /book/#file', 'BookModel->doSomething');
$f3->run();
?>
Thanks a lot for your advice.
You should add the server/models directory to the autoloader of F3 using the autoloader feature.
$f3->set('AUTOLOAD','server/models/');
That way, the required source files of your classes will be loaded on demand. However, note that the files must be named the same as your class, i.e. class Foo has to be defined in foo.php or Foo.php. The case of the filename does not matter.
I'm using AssetCompress v0.5 from the 1.3 branch and the dynamic built is not working. I've done the following so far:
Downloaded and copied the asset_compress folder into my app/plugins folder
Copied the config.ini and renamed it to app/config/asset_compress.ini
Created 2 CSS and JS bundles named public and logged (so 4 in total)
Added AssetCompress.AssetCompress in my $helpers array in my AppController
Changed my default.ctp layout file to: echo $this->AssetCompress->css('public'); echo $this->AssetCompress->css('logged'); (same for ->script())
The output error is:
Error: The requested address '/asset_compress/assets/get/public.css' was not found on this server.
What am I missing?
Ok, I figured it out.
It was because I was using the CssMin filter and I did not download it and put it into the vendor folder. As the plugin seems to be turning the debug level to 0, I did not see the error, until I put a Configure::write('debug', 2); into the beforeFilter().
I am using cakePHP 1.26 and TinyMCE v3.38.
The .js file of the TinyMSC is stored under this directory:
http://www.mysite/js/tiny_mce/tiny_mce.js
In the page where the users can post new topic,
the URL of this page is like this:
http://www.mysite/user/newpost
Now I need to add the javascript to this page, and I have tried these:
echo $javascript->link('/js/tiny_mce/tiny_mce.js');
echo $javascript->link('js/tiny_mce/tiny_mce.js');
echo $javascript->link('../js/tiny_mce/tiny_mce.js');
But the tiny_mce.js can not be reached.
I believe that Cake already knows that your javascript is in /js/ through using the $javascript->link() structure in the first place - so try
echo $javascript->link('tiny_mce/tiny_mce.js');
and see if you get anywhere.