Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

I want to use a PHP Includes statement in English/


Goanna

Recommended Posts

Posted

Okay, I installed the Define Mainpage module, but I cant get it to work the way I want it.

 

I have a modified Catalog/Index.html file and I dont feel like playing around with it to get define mainpage working the way I want.

 

What I thought I could do is something like this in languages/english/index.php

 

define('TEXT_MAIN', '<?php include ("My New Page.php");');

 

But that, or other variations, do nothing. I also tried a simple echo statement inside the ''s and it doesnt print that either.

 

When Including additional PHP inside of the define brackets, is there a certain way to do it? I tried it with and without the PHP tags. With them it shows nothing, without them it prints the statements as if they were plain text.

 

If anyone can tell me how I could go about doing this, it would be great. If I get this working, I can then just update this one page with dreamweaver and upload it using the dreamweaver extensions.

 

I could always use an Iframe if that doesnt work out, but iframes dont look as clean as a php includes.

Posted

You can do this one of two ways:

 

1.

 

Inside catalog/index.php, find the line

<?php echo TEXT_MAIN ?>

and replace it with

<?php include('pathto/page.php'); ?>

OR, the preferred method:

 

2.

 

Inside catalog/languages/english.php, replace:

define('TEXT_MAIN', 'some text');

with

$filecontents = file_get_contents('pathto/file.html(php)')
define('TEXT_MAIN', $filecontents);

 

Hope this helps!

Posted

hmm, that didnt work, it just printed TEXT_MAIN on my main page instead of the file.

 

If I wanted to do it by using the catalog/index.php method, how would I go about that since I edited my main page so it displays in an infobox?

 

Here is the code for my index.php file.

  <?php
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left',
                              'text' => tep_customer_greeting());
 $info_box_contents[] = array('align' => 'left',
                              'text' => TEXT_MAIN);

 new infoBox($info_box_contents);
?>

 

so using that, where would I put the include statement?

Posted

Hmmm I'll have to get back to you.

 

I currently have a mod in my index page that prohibits me from testing that modification, so I'll have to undo it and then try it your way, that will take some time...

 

:)

Posted

Thanks patrick, I apreciate it. For now I am using a borderless Iframe, which is working good, I just dont like having to go back in and specify new heights when I ad something, as I dont want it to have a scrollbar.

Archived

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

×
×
  • Create New...