Remove "All Articles" link
7 posts by 2 authors in: Forums > CMS Builder
Last Post: June 30, 2010 (RSS)
By JWill777 - June 29, 2010
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/var/www/html/cmsAdmin/lib/viewer_functions.php";
list($categoriesRecords, $selectedCategory) = getCategories(array(
'tableName' => 'categories',
));
list($articlesRecords, $articlesMetaData) = getRecords(array(
'tableName' => 'articles',
));
?>
<!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></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body>
<h1>Categories</h1>
<ul>
<li><a href="?">(All Articles)</a></li>
<?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 ?>
</ul>
<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Articles - List Page Viewer</h1>
<?php foreach ($articlesRecords as $record): ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>
<?php endforeach ?>
<?php if (!$articlesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->
Re: [JWill777] Remove "All Articles" link
By Jason - June 30, 2010
You could try something like this:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/var/www/html/cmsAdmin/lib/viewer_functions.php";
list($categoriesRecords, $selectedCategory) = getCategories(array(
'tableName' => 'categories',
));
list($articlesRecords, $articlesMetaData) = getRecords(array(
'tableName' => 'articles',
));
?>
<!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></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body>
<h1>Categories</h1>
<ul>
<?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 ?>
</ul>
<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Articles - List Page Viewer</h1>
<?php foreach ($articlesRecords as $record): ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>
<?php endforeach ?>
<?php if (!$articlesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->
<?php if(@$_REQUEST['category']): ?>
<?php foreach ($articleRecords as $article): ?>
** OUTPUT ARTICLES **
<?php endforeach ?>
<?php endif ?>
This code removes the "All Records" link and adds an if statement around the foreach loop for $articleRecords. this means that the foreach loop will only execute if there is a category variable in the query string.
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Remove "All Articles" link
By JWill777 - June 30, 2010
http://www.nellhills.com/articlesList.php?
Re: [JWill777] Remove "All Articles" link
By Jason - June 30, 2010
If you could attach articlesList.php I can take a look at it for you.
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Remove "All Articles" link
By JWill777 - June 30, 2010
Re: [JWill777] Remove "All Articles" link
By Jason - June 30, 2010
Try this file. I added the code from before. The problem was just making sure all of the names were the same.
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Remove "All Articles" link
By JWill777 - June 30, 2010
Jason