Remove "Articles Categories" from Categories Menu

4 posts by 2 authors in: Forums > CMS Builder
Last Post: May 19, 2011   (RSS)

By crazyfish - May 18, 2011

Not enough coffee or too much reading but I can't seem to figure out how to remove the "Articles Categories" from the menu code.

The working page is here http://breedersclub.net/html/articles/articles1.php

Results look like this:

Articles Categories

Pets and the Arts
Pet Health and Safety
Traveling with your Pet
Pet Lifestyles
Pet Training and Sports
Pet Behavior

Pet Behavior Articles ( I added the word articles to hard code )

Also how do I make "pet behavior articles" the category that the articles are in ( after clicking one of the category links )

As always, thanks for your support.
Sean

Re: [gkornbluth] Remove "Articles Categories" from Categories Menu

By crazyfish - May 19, 2011

Ok part 1 was my fault, I had a section name of Articles Categories" instead of using the first category....


<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

$libraryPath = '../../articles/lib/viewer_functions.php';
$dirsToCheck = array('/var/www/html/breedersclub/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }


$selectedCategoryNum = getNumberFromEndOfUrl();
if (!$selectedCategoryNum) { $selectedCategoryNum = 6; }

list($categoriesRecords, $selectedCategory) = getCategories(array(
'tableName' => 'categories',
'selectedCategoryNum' => '6', // defaults to getNumberFromEndOfUrl()
));

list($articlesRecords, $articlesMetaData) = getRecords(array(
'tableName' => 'articles',
));

?>

<?php

function maxWords($textOrHtml, $maxWords) {
$text = strip_tags($textOrHtml);
$words = preg_split("/\s+/", $text, $maxWords+1);
if (count($words) > $maxWords) { unset($words[$maxWords]); }
$output = join(' ', $words);

return $output;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dogs, Puppies, Dog Breeders, Purebred Puppies and Dogs for Sale</title>

<meta name="Description" content="The Dog and Pet Lovers web site featuring dogs and puppies for sale, classified ads, dog breed descriptions, professional pet-care advice, pet resources, free promotions" />
<meta name="Classification" content="dogs, pets, dog breeders" />



<link href="../petsonsale.css" rel="stylesheet" type="text/css" />
</head>
<body onload="MM_preloadImages('../../Library/navimages/navbar_r1_c1_f2.jpg','../../Library/navimages/navbar_r1_c2_f2.jpg','../../Library/navimages/navbar_r1_c3_f2.jpg','../../Library/navimages/navbar_r1_c4_f2.jpg','../../Library/navimages/navbar_r1_c5_f2.jpg','../../Library/navimages/navbar_r1_c6_f2.jpg','../../Library/navimages/navbar_r1_c7_f2.jpg','../../Library/navimages/navbar_r1_c8_f2.jpg')">



<table width="875" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center">


<table border="0" cellpadding="0" cellspacing="0" width="875">
<!-- fwtable fwsrc="navbar.png" fwpage="Page 1" fwbase="navbar.jpg" fwstyle="Dreamweaver" fwdocid = "1155611329" fwnested="0" -->
<tr>
<td><img name="navbar_r1_c1" src="../../Library/navimages/navbar_r1_c1.jpg" width="28" height="30" border="0" alt="puppies for sale" /></td>
<td><a href="/index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('navbar_r1_c2','','../../Library/navimages/navbar_r1_c2_f2.jpg',1)"><img name="navbar_r1_c2" src="../../Library/navimages/navbar_r1_c2.jpg" width="66" height="30" border="0" alt="Home" /></a></td>
<td><a href="http://breedersclub.net/classifieds/dogs_and_puppies_for_sale-b428_0.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('navbar_r1_c3','','../../Library/navimages/navbar_r1_c3_f2.jpg',1)"><img name="navbar_r1_c3" src="../../Library/navimages/navbar_r1_c3.jpg" width="153" height="30" border="0" alt="Dogs for sale" /></a></td>
<td><a href="http://breedersclub.net/classifieds/dog_stud_services-b22_0.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('navbar_r1_c4','','../../Library/navimages/navbar_r1_c4_f2.jpg',1)"><img name="navbar_r1_c4" src="../../Library/navimages/navbar_r1_c4.jpg" width="176" height="30" border="0" alt="Dog Stud Services" /></a></td>
<td><a href="/html/breedguide.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('navbar_r1_c5','','../../Library/navimages/navbar_r1_c5_f2.jpg',1)"><img name="navbar_r1_c5" src="../../Library/navimages/navbar_r1_c5.jpg" width="120" height="30" border="0" alt="Find Puppies and Dogs by Breed" /></a></td>
<td><a href="http://breedersclub.net/classifieds/cats_and_kittens_for_sale-b327_0.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('navbar_r1_c6','','../../Library/navimages/navbar_r1_c6_f2.jpg',1)"><img name="navbar_r1_c6" src="../../Library/navimages/navbar_r1_c6.jpg" width="143" height="30" border="0" alt="Cats For Sale" /></a></td>
<td><a href="http://www.catsforyou.com/html/catbreeddirectory.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('navbar_r1_c7','','../../Library/navimages/navbar_r1_c7_f2.jpg',1)"><img name="navbar_r1_c7" src="../../Library/navimages/navbar_r1_c7.jpg" width="116" height="30" border="0" alt="Cats For Sale" /></a></td>
<td><a href="/html/faq.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('navbar_r1_c8','','../../Library/navimages/navbar_r1_c8_f2.jpg',1)"><img name="navbar_r1_c8" src="../../Library/navimages/navbar_r1_c8.jpg" width="53" height="30" border="0" alt="Frequently Asked Questions about Dogs, Puppies and Breeders Club" /></a></td>
<td><img name="navbar_r1_c9" src="../../Library/navimages/navbar_r1_c9.jpg" width="20" height="30" border="0" alt="puppies for sale" /></td>
</tr>
</table><!-- #EndLibraryItem --></td>
</tr>
</table>
<table width="875" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="200" valign="top" class="text"><p><img src="../../rotate/rotator.php" width="200" height="717" /></p>
</td>
<td width="675" valign="top" class="text"><p class="text_title"><i>Dog Related News, Tips & Information.</i></p>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<a href="?">View All Articles</a>
<?php foreach ($categoriesRecords as $categoryRecord): ?>
<?php echo $categoryRecord['_listItemStart'] ?>

<?php if ($categoryRecord['_isSelected']): ?><b><?php endif ?>
<a href="?category=<?php echo $categoryRecord['num'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php if ($categoryRecord['_isSelected']): ?></b><?php endif ?>

<?php echo $categoryRecord['_listItemEnd'] ?>
<?php endforeach ?>



<h1>
<a href="?category=<?php echo $categoryRecord['num'] ?>"><?php echo $categoryRecord['name'] ?> Articles</a>


<?php echo $categoryRecord['_listItemEnd'] ?></h1>
<?php foreach ($articlesRecords as $record): ?>

<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>
<?php echo maxWords($record['content'],40) ?>...<br/><br/>



<?php endforeach ?>

<?php if (!$articlesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
</td>
</tr>
</table>





<?php if ($articlesMetaData['invalidPageNum']): ?>
Results page '<?php echo $articlesMetaData['page']?>' not found, <a href="<?php echo $articlesMetaData['../../articles/firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$articlesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>

<br /><br />

<?php if ($articlesMetaData['prevPage']): ?>
<a href="<?php echo $articlesMetaData['../../articles/prevPageLink'] ?>">&lt;&lt; prev</a>
<?php else: ?>
&lt;&lt; prev
<?php endif ?>

- page <?php echo $articlesMetaData['page'] ?> of <?php echo $articlesMetaData['totalPages'] ?> -

<?php if ($articlesMetaData['nextPage']): ?>
<a href="<?php echo $articlesMetaData['../../articles/nextPageLink'] ?>">next &gt;&gt;</a>
<?php else: ?>
next &gt;&gt;
<?php endif ?>
</td>
</tr>
</table>
</body>
</html>

Re: [crazyfish] Remove "Articles Categories" from Categories Menu

By gkornbluth - May 19, 2011

Hi,

Probably has nothing to do with the issue, but I noticed that in your record calls you use 'selectedCategoryNum' => '6', and Pet Behavior is category # 6 on your list of categories.

Past that, I'm not sure.

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php