Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Why can't i include php into infobox


gregy

Recommended Posts

Hi guys!

 

I just cannot include php file into infobox

 

<!-- Sold Tickets Count //-->
	  <tr>
		<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SOLD_TICKETS);

 new infoBoxHeading($info_box_contents, false, false, false, $column_location);

 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'center',
						   'text' => '<? include("sold_tickets_count.php"); ?>');

new infoBox($info_box_contents, $column_location);
?>
		</td>
	  </tr>
<!-- Sold Tickets Count //-->

 

if i call this file directly it works like a charm .. but when i try to add it in infobox, infobox is empty. This file sold_tickets_count.php is located in root.

 

any idea?

Link to comment
Share on other sites

Hi guys!

 

I just cannot include php file into infobox

 

<!-- Sold Tickets Count //-->
	  <tr>
		<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SOLD_TICKETS);

 new infoBoxHeading($info_box_contents, false, false, false, $column_location);

 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'center',
						   'text' => '<? include("sold_tickets_count.php"); ?>');

new infoBox($info_box_contents, $column_location);
?>
		</td>
	  </tr>
<!-- Sold Tickets Count //-->

 

if i call this file directly it works like a charm .. but when i try to add it in infobox, infobox is empty. This file sold_tickets_count.php is located in root.

 

any idea?

<? echo include("sold_tickets_count.php"); ?>
or
<?php echo include("sold_tickets_count.php"); ?>

might be it

Link to comment
Share on other sites

Hi guys!

 

I just cannot include php file into infobox

 

<!-- Sold Tickets Count //-->
	  <tr>
		<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SOLD_TICKETS);

 new infoBoxHeading($info_box_contents, false, false, false, $column_location);

 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'center',
						   'text' => '<? include("sold_tickets_count.php"); ?>');

new infoBox($info_box_contents, $column_location);
?>
		</td>
	  </tr>
<!-- Sold Tickets Count //-->

 

if i call this file directly it works like a charm .. but when i try to add it in infobox, infobox is empty. This file sold_tickets_count.php is located in root.

 

any idea?

 

 

change to this:

 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'center',
						   'text' => include("sold_tickets_count.php"));

 

the success of this depends highly on what you have in that file ... see here:

http://www.oscommerce.com/forums/index.php?showtopic=163849&hl=

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

no luck .. just can't figure it out, why it cannot be included ..

path to the file should be give also. You are within the (catalog)/includes/boxes directory and I assume the file you are calling upon resides within the root (catalog) directory ?!

Link to comment
Share on other sites

change to this:

 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'center',
						   'text' => include("sold_tickets_count.php"));

 

the success of this depends highly on what you have in that file ... see here:

http://www.oscommerce.com/forums/index.php?showtopic=163849&hl=

 

Hi Monika

 

Actually this is working but not correctly .. i have left infobox on my site so you can see what it does .. it's second box on the left from top .. now it is written outside of the infobox and in the infobox is number 1 ?

Link to comment
Share on other sites

Hi Monika

 

Actually this is working but not correctly .. i have left infobox on my site so you can see what it does .. it's second box on the left from top .. now it is written outside of the infobox and in the infobox is number 1 ?

 

looks like the same issue the other user had ... did you look at that link I attached?

Post the file that you include, it most probably has stuff that needs to be removed and added to the box file.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

looks like the same issue the other user had ... did you look at that link I attached?

Post the file that you include, it most probably has stuff that needs to be removed and added to the box file.

 

honestly .. i did take a quick look .. i guess not enough ..

 

here's the file that is included

 

<?php

$database_name="xxxxx";
$db_username="xxxxx";
$db_password="xxxxxxxx";

$conn = mysql_connect("localhost", $db_username, $db_password);
mysql_select_db($database_name);
$stavek="select sum(products_quantity) as vsota from orders_products";
$rezultat=mysql_query($stavek);
$vrednost=mysql_fetch_object($rezultat);
$vsota=$vrednost->vsota;
?>

Do sedaj je bilo prodanih <?echo $vsota?> vstopnic.

Link to comment
Share on other sites

in this case ... why bother long! there is a very easy fix:

 

right above the $info_box_contents = array(); part add this

 

$database_name="xxxxx";
$db_username="xxxxx";
$db_password="xxxxxxxx";

$conn = mysql_connect("localhost", $db_username, $db_password);
mysql_select_db($database_name);
$stavek="select sum(products_quantity) as vsota from orders_products";
$rezultat=mysql_query($stavek);
$vrednost=mysql_fetch_object($rezultat);
$vsota=$vrednost->vsota;

 

then continue this way:

$info_box_contents = array();
 $info_box_contents[] = array('align' => 'center',
						   'text' => 'Do sedaj je bilo prodanih ' . $vsota . ' vstopnic.');

 

let me know!

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

works like a charm :thumbsup:

 

thank you very much .. that's why i love Oscommerce .. biiiig and helpful community :D :thumbsup:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...