Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Php Include


stephenmarron

Recommended Posts

Hi everyone,

 

I asked for your help with a php include some time ago, and got a great solution to put the <include> on the index.php file on the root of my website so that i could give my client access to the included file to edit text....

 

The client has now requested a number of languages, and by using the <included file> on the root,i am limited to english.

I have to be able to reference this include file from /public_html/includes/languages/english/index.php

Something like the below...

 

<?php


define('NAVBAR_TITLE', 'TEST');
define('HEADING_TITLE', 'TEST');

define('TEXT_INFORMATION', '' . include("http://www.xxx.ie/textenglish/index.html") . '');

?>

 

or even mabye something like the below might work using DIR_WS.... ANy ideas...anyone????

<?php


define('NAVBAR_TITLE', 'TEST');
define('HEADING_TITLE', 'TEST');

define('TEXT_INFORMATION', '<?php echo(DIR_WS_TXTENGLISH . FILENAME_ENG_INDEX_HTML); ?>');
?>

 

Many thanks

Steve

Link to comment
Share on other sites

I don't understand the question. Are you needing to have multiple languages on the same page? Oscommerce is set up to handle any number of languages. Will that not work for you?

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Jack has a point, check out http://oscommerce.info/kb/osCommerce/Admin...ocalization/163 for more info.

 

Hi Guys,

The site is live and i called www.cots.ie, please check it out

The Langauges are installed and working, But if you visit the home page or view the infomation section for each language,

You will see a lot of information there that needs to be repeated in each language seperately,

 

Currently I have a < PHP INCLUDE> on the index.php page on the root with the following code

<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
		 <td><?php include(DIR_WS_TXTENGLISH . '/' . FILENAME_ENG_INDEX_SHTML); ?></td>
	  </tr>
	</table>

 

 

 

 

 

 

 

 

I have a CMS that is set up to be able to edit some html fils inside some folders on the root... eg:Foler 1: txtenglish, Folder2: txtfrench etc...

This way i am able to give my clients access to change the page content as requested, by using a PHP includes in the root/index.php

But this will mean that for every language i select the text will be english, as it is the default langauge...

But if i can get the <includes> to work on catalog/includes/languages/english, french , spanish etc...

on the below line in each page, i can allow the client to have text in multiple languages that he can edit...

<?php


define('NAVBAR_TITLE', 'Welcome to Cots.ie');
define('HEADING_TITLE', Welcome to Cots.ie');

define('<?php echo(DIR_WS_TXTENGLISH .  FILENAME_ENG_INDEX_HTML); ?>');
?>

 

I hope this makes sense to you.

Its hard to explain, but unfortunetly my client only decided about having a CMS after the site was set up and it was to late to install a proper cms solution...

Link to comment
Share on other sites

Jack has a point, check out http://oscommerce.info/kb/osCommerce/Admin...ocalization/163 for more info.

 

Hi Guys,

The site is live and i called www.cots.ie, please check it out

The Langauges are installed and working, But if you visit the home page or view the infomation section for each language,

You will see a lot of information there that needs to be repeated in each language seperately,

 

Currently I have a < PHP INCLUDE> on the index.php page on the root with the following code

<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
		 <td><?php include(DIR_WS_TXTENGLISH . '/' . FILENAME_ENG_INDEX_SHTML); ?></td>
	  </tr>
	</table>

 

 

 

 

 

 

 

 

I have a CMS that is set up to be able to edit some html fils inside some folders on the root... eg:Foler 1: txtenglish, Folder2: txtfrench etc...

This way i am able to give my clients access to change the page content as requested, by using a PHP includes in the root/index.php

But this will mean that for every language i select the text will be english, as it is the default langauge...

But if i can get the <includes> to work on catalog/includes/languages/english, french , spanish etc...

on the below line in each page, i can allow the client to have text in multiple languages that he can edit...

<?php


define('NAVBAR_TITLE', 'Welcome to Cots.ie');
define('HEADING_TITLE', Welcome to Cots.ie');

define('<?php echo(DIR_WS_TXTENGLISH .  FILENAME_ENG_INDEX_HTML); ?>');
?>

 

I hope this makes sense to you.

Its hard to explain, but unfortunetly my client only decided about having a CMS after the site was set up and it was to late to install a proper cms solution...

Link to comment
Share on other sites

OK, Im gettign there,

The content from my includes is in the page now, but its displaying immediately after the <body> tag which displays it at the top of the page rather that in where the TEXT_INFORMATION is supposed to be displayed....

 

Anybody know how I can get it to display in the correct area???

 

See http://www.cots.ie/test.php to see what i am saying...

This is the code i have...

 

<?php


define('NAVBAR_TITLE', 'TEST');
define('HEADING_TITLE', 'TEST');

define('TEXT_INFORMATION', '');
require("http://www.cots.ie/txtenglish/index.html");

?>

 

Any help would be great, Thanks a million

stephen

Link to comment
Share on other sites

You'll have to do it like this:

 

<?php

define('NAVBAR_TITLE', 'TEST');
define('HEADING_TITLE', 'TEST');

$contents = file_get_contents("http://www.cots.ie/txtenglish/index.html");

define('TEXT_INFORMATION', $contents);
?>

 

This is a very bad idea, though, as this will allow someone else from another site to inject malicious scripts into your site. It will also affect the loading time of your site.

 

Edit: Now that I look back, is cots.ie your website? If so, this is the correct way to do it:

 

<?php

define('NAVBAR_TITLE', 'TEST');
define('HEADING_TITLE', 'TEST');

$contents = file_get_contents("txtenglish/index.html");

define('TEXT_INFORMATION', $contents);
?>

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Link to comment
Share on other sites

Hi Brian,

 

I have used the below code you posted and it works perfectly!!!

THANK YOU SO MUCH!!!

 

<?php

define('NAVBAR_TITLE', 'TEST');
define('HEADING_TITLE', 'TEST');

$contents = file_get_contents("txtenglish/index.html");

define('TEXT_INFORMATION', $contents);
?>

 

Will the site still be vulnerable to deadly scripts using this?

No its not my site, Im working on it for a client of my company!!!

 

Many Thanks

Stephen

Link to comment
Share on other sites

No, you shouldn't have a problem. My comment was regarding the idea that you wanted to pull an HTML page from some other website to display in yours. The code that you implemented is fine.

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Link to comment
Share on other sites

No, you shouldn't have a problem. My comment was regarding the idea that you wanted to pull an HTML page from some other website to display in yours. The code that you implemented is fine.

 

 

You Sir, Are a life saver.!!!

 

Cheers

Stephen

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...