blagger Posted March 21, 2008 Share Posted March 21, 2008 Hi All My first post here. I have an oscommerce website and am trying to do the following www.deviltronics.com I am trying to do something on my site so that when a certain products category is selected the product listing will display a certain text just under the header title on that page. Each category needs a to show different text. So as example, category with id 100 would display 'woohoo' where I want it category with id 101 would display 'wow' where I want it category with id 102 would display 'whoosh' where I want it (those are just samples, I will actually include a paragraph or two. Right you may laugh at this, but I am just having a play around, but this is the code I have come and with (obviously it doesn't work): <?php if ($current_category_id == '116') = ('text' => ['Some Text'])) ; ?> Please tell me what it should be Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted March 21, 2008 Share Posted March 21, 2008 I'd do it like this, if not using databases: $categories = array( 100 => 'woohoo', 101 => 'wow', 102 => 'whoosh' ); echo $categories[$current_category_id]; Quote Link to comment Share on other sites More sharing options...
phpretard Posted March 21, 2008 Share Posted March 21, 2008 It looks like you're missing a "(" if (($current_category_id == '116') = ('text' => ['Some Text'])) ; Quote Link to comment Share on other sites More sharing options...
blagger Posted March 21, 2008 Author Share Posted March 21, 2008 Jeremy, You are an absolute genius! It works I'm glad I googled PHP help and this place. Quote Link to comment Share on other sites More sharing options...
blagger Posted March 21, 2008 Author Share Posted March 21, 2008 phpretard, that didn't work, but thanks for your help. I was just guessing the code! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.