I've never had problems with CakePHP's theming system in the past, but now, errors galore. My main issue is that all theme resources (those in /app/views/themed/MyTheme/webroot/*) fail to load. I've set up a custom AppController in /app to set the theme.
var $view = "Theme";
var $theme = "MyTheme";
When I go to any page, I can see that it's utilizing my theme's default.ctp layout and the HTML is fine. Any and all page resources, CSS, JavaScript, images, anything in the theme webroot, fails to load and instead gives me an error like the following (let's say I tried to access http://example.com/theme/MyTheme/img/bg.png):
Error: ThemeController could not be found.
Error: Create the class ThemeController below in file: app/controllers/theme_controller.php
<?php
class ThemeController extends AppController {
var $name = 'Theme';
}
I've never received an error like this in my time with CakePHP. I'm running the latest stable version at 1.3.7.
I've finally found a solution. CakePHP didn't like my uppercase theme name. In fact, any theme name that I tried that included uppercase characters failed to work. I changed my folder name and internal theme name from "MyTheme" to "my_theme" and it worked perfectly. Could possibly be a bug, but it could be undocumented, yet expected functionality.
Related
Ive been trying for hours to figure out why this magento install will not work. At first it may look like a normal error and im missing a file, but in reality thats not the case. The controller
FME_Manufacturers_Controller
doesn't exist anymore and i'm sure its from an old extension. I cant seem to find anything in the codebase that has to do with the FME controller and I was wondering if this controller can be called from the database. If so, what table? The error is from line 93 in /lib/Varien/Autoload.php
Magento loads controllers and its action like so:
// #see Mage_Core_Controller_Varien_Router_Standard::match
// instantiate controller class
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
First to find the place where the controller is loaded from you could search your Magento installation for Mage::getControllerInstance('FME_Manufacturers for example.
Second is you could look for lines like <?php echo $this->getUrl('frontname/controllername/action') ?>. Often this is used in templates to call controllers and their actions.
Another thing is, if you follow the error backtrace you should be able to see there this call comes from, shouldn't you?
To call a controller from database is not possible. The only thing is that a static block or a CMS page is including a template and in this template the controller is called. But you would find this place by scanning through all template files in app/design looking for FME.
I had ReDJ plugin v 1.6 working on 2.5 Joomla site. But I'm moving on Joomla 3 and this module don't work now - exception errors appears. In change-logs I found this:
Changed class names for ALL models, controllers and views. So I simply add Legacy suffix to all classes that handles exceptions. And also change JRequest (it is deprecated in v3) on $input=JFactory::getApplication()->input;.
So for now, seems like all is working fine. Except.. component admin panel - i can see component menu, but there is no any content on page.
Here is screenshot: http://tinyurl.com/btfzxux
Main controller controller.php code:
http://pastebin.com/vQjYvYkK
Main component file redj.php code:
http://pastebin.com/gF6icdE3
I found that dont work line parent::display(); in controller.php file. And there is no error in logs and display.
And this line calls JControllerAdmin->display() which is:
/**
* Display is not supported by this controller.
*......................
*......................
*/
public function display($cachable = false, $urlparams = array())
{
return $this;
}
So nothing displayed. I tried to rename extends definition as JControllerLegasy (because it supports display() method), but still nothing in component output.
How can i output component content in admin panel in Joomla 3?
Any help appreciated.
S.G.
UPDATE 1:
I publish my code on GitHub. I'm tying to optimize this plugin for Joomla 3. Any help welcome!
https://github.com/staniaslavg/ReDJ
P.S. Now redirection list displays and adding a new one works fine. But.. there is no items in item list.
UPDATE 2:
Finally, everything works fine (tested jnly by me, but seems like everything is OK..)
P.S. If nothing displays in tabs - check for DataBase columns. I added a few more. Check whis by var_dump errors variable (like $this->get('Errors')) in files views/.../view.html.php
Code on GitHub: https://github.com/staniaslavg/ReDJ
I've posted some updates in the github repo, to show that it's possible to get it working. (for the redirects view sequence). Unforunately some code used in Joomla! 2.5 by the component was already deprecated and was removed in 3.0. Also the GUI looks bad in 3.0, it needs more work.
As much as I would like to help you to get it running, the time involved it huge. I would strongly suggest using Joomla! 2.5 which is still for a good period supported.
Also the developer announces that a Joomla! 3.0 version is underway.
Going over all the code and fixing it makes little sense for me, but here are some examples:
JDatabase::getEscaped() has been removed. Use JDatabase::escape() instead.
$db->getEscaped($orderCol.' '.$orderDirn)
=> $db->escape($orderCol.' '.$orderDirn)
JToolBar no longer supports the 'X' functions (eg, addNewX, editListX) that hide the main menu before doing the function.
and others.
I am using Code Igniter, The HMVC library, and Smarty with this library.
Smarty is working fine by default, however if I try to use smarty's inheritance feature ( {extends file="master.tpl"}) then we run into an issue.
The extends feature does not look in the module views folder for the extended file (in the above's case master.tpl), instead it only looks in the application/views/ folder and throws an error if it cannot find it.
I could add APPPATH."modules/smartytest/views" to the $config['template_directory'] array in the smarty config file. but that throws an error for each item in the array it checks first for the file. filemtime(): stat failed for application/views/master.tpl
and that has the added issue of, if I have three modules all the the array and the modules all have a master.tpl then no matter what module I call the extend from it will load the first one found.
So, is there a way to get smarty's extend function to behave nicely with the HMVC modules?
Ah, found a working solution,
in My_Parser.php edit the block at line 30 so it reads:
// Modular Separation / Modular Extensions has been detected
if (method_exists( $this->CI->router, 'fetch_module' ))
{
$this->_module = $this->CI->router->fetch_module();
//add the current module view folder as a template directory
if ($this->_module !== '')
$this->CI->smarty->addTemplateDir(APPPATH."modules/".$this->_module.'/views');
}
The one drawback of this method is that smarty will look in your application/views folder before the module views folder. if someone knows a solution to that then it would be fantastic.
The problem is that CI is not checking error_reporting() returns 0, because Smarty is using the # control operator:
So add the line at the top of the function "_exception_handler":
if (error_reporting() == 0) return;
To the "Common.php" file in the "_exception_handler" function (line 469), or create your own function with the same name before calling "CodeIgniter.php" in the index.php file.
Best!
So I'm new at this whole CakePHP thing, but I'm looking to get the Uploader plugin installed. I'm stuck at the first installation step, after download/placing the files in the correct place: http://milesj.me/code/cakephp/uploader. I see this is the code I need to add somewhere:
// CakePHP 2
CakePlugin::load('Uploader');
App::import('Vendor', 'Uploader.Uploader');
$this->Uploader = new Uploader();
But I don't know where to put it! I'm using the basic "Blog tutorial", but I changed the name from "Posts" to "Media". Where would I put this code to get the plugin included? I'm not sure on the rest of the steps either, so if anyone could help me with that in terms of the default "Blog tutorial" setup, that'd be awesome. Thanks!
EDIT: I have the CakePlugin part working. I'm just unsure about the App:import line. I keep trying to add it inside my MediaController class, but it's just throwing errors. Where would this line go?
EDIT: App:import line is working, now I just need the new Uploader() part
I havn't used this specific plugin, but I have used one similar (MeioUpload).
The CakePlugin::load('Uploader') goes in your bootstrap configuration file (app/config/bootstrap.php)
App::import and the creation are likely to be handled within your "Media" controller.
For example. My Cake App uses App::uses('Sanitize', 'Utility'); in its PostController.
EDIT:
I assume it would be something like this.
<?php
App::import('Vendor', 'Uploader.Uploader');
class MediaController extends AppController {
$this->Uploader = new Uploader();
/* The rest of the controller */
}
But I could be wrong. The explanation for that plugin is weird.
I am learning how to use codeIgniter as my php framework. I am reading through the documentation and watching the intro video and just generally following along with the first tutorial, but it's not working for me.
I have created a controller called "test.php" and a view called "test_view". The controller for this class is exactly like "welcome.php" and the view file just has some static html. However, when I go to index.php/test I get a 404 error.
I have also tried manipulating the original welcome files so that instead of calling a view it just echos "testing", yet I still see the original welcome message! I've tried clearing my browsing cash and refreshing, but to no avail.
Any suggestions? Thanks.
Edit: Here's the code for controllers/test.php
<?php
class Test extends Controller {
//Just trying to get it to echo test
public function index()
{
echo "test";
//$this->load->view('test_view');
}
}
?>
Try looking at this page in the documentation - this might solve your problem.
This basically means you should try typing index.php?/test/ instead (notice the question-mark).
First of all, check the above link. Might be useful.
If not, then...
Try changing the default controller in the config file ('routes.php') to something else (probably, to 'test'), then try loading index.php. Just to test whether the whole system works (or not).
Check whether mod_rewrite is loaded (in your server .conf-file, if you're using Apache).
Try using the latest build of the framework. AFAIK, the name of the controller class for now is "CI_Controller".
Finally, try removing the word 'public' before the declaration of the function. AFAIR, CI enable you to make private functions in controllers just by using prefix (which is set in the config file) at the beginning of the name of the function (thus making all the other functions public).
But most certainly the problem is with the mod_rewrite. If not, try debugging with die('Page found'); instead of echo - this will allow you to track possible redirects on the page.