Jump to content

Get the modules dir in php module file


Recommended Posts

Hi, I have a custom module for product image enlargement that doesn't work after I enabled friendly urls.

If I check the browser console I get:


GET http://www.cosecosigioielli.com/it/gioielli-etnici/modules/blockProductSlide/css/style.css 404 (Not Found)
GET http://www.cosecosigioielli.com/it/gioielli-etnici/modules/blockProductSlide/js/module.js 404 (Not Found)


this is one the php interested lines in the module:


 $filename = _PS_THEME_DIR_.'/product-list.tpl';
 $hfd = @fopen($filename, 'r');
 $contents = @fread($hfd, filesize($filename));
 $exp1 = array('class="product_img_link"');
 $exp2 = array('class="product_img_link" rel="{$link->getImageLink($product.link_rewrite, $product.id_image1, \'home\')}"');
 $contents =  str_replace($exp2, $exp1, $contents).'<script type="text/javascript" src="{$base_dir}modules/blockProductSlide/js/module.js"></script>';
 $filename = _PS_THEME_DIR_.'/product-list.tpl';
 $hfd = @fopen($filename, 'w');
 @fwrite($hfd, $contents);


Why can't get that file from the modules dir? Have I missing something?


You can check it here: http://www.cosecosig...gento-0490.html

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...