Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Banner Mannager


KaoticSnow

Recommended Posts

That only works if my entie page was in the catalog dir,

<?php if ($banner = tep_banner_exists('dynamic', '100x50')) { ?>

that line calls the function tep_banner_exists() which does not exist out of that dir, how do I point it where it needs to go???

Link to comment
Share on other sites

That gets a bit more tricky. Haven't tried it out, so there might be something missing:

 

You need to include all files to connect to the DB and have all the functions available. You need to modify the path. If it's your main dir and the catalog dir is in there, try to include the following into your code:

 

//This needs to be set before configure is called

define('DIR_WS_IMAGES', 'catalog/images/');

 

 

// Set the local configuration parameters - mainly for developers

if (file_exists('catalog/includes/local/configure.php')) include('catalog/includes/local/configure.php');

// include server parameters

require('catalog/includes/configure.php');

 

//define the few variables used

define('FILENAME_REDIRECT', 'redirect.php');

 

define('TABLE_BANNERS', 'banners');

define('TABLE_BANNERS_HISTORY', 'banners_history');

 

 

// auto activate and expire banners

require('catalog/includes/functions/banner.php');

tep_activate_banners();

tep_expire_banners();

 

// include the database functions

require('catalog/includes/functions/database.php');

 

// make a connection to the database... now

tep_db_connect() or die('Unable to connect to database server!');

 

// define general functions used application-wide

require('catalog/includes/functions/general.php');

require('catalog/includes/functions/html_output.php');

 

 

After that include the banner code from my little article.

 

This should work but I haven't tried it. So we might run into a bug or two. Let me know if you can get it to work.

 

HTH

 

Gunter

Link to comment
Share on other sites

nope not working, here is the error I have recieved

 

Fatal error: Call to undefined function: tep_db_query() in /homepages/44/d97025904/htdocs/catalog/includes/functions/banner.php on line 28

 

I am tying to get it on the footer of my web forums which are located in my web server root under the forums dir, so i included a ../ to all of the file locations since the script will be running form /forums i need it to back out to the root then into catalog/

 

here is the code

 

<?php
//This needs to be set before configure is called
define('DIR_WS_IMAGES', '../catalog/images/');


// Set the local configuration parameters - mainly for developers
if (file_exists('../catalog/includes/local/configure.php')) include('../catalog/includes/local/configure.php');
// include server parameters
require('../catalog/includes/configure.php');

//define the few variables used
define('FILENAME_REDIRECT', '../redirect.php');

define('TABLE_BANNERS', 'banners');
define('TABLE_BANNERS_HISTORY', 'banners_history');


// auto activate and expire banners
require('../catalog/includes/functions/banner.php');
tep_activate_banners();
tep_expire_banners();

// include the database functions
require('../catalog/includes/functions/database.php');

// make a connection to the database... now
tep_db_connect() or die('Unable to connect to database server!');

// define general functions used application-wide
require('../catalog/includes/functions/general.php');
require('../catalog/includes/functions/html_output.php');

// code form http://sammysolutions.com/wiki/osCommerceHowToBannerManager
if ($banner = tep_banner_exists('dynamic', '100x50')) {
?>
<br>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><?php echo tep_display_banner('static', $banner); ?></td>
</tr>
</table>
<?php
}
?>

Link to comment
Share on other sites

Sorry,

didn't notice that you have replied. Must have been slipped through the cracks. Try to move

 

// auto activate and expire banners

require('../catalog/includes/functions/banner.php');

tep_activate_banners();

tep_expire_banners();

 

below

 

require('../catalog/includes/functions/html_output.php');

 

HTH

 

Gunter

Link to comment
Share on other sites

I just tried it out on my local machine and it worked for me. Did you make sure that you have a banner 100x50? If not, you need to create one or change it to an existing banner.

If you are still having problems, I would need your login info and url's in order to debug it for you. You could email them to me (gunter at sammysolutions dot com).

HTH

 

Gunter

Link to comment
Share on other sites

here is how I have the code this is loaded into the footer of my web forums,

 

http://www.kaotickreation.com/forums (Sub Domain: http://forums.kaotickreation.com)

 

my catalog is stored at http://www.kaotickreation.com/catalog (Sub Domain: http://catalog.kaotickreation.com)

 

take a quick look and see if I made some stupid mistake

 

<!-- Start Banner -->
<?php
//This needs to be set before configure is called
define('DIR_WS_IMAGES', '../catalog/images/');


// Set the local configuration parameters - mainly for developers
if (file_exists('../catalog/includes/local/configure.php')) include('../catalog/includes/local/configure.php');
// include server parameters
require('../catalog/includes/configure.php');

//define the few variables used
define('FILENAME_REDIRECT', '../redirect.php');

define('TABLE_BANNERS', 'banners');
define('TABLE_BANNERS_HISTORY', 'banners_history');


// include the database functions
require('../catalog/includes/functions/database.php');

// make a connection to the database... now
tep_db_connect() or die('Unable to connect to database server!');

// define general functions used application-wide
require('../catalog/includes/functions/general.php');
require('../catalog/includes/functions/html_output.php');

// auto activate and expire banners
require('../catalog/includes/functions/banner.php');
tep_activate_banners();
tep_expire_banners();

// code form http://sammysolutions.com/wiki/osCommerceHowToBannerManager
if ($banner = tep_banner_exists('dynamic', '100x50')) {
?>
<br>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><?php echo tep_display_banner('static', $banner); ?></td>
</tr>
</table>
<?php
}
?>
<!-- End Banner -->

 

also in the sorce of the page all it displays is

<!-- Start Banner -->
<!-- End Banner -->

so its not generating anything.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...