Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can I change the text color for a specific cateogry?


Haitashi

Recommended Posts

Posted

I want only 1 category to have a red text color. All the other categories are to remain the same.

 

I was thinking that I could include a separate CSS file or something like that.

 

<?php

 if ($current_category_id=43){
	echo '<link rel="stylesheet" type="text/css" href="red.css">';
 }
?>

Red.CSS has:

 

	.infoBoxContentsLeft_categ A:link, .infoBoxContentsLeft_categ A:active, .infoBoxContentsLeft_categ A:visited{
font-family: Tahoma;
font-size: 11px;
font-weight: normal;
color: #FF0000;
}

 

This isn't working. Category 43 isn't appearing red. Any ideas how to fix it or a better way to achieve what I'm trying to acomplish?

 

THANKS!

If you have a serious problem but it can be solved, why worry about it? If you have a serious problem but it can't be solved, then why worry about it?

Posted

You have to define $current_category as $cPath, . try this .

 

<? if ($cPath == '43') {
echo '<link rel="stylesheet" type="text/css" href="red.css">';
}?>

 

Backup ..

Posted

First of all, thanks for the help.

 

This is how the code looks now.

 

<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php

if ($cPath == '43') {
echo '<link rel="stylesheet" type="text/css" href="red.css">';
}
?>

 

Unfortunately, it didn't work. When I look at the rendered html. I see that red.css isn't being included. :huh:

If you have a serious problem but it can be solved, why worry about it? If you have a serious problem but it can't be solved, then why worry about it?

Posted

It doesn't output it. I tried using the output before and after the category loop to no avail.

If you have a serious problem but it can be solved, why worry about it? If you have a serious problem but it can't be solved, then why worry about it?

Posted

I forgot to look at what you placed there properly and I forgot to add the <?php @ the beginning. :blush:

 

It still didn't output anything after fixing it.

 

I outputted $current_category_id; and it does output a value of 0 (because I outputted it before the category loop)

 

Now, I saw this post in the forum but I can't seem to get it to work.

 

I don't want to change all the category colors. Just the color of category #43.

 

 

Any ideas?

If you have a serious problem but it can be solved, why worry about it? If you have a serious problem but it can't be solved, then why worry about it?

Posted

Are you trying to modify your category menu or the actual category page?

 

Where are you placing the code? index.php?

 

If your trying to edit your catagory menu then you probably need to call $cPath GLOBAL and create a loop with an if else scenario in categories.php.

 

If you just want the .css file to display on category 43 then you can try this as another option to $cPath.

<?php
$xcat_id=$_GET['cPath'];
if ($xcat_id == '43') {
echo '<link rel="stylesheet" type="text/css" href="red.css">';
}?>

 

I cant understand why using $cPath doesn't work for you.

 

Maybe someone else can offer suggestions.

 

Good Luck.

Archived

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

×
×
  • Create New...