Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change a background image when category changes


Guest

Recommended Posts

Ok. Here's what I've done on my index.php page at the top above the

require('includes/application_top.php'); I've got this with some help from others by the way..

Like this

if(isset($cPath)){
$exploded_str = explode('_', $cPath);
$header_image = $exploded_str[0];
 }
 else{
$header_image = "home";
 }
require('includes/application_top.php');

 

Then I've created a directory called headerimages and I've named my category images based on my cPath # ie cPath 1 =1.jpg, 1_17.jpg, etc. I've got my home page image name home.jpg. This makes it so I can call different images as a background for each category page, in the upper left corner of my STS Template with this php code as a background for that table..

<? echo DIR_WS_HEADER_IMAGES . "/$header_image.jpg"; ?>

 

I've defined the DIR_WS_HEADER_IMAGES in the config.php file.

 

Now my question is.. Is there a better way to do it? And also is there a way to change the background image dynamically for other pages like shipping.php, etc? And if so, how? Please help..

 

You can see this working on this site to some extent, http://www.sugarcreektreasures.com/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...