• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

placing php code within define?

Resshin

New Member
Hi there.
I want to edit a OsCommerce index.php file so that I can use FusionNews to post updates instead of having to edit index.php everytime.

The problem is that I don't know where to add the code. When I add the code to the file, the post box will appear at the top of the page, which is not where I need it.

So i noticeted that the code
PHP:
define('TEXT_MAIN','');
is where I should put stuff so that the text appears in the body of the page. I can't seem to put the FusionNews code there..this is what I tried
PHP:
define('TEXT_MAIN','include '/home/resshin/public_html/news/news.php';')

btw this is the entire code of the file i'm trying to edit
PHP:
<?php
/*
  $Id: index.php,v 1.1 2003/06/11 17:38:00 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

define('TEXT_MAIN', ''); 
define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');
define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products');
define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');


if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) {
  define('HEADING_TITLE', 'Let\'s See What We Have Here');
  define('TABLE_HEADING_IMAGE', '');
  define('TABLE_HEADING_MODEL', 'Model');
  define('TABLE_HEADING_PRODUCTS', 'Product Name');
  define('TABLE_HEADING_MANUFACTURER', 'Manufacturer');
  define('TABLE_HEADING_QUANTITY', 'Quantity');
  define('TABLE_HEADING_PRICE', 'Price');
  define('TABLE_HEADING_WEIGHT', 'Weight');
  define('TABLE_HEADING_BUY_NOW', 'Buy Now');
  define('TEXT_NO_PRODUCTS', 'There are no products to list in this category.');
  define('TEXT_NO_PRODUCTS2', 'There is no product available from this manufacturer.');
  define('TEXT_NUMBER_OF_PRODUCTS', 'Number of Products: ');
  define('TEXT_SHOW', '<b>Show:</b>');
  define('TEXT_BUY', 'Buy 1 \'');
  define('TEXT_NOW', '\' now');
  define('TEXT_ALL_CATEGORIES', 'All Categories');
  define('TEXT_ALL_MANUFACTURERS', 'All Manufacturers');
} elseif ($category_depth == 'top') {
  define('HEADING_TITLE', 'What\'s New Here?');
} elseif ($category_depth == 'nested') {
  define('HEADING_TITLE', 'Categories');
}
?>
that did not work lol....

so i was wondering if anyone can help me...btw, if you havne't noticed, I have no clue how php works...and I probably should post this in the oscommerce support forums...but i haven't got much help from users there in the past
 
Last edited:
Try
PHP:
define('TEXT_MAIN','include "/home/resshin/public_html/news/news.php";');
or
PHP:
define('TEXT_MAIN','include '/home/resshin/public_html/news/news.php';');
 
hi, thanks for the help

i tried both codes..the first one resulted in
include /home/resshin/public_html/news/news.php showing up on the main page

while the second one gave a

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/resshin/public_html/store/includes/languages/english/index.php on line 13
 
hi, thanks again.

this one had the same result as the first one...displaying include /home/resshin/public_html/news/news.php on the main page..
 
Actully, it resulted in displaying news.php on the main page because that's what your defining it to do... That's why it's called TEXT_MAIN, as in main page.
 
right now it is showing the text of "/home/resshin/public_html/news/news.php"

I want it to show the contents of news.php on the main page.

thanks
 
you could try

PHP:
ob_start();
include "/home/resshin/public_html/news/news.php";
$news= ob_get_contents();
ob_end_clean();
define( 'TEXT_MAIN', $news );

that might work....
 
you could try

PHP:
ob_start();
include "/home/resshin/public_html/news/news.php";
$news= ob_get_contents();
ob_end_clean();
define( 'TEXT_MAIN', $news );

that might work....
:God:

thank you! this worked!

thanks to everyone else for their efforts! :D
 
thought it would, but I never used the script you're on about so didn't wanna say it would for sure ....
 
Back
Top