Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Tiny MCE and Information boxes throwing me Division by zero error!


Guest

Recommended Posts

Posted

I am trying to add the ability for my clients to add/delete/alter text within information boxes but each time I do I get the following error message:

 

Warning: Division by zero in H:\Program Files\EasyPHP 2.0b1\www\raid\catalog\includes\boxes\postage.php on line 37

 

The code I am using is:

<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

 // new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('text' => '

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFINE_MAINPAGE);

');

 new newinfoBox($info_box_contents);
?>

 

I am trying to use the Tiny MCE contribution, can anyone help?

Posted
I am trying to add the ability for my clients to add/delete/alter text within information boxes but each time I do I get the following error message:

 

Warning: Division by zero in H:\Program Files\EasyPHP 2.0b1\www\raid\catalog\includes\boxes\postage.php on line 37

 

The code I am using is:

<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

 // new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('text' => '

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFINE_MAINPAGE);

');

 new newinfoBox($info_box_contents);
?>

 

I am trying to use the Tiny MCE contribution, can anyone help?

 

the problem is the '/' in the line with the require(). the first single quote ends the string that was started with the array('text'=>', so the / is taken as a divide and the string is following it is translated to a numeric zero, giving you the divide by zero. syntacticly, this is correct but i'm sure it's not what you want. check your install instructions in this area. it looks like you missed a step or two.

Posted

Thank you Dave for explaining the problem, I did search through Google but this error seems to range from the coding to what the solution is!

 

I haven't missed a step in the instructions because the contribution wasn't meant for what I am trying to do but I need it to do it. Can you suggest how I go about doing it without getting an error? Maybe there is another way to write the code so it calls for the information from inside of the file?

 

Thank you :D

Posted
Thank you Dave for explaining the problem, I did search through Google but this error seems to range from the coding to what the solution is!

 

I haven't missed a step in the instructions because the contribution wasn't meant for what I am trying to do but I need it to do it. Can you suggest how I go about doing it without getting an error? Maybe there is another way to write the code so it calls for the information from inside of the file?

 

if you simply want the contents of that file as the text within the box, try the following (stanard disclaimer: i haven't tested this but i think it'll do what you want based on your description):

$info_box_contents[] = array('text' => file_get_contents(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFINE_MAINPAGE));

 

this assumes that $language is set to 'english' or 'spanish', etc. as your language selection dictates - *not* the languages_id such as 1 or 2, etc.

 

i'm still not sure this is what you want. this will only take the contents of that file. if that file is a .php file, it will not execute the php code...only output the code. but if the file only contains html, then this might get you where you want to go.

 

i hope this helps.

Posted

THANK YOU!!!!!

 

That worked perfect. What I do for my clients is install multiple Define Mainpage Contribution onto the website so they are able to update the content of their home page, contact page and any other pages which I create by hand for example maybe an about us page and a Terms & Condition page etc. What I needed is the code above so they can edit information boxes from the admin section without the need of messing about with the FTP and core files etc.

 

THANK YOU AGAIN!!!!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...