Jump to content

Recommended Posts

Hi everybody.

 

 

I have used override in my shop to load some css and javascript on my custom theme.

 

on wamp server everything work's as well ( exept some pages that javascript does'nt load there ) . :mellow:

 

but since i moved my shop from local to live server 

 

"FrontController.php" that i have made on >> override/controllers/front, cause white screen and so long as FrontController.php is Exist on server this problem persist.

i tried to attach javascript files to header.tpl but they doesn't load by this way too.

 

here is my FrontController.php content :

<?php

class FrontController extends FrontControllerCore
{
    public function setMedia()
    {
        parent::setMedia(); // JS and CSS files
		$this->context->controller->addJS(_THEME_JS_DIR_.'jquery.easydropdown.js','all');
		$this->context->controller->addJS(_THEME_JS_DIR_.'mychanges.js','all');
		$this->context->controller->addJS(_THEME_JS_DIR_.'icheck.min.js','all');	
		$this->context->controller->addCSS(_THEME_CSS_DIR_.'skins/square/red.css','all');
		$this->context->controller->addCSS(_THEME_CSS_DIR_.'easydropdown.flat.css','all');
		$this->context->controller->addJS(_THEME_JS_DIR_.'jquery.tipsy.js','all');
		$this->context->controller->addCSS(_THEME_CSS_DIR_.'tipsy.css','all');
		
		
    }
}


please help me solve this problem.

appreciate any suggestion

thank you

Edited by the_raven (see edit history)
Link to comment
Share on other sites

Dear Nemo,

 

as you said i changed the code this :

<?php

class FrontController extends FrontControllerCore
{
    public function setMedia()
    {
        parent::setMedia();
		$this->context->controller->(_THEME_JS_DIR_.'jquery.easydropdown.js');
		$this->context->controller->(_THEME_JS_DIR_.'mychanges.js');
		$this->context->controller->(_THEME_JS_DIR_.'icheck.min.js');	
		$this->context->controller->(_THEME_CSS_DIR_.'skins/square/red.css');
		$this->context->controller->(_THEME_CSS_DIR_.'easydropdown.flat.css');
		$this->context->controller->(_THEME_JS_DIR_.'jquery.tipsy.js');
		$this->context->controller->(_THEME_CSS_DIR_.'tipsy.css');
		
		
    }
}

but the problem still persist.

 

can you explain me what is the main reason that this codes works on local but not on Live server  ?

 

and can you give me some guidance for load this javascript and css files into my theme ?

i searched alot but i couldn't find a good and appropriate way to do that . even the override is not a good way in my idea , because it is separated from theme and if you move the theme you will lost some codes..

 

thank you

Link to comment
Share on other sites

  • 1 month later...

Try this

<?php
 
class FrontController extends FrontControllerCore
{
    public function setMedia()
    {
        parent::setMedia();
	die('here');
		
		
    }
}

Go to cache/ and erase class_index.php.

 

See if it dies then

 

what does die do ?? 

 

_____

finally i did "PSfever.com" advise and added single line to main frontController.php and problem solved .

 

now i have js files loaded in my shop but i recently i upgraded my shop to 1.5.2.6 and I have loosed  all the changes !! 

 

i think it can has a better way !

Link to comment
Share on other sites

×
×
  • Create New...