Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Using file include in define('TEXT_INFORMATION', '')


Guest

Recommended Posts

Hi,

 

Just wonder if it is possible in PHP to include a file. something like:

define('TEXT_INFORMATION', '<!--#include virtual="somepage.html" -->')?

 

Then it would be much easier to maintain the site.

 

Thanks.

 

Brenda

Link to comment
Share on other sites

osCommerce pages include bunches of files, that's why it has an includes directory. Look at includes/column_left.php for an example of a file that includes other files and is itself included by files.

 

I'm not sure that I understand what you want to do. Do you have a more concrete example? How would you want to use this if it were available?

 

Thanks,

Matt

Link to comment
Share on other sites

Hi Matt,

 

O.k. I will try to explain a little better:

 

In conditions.php, I am today filling out this line

define('TEXT_INFORMATION', 'Put here your Conditions of Use information.');

?>, with a lot of text/html-code replacing 'Put here....information.'). I do this by building the html-code in Macromedia, whereafter I cut and paste the code to this string. The other file I call conditions.html.

 

I cannot open conditions.php in Macromedia and see the formatted page, so when I have to make changes, I need do this in conditions.html, copy/paste to conditions.php, which I find rather timeconsuming.

 

Would be much easier to somehow write ('TEXT_INFORMATION', 'Include conditions.html');

 

Brenda

Link to comment
Share on other sites

Try

define('TEXT_INFORMATION', '<object data="conditions.html">Server error:  could not display conditions.html.</object>');

Note: conditions.html will need to be in your root directory this way. You might prefer to say something like "catalog/includes/languages/english/conditions.html".

 

The browser will display the outermost <object... </object> pair that it can. If it displays the Server error text (feel free to change this to something else if you prefer), then there was a problem accessing conditions.html

 

Hth,

Matt

Link to comment
Share on other sites

Thanks Matt,

That seems to be just what I was looking for. However, for some reason I cannot make it work. Not sure how to address my root, but I have tried to place conditions.html almost everywhere without the expected result :?

 

Brenda

Link to comment
Share on other sites

I looked into this a bit more. If I use the above code and place conditions.html in my catalog directory (the same place as index.php, stylesheet.css, etc.), it works--in Mozilla. Unfortunately, it doesn't display in IE6.

 

This code

define('TEXT_INFORMATION', '<iframe src="conditions.html" frameborder="0">Sorry, your browser does not support the iframe element.  Please go to <a href="conditions.html">this page</a> instead.</iframe>');

will work in IE6 (and Mozilla).

 

Haven't tested the failover code at all, so I don't know if it is right or not.

 

Hth,

Matt

Link to comment
Share on other sites

  • 4 years later...
  • 4 weeks later...
To provide a solution to this questions, this works:

 

$text = @file_get_contents(DIR_WS_LANGUAGES . $language . '/your-file.html');
define('TEXT_INFORMATION', $text);

 

Thank you very very much for that code Lokust.

 

It's changed my life!

 

Flo

Link to comment
Share on other sites

  • 6 months later...
Hi, i used that code , but the result is a blank page..can someone pls advise?

 

 

I got the following error

 

The page isn't redirecting properly

 

 

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

 

* This problem can sometimes be caused by disabling or refusing to accept

cookies.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...