Webmastersite.net
Register Log In

Related categories - can't customize

Title Related categories - can't customize
Message Text Using this code to output related links works as it should: <!-- BEGIN RELATED --> <a href="https://www.webmastersite.net/forums/WSN_Links" class="categoryname"><?php echo( str_replace('zzz ','',str_replace(' and ',' & ','{CATNAME}')) ); ?></a> <!-- END RELATED --> I want these categories to appear as a comma delimited list. So tried this: <?php $relcounter = 1; ?> <!-- BEGIN RELATED --> <a href="https://www.webmastersite.net/forums/WSN_Links" class="categoryname"><?php echo( str_replace('zzz ','',str_replace(' and ',' & ','{CATNAME}')) ); $relcounter += 1; if ($relcounter <= {CATNUMBERRELATED}) { echo', '; ?></a> <!-- END RELATED --> Suddenly, instead of the related categories displaying, only the current category was output. Even the following (if I have a comma after all items) does the same: <!-- BEGIN RELATED --> <a href="https://www.webmastersite.net/forums/WSN_Links" class="categoryname"><?php echo( str_replace('zzz ','',str_replace(' and ',' & ','{CATNAME}')) ); ?></a>, <!-- END RELATED --> I thought the </a> might have to be the last thing so tried this: <!-- BEGIN RELATED --> <a href="https://www.webmastersite.net/forums/WSN_Links" class="categoryname"><?php echo( str_replace('zzz ','',str_replace(' and ',' & ','{CATNAME}')) ); ?>, </a> <!-- END RELATED --> Same problem. I can't even use <br> in there. Weird as the PHP to replace zzz (used so that misc categories appear as the last item in category lists) etc worked fine. Moreover, I just stripped it down to: <!-- BEGIN RELATED --> <a href="https://www.webmastersite.net/forums/WSN_Links" class="categoryname">{CATNAME}</a> <!-- END RELATED --> and it showed the current category only. (Isn't that the default code?) Went back to the code listed first above and it worked again. Bizarre! Any ideas please?
Rating
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5
0/5 based on 0 votes.
Ownership siteengineering
Views 480 views. Averaging 0 views per day.
Similar Topics
Submission Date Mar 04, 2005 - 3:02 PM