views:

467

answers:

2

I am getting a Missing Helper error when I am trying to upload my cake php files to a shared host.

Undefined variable: javascript Missing Helper File

It is working fine on my local machine.

I have the following directory structure in shared hosting:(using cpanel)

/home/user/
   /app
   /cake
   /vendors
  /public _html
    /css
    /img
   /js
   .htaccess
   index.php

I have also made all the relevant changes to the index.php file and I was getting the full colored cake php intro page. The strange thing is that it is recognizing the HTML helper and hence i am able to see my web page with full CSS. However, it is giving problems with javascript and other helpers. I already have an app_controller file with all helpers well defined in $helpers =array().

Why is it giving this error??

As mentioned above, I have made changes to my cake directory structure. So, do I have to make changes to the paths.php file located in the cake/config folder?? I think that cake is not finding the javascript helper because something is messed up with config files. Is it so or there is some other problem??

A: 

in /app/app_controller.php, add:

var $helpers = array('Javascript');

your structure doesn't seem like cakephp structure :-(

Aziz
I have already given that in my app_controller. Moreover, I had to alter the directory structure in shared hosting environment as mod_rewrite was not functioning properly with the normal structure. But this is hardly a problem. I have already made changes in index.php so that cake can know where the directories are located.
Learner
A: 

Guys, I found a simple way to tackle this problem. I certainly cannot call it the solution for the problem. May be a temporary way to make things work.

I simply replaced

<?php echo $javascript->link(array('tabulator')); ?>

with the standard HTML,

<script type="text/javascript" src="/blog/js/tabulator.js"></script>

and it worked!!

I still don't know the problem with javascript helper. All other helpers, Html, Form and Ajax are working fine. I am also using Gravatar for my blog. So, the Gravatar Helper was also giving problems. The solution to this problem was weird. I renamed the helper file gravatar.php instead of Gravatar.php. This worked insipte of the fact that helper file name should begin with a capital letter according to cake naming conventions!!

I also had to solve numerous other problems like making changes to the index.php file so that cake can locate the modified directory structure.

Also, had to make changes to .htaccess file for rewriting the base and directing the blog to the new URL.

Man..so much for rapid development!! :O

Learner