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? |