Hello everyone,
does anyone knowhow I can show de category description ONLY on the first page of the categroy view?
Thanks!!
Here is how I solved the issue. Go to the the "com_virtuemart/views/categories/tmpl/default.php" file, or you can change whatever template file you are using for your categories view.
the original file before it was edited looked like this
// Show Category ?>
<div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">
<div class="spacer">
<h2>
<a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">
<?php echo $category->category_name ?>
<br />
<?php // if ($category->ids) {
echo $category->images[0]->displayMediaThumb("",false);
//} ?>
</a>
</h2>
</div>
</div>
...
After editing the file to display the category description, the file looked like this
....
// Show Category ?>
<div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">
<div class="spacer">
<h2>
<a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">
<?php echo $category->category_name ?>
<br />
<?php // if ($category->ids) {
echo $category->images[0]->displayMediaThumb("",false);
//} ?>
</a>
</h2>
</div>
This is the added text.
<!-- Show category description -->
<div class="category-description">
<?php echo $category->category_description ?>
</div>
</div>
....
Now after this has been done, the category description is displayed on the categories layout page.
You have not answered the question that was asked. They asked how to display the description on ONLY the first page... I.e. for SEO the category description should not display on page 2/3/4/5 etc of the category due to duplicate content.
I will look for a resolution and if I find one I will post it.
just hide it by css when a snippet detects that the limitstart var is > 0
something like
$limitstart = JRequest::getVar('limitstart');
if($limitstart > 0) {
echo '<style type="text/css">
.category-description {
display.none;
}
</style>';
}
Lol you beat me to it! I was just posting.
Find this in the default category view
$this->category->category_description;
and change it to this
<?php $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (false !== strpos($url,'limitstart')) {
echo '';
} else {
echo $this->category->category_description;
} ?>
This checks for the limitstart text in the URL and if it exists shows nothing. If it doesent then it shows the category description.
Don't know if the OPs are really bothered about this now. The thread is from 2 years ago........ ;)
Ah you never know - he may still be struggling with this... :o