Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display whats_new infobox into an html page?


awarner20

Recommended Posts

I'm trying to display the whats_new.php infobox on the main page of my site. I've used the php include code and saved the html page as a php page, but I get errors...

 

Warning: main(www.mywebsite.com/shop/includes/boxes/whats_new.php): failed to open stream: No such file or directory in /home/content/a/w/a/myusername/html/indextest.php on line 41

 

Warning: main(www.mywebsite.com/shop/includes/boxes/whats_new.php): failed to open stream: No such file or directory in /home/content/a/w/a/myusername/html/indextest.php on line 41

 

Warning: main(): Failed opening 'www.mywebsite.com/shop/includes/boxes/whats_new.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/content/a/w/a/myusername/html/indextest.php on line 41

 

Can anyone give me a clue?

 

The reason I'm trying to do this is to display a "featured" item on the main page which would of course be the whatever is in the whats_new.php infobox.

 

Thanks for any help...

We see our customers as invited guests to a party, and we are the hosts. It's our job every day to make every important aspect of the customer experience a little bit better. - Jeff Bezos

Link to comment
Share on other sites

Give this a try. I just tested it and it works for me:

 

index.php

<td class="main"><?php echo TEXT_MAIN; ?><br><?php include(DIR_WS_BOXES . 'whats_new.php'); ?></td>

 

jon

 

 

Thanks Jon,

 

Just tried and still error...

 

TEXT_MAIN

 

Warning: main(DIR_WS_BOXESwhats_new.php): failed to open stream: No such file or directory in /home/content/a/w/a/awarner203/html/indextest.php on line 41

 

Warning: main(DIR_WS_BOXESwhats_new.php): failed to open stream: No such file or directory in /home/content/a/w/a/awarner203/html/indextest.php on line 41

 

Warning: main(): Failed opening 'DIR_WS_BOXESwhats_new.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/content/a/w/a/awarner203/html/indextest.php on line 41

We see our customers as invited guests to a party, and we are the hosts. It's our job every day to make every important aspect of the customer experience a little bit better. - Jeff Bezos

Link to comment
Share on other sites

Have you tried this code adjustment on the real index.php and not a test page?

 

This is out of my realm, Adam, sorry. Number one gut reaction, though, when I read something doesn't exist, it doesn't exist. That said, when I run out of options, I reboot. Forces me to take a break and grab a coffee.

 

jon

It's all just ones and zeros....

Link to comment
Share on other sites

Have you tried this code adjustment on the real index.php and not a test page?

 

This is out of my realm, Adam, sorry. Number one gut reaction, though, when I read something doesn't exist, it doesn't exist. That said, when I run out of options, I reboot. Forces me to take a break and grab a coffee.

 

jon

 

Thanks again Jon,

 

This test page is named indextest.php and is located in the root of my domain. The osc installation is under a directory called shop, this may be where my problem is rooted. I'm trying to include the what_new.php infobox on a page outside the osc directory....think that might be causing my problem?

 

I would test it out now, but I am a believer in your reboot, take a break, and have a cup of coffee philosophy;) I will post back with further results later...

 

p.s. sorry about the mis-communication the other day;)

 

Adam

We see our customers as invited guests to a party, and we are the hosts. It's our job every day to make every important aspect of the customer experience a little bit better. - Jeff Bezos

Link to comment
Share on other sites

Take a look at this contribution, it might help you figure out what to do.

http://www.oscommerce.com/community/contributions,1444

 

 

Thanks Wendy,

 

I've tried this, and have also tried configuring several different ways...no succes. I now receive this error...

Parse error: parse error, unexpected '}' in /home/content/a/w/a/awarner203/html/indextest.php on line 87

 

I have tried removing the offending }, but no success yet. I'll keep trying tomorrow. I suppose the easiest solution would be to just insert the product image and link to where I need to go....but that's no fun;)

We see our customers as invited guests to a party, and we are the hosts. It's our job every day to make every important aspect of the customer experience a little bit better. - Jeff Bezos

Link to comment
Share on other sites

hey there, try this....

On your test page put this code

 

<?php
# InfoBox  --------------------------------# 
# Format: http://www.domain.com?box=xx									 #
$value=@file_get_contents('http://yourdomain.com/shop/supply.php?box=whats_new'); 
#--------------------------------------------------------------------------# 
($value)
 ? $results = $value
 : $results = 'ERROR - Either this page is not available or this option 
 is not added to the list of authorized elements.';
echo $results;
# eof InfoBox ----------------------------# 
?>

 

To limit the box size use the HTML/TEMPLATE on the page you are inserting the code on.

To specify the bax you want enter the box name: ie. box=specials or box=whats_new

 

create another php file and call it supply.php, put this code in (DONT EDIT CODE ON THIS PAGE) and upload it to the shop directory

<?

require('includes/application_top.php');

?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php
$box = tep_db_input( $HTTP_GET_VARS['box'] ) . '.php';

if (file_exists(DIR_WS_BOXES . $box) && !empty($box)) {

  include(DIR_WS_BOXES . $box);

}else{

echo 'Sorry, it appears that "<b>'.$box.'</b>" box does not exist.';

}#eof box exists

#--------------------------------------------------------------------------# 
require(DIR_WS_INCLUDES . 'application_bottom.php');?>

 

 

I hope this works for you :)

Link to comment
Share on other sites

do you have the http on the link you are using in your phpcode?

 

Hey there tec,

 

I have tried the code you've so graciously posted, but unfortunatley, I'm still having trouble. I have inserted the code above into the "indextest.php" and uploaded it to the root of my domain. The page looks like this...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<table>
<tr>
<td>
<?php
# InfoBox  --------------------------------# 
# Format: http://www.goodfellasgames.com?box=xx									 #
$value=@file_get_contents('http://goodfellasgames.com/shop/supply.php?box=whats_new'); 
#--------------------------------------------------------------------------# 
($value)
 ? $results = $value
 : $results = 'ERROR - Either this page is not available or this option 
 is not added to the list of authorized elements.';
echo $results;
# eof InfoBox ----------------------------# 
?>
</td>
</tr>
</table>
</body>
</html>

 

I have created a "supply.php" page by copying and pasting the code you've provided into a blank document and named it "supply.php". This file was uploaded to the /shop/ directory of my domain. The page look like this...

<?

require('includes/application_top.php');

?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php
$box = tep_db_input( $HTTP_GET_VARS['box'] ) . '.php';

if (file_exists(DIR_WS_BOXES . $box) && !empty($box)) {

  include(DIR_WS_BOXES . $box);

}else{

echo 'Sorry, it appears that "<b>'.$box.'</b>" box does not exist.';

}#eof box exists

#--------------------------------------------------------------------------# 
require(DIR_WS_INCLUDES . 'application_bottom.php');?>

 

When I load "indextest.php" in my browser I see this text... "ERROR - Either this page is not available or this option is not added to the list of authorized elements."

 

When I go directly to "supply.php", I get this text... "Sorry, it appears that ".php" box does not exist."

 

These pages are located here...

http://www.goodfellasgames.com/indextest.php

http://www.goodfellasgames.com/shop/supply.php

 

Any additional tips or assistance you could provide would be greatly appreciated. This method appears to be straight-forward, but with my lack of php knowledge more guidance is needed...;)

 

Adam

We see our customers as invited guests to a party, and we are the hosts. It's our job every day to make every important aspect of the customer experience a little bit better. - Jeff Bezos

Link to comment
Share on other sites

I just changed the code in the supply.php file to include the box name...

 

The code looked like this...

$box = tep_db_input( $HTTP_GET_VARS['box'] ) . '.php';

 

So I changed it to look like this....

$box = tep_db_input( $HTTP_GET_VARS['box'] ) . 'whats_new.php';

 

Now when I load http://www.goodfellasgames.com/shop/supply.php I see the box being displayed. I still get the "ERROR - Either this page is not available or this option is not added to the list of authorized elements." error when loading http://www.goodfellasgames.com/indextest.php

 

It seems I am missing something simple????

We see our customers as invited guests to a party, and we are the hosts. It's our job every day to make every important aspect of the customer experience a little bit better. - Jeff Bezos

Link to comment
Share on other sites

try replacing your indextest.php code with this code

 

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table>
<tr>
<td>
<?php
# InfoBox  --------------------------------# 
# Format: http://www.goodfellasgames.com?box=xx									 #
$value=@file_get_contents('http://goodfellasgames.com/shop/supply.php?box=whats_new'); 
#--------------------------------------------------------------------------# 
($value)
 ? $results = $value
 : $results = 'ERROR - Either this page is not available or this option 
 is not added to the list of authorized elements.';
echo $results;
# eof InfoBox ----------------------------# 
?>
</td>
</tr>
</table>

</body>
</html>

 

see if that works

Link to comment
Share on other sites

try replacing your indextest.php code with this code

 

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table>
<tr>
<td>
<?php
# InfoBox  --------------------------------# 
# Format: http://www.goodfellasgames.com?box=xx									 #
$value=@file_get_contents('http://goodfellasgames.com/shop/supply.php?box=whats_new'); 
#--------------------------------------------------------------------------# 
($value)
 ? $results = $value
 : $results = 'ERROR - Either this page is not available or this option 
 is not added to the list of authorized elements.';
echo $results;
# eof InfoBox ----------------------------# 
?>
</td>
</tr>
</table>

</body>
</html>

 

see if that works

 

I just copied the above code, saved as indextest.php in main directory, hard-refreshed, but no change:(

We see our customers as invited guests to a party, and we are the hosts. It's our job every day to make every important aspect of the customer experience a little bit better. - Jeff Bezos

Link to comment
Share on other sites

  • 2 weeks later...
^bump

 

Hey there,

 

Thanks for the reminder. Well, I didn'y get it figured out. I had an offer from tec above to figure it out and she did. However, I don't really understand what was done to get it to work.

 

I will look into this and post back with further details as soon as possible....

 

...tec, are you available?

We see our customers as invited guests to a party, and we are the hosts. It's our job every day to make every important aspect of the customer experience a little bit better. - Jeff Bezos

Link to comment
Share on other sites

  • 3 weeks later...
I guess it can't be done.

 

But wait, it can be done! I have got it to work.

 

I started looking at the code tec supplied and figured out where the code came from, pulled from there and this is what I came up with (I am sure the code can be simplified, but I am not touching it cause it is working).

 

 

Create a new page and insert this code:

 

<?php
# InfoBox  --------------------------------# 
# Format: http://www.website.com?box=xx									 #
$value=@file_get_contents('http://www.website.com/catalog/supply.php?box=whats_new'); 
#--------------------------------------------------------------------------# 
($value)
 ? $results = $value
 : $results = 'ERROR - Either this page is not available.';
echo $results;
# eof InfoBox ----------------------------# 
?>

 

Change www.website to your sites name, then save it as a PHP file, I saved mine as whatsnew.php

 

Create a new file called supply.php and insert this code:

 

<?php
 require('includes/application_top.php');
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
?>

<html <?php echo HTML_PARAMS; ?>>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>

<?php require(DIR_WS_BOXES . 'whats_new.php'); ?>

</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Then all you have to do is call the first file into a table on you html page using the <i frame> tag to imbed it into a table

 

<iframe src="http://www.website.com/whatsnew.php" name="info"> 
</iframe>

 

There may be a simpler way, but this worked for me.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...