Jump to content

[Solved] Category description and image on first page ONLY ?


Recommended Posts

When you set up a category in BO, you can add description, friendly URL, metas, AND a category image. This image (just like the category description) will show up on the first page of the category, but also on all subsequent pages of the same category.

I would like this image (and description) to only show up on the first page of the category, and not on the second, third, fourth, and so on. Only on the first page - a sort of intro to the category, if you like.

Link to comment
Share on other sites

  • 3 weeks later...

To show Category description and image on first page only you have to modify category.tpl

here is the some time editior parse some code Ex. $link->getcatImageLink ..... So I have also attached text files

 

 

replace following line in category.tpl

{if $scenes}
		<!-- Scenes -->
		{include file="$tpl_dir./scenes.tpl" scenes=$scenes}
	{else}
		<!-- Category image -->
		{if $category->id_image}
		<div class="align_center">
			<img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" />
		</div>
		{/if}
	{/if}

	{if $category->description}
		<div class="cat_desc">{$category->description}</div>
	{/if}

 

 

 

 

 

 

Replace with following code

{if ($p==1) ||$p==''}
	{if $scenes}
		<!-- Scenes -->
		{include file="$tpl_dir./scenes.tpl" scenes=$scenes}
	{else}
		<!-- Category image -->
		{if $category->id_image}
		<div class="align_center">
			<img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" />
		</div>
		{/if}
	{/if}

	{if $category->description}
		<div class="cat_desc">{$category->description}</div>
	{/if}
{/if}

  • Like 3
Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

Hi

I Have the same question, Im using 1.5.2.0.

 

I would also like for category description to only appear on page 1 of ?.

 

I looked in category.tpl for the piece of code but it looks different, I tried to just replace the code I have with the new one you posted, but it gives me a fatal error.

 

My code looks like this:

{if $scenes}

<!-- Scenes -->

{include file="$tpl_dir./scenes.tpl" scenes=$scenes}

{else}

<!-- Category image -->

{if $category->id_image}

<div class="align_center">

<img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" />

</div>

{/if}

{/if}

 

{if $category->description}

<div class="cat_desc">

{if strlen($category->description) > 1500}

<div id="category_description_short">{$category->description|truncate:1100}</div>

<div id="category_description_full" style="display:none">{$category->description}</div>

<a href="#" onclick="$('#category_description_short').hide(); $('#category_description_full').show(); $(this).hide(); return false;" class="lnk_more">{l s='More'}</a>

{else}

<div>{$category->description}</div>

{/if}

</div>

{/if}

</div>

{/if}

 

It is not important for me to have the show more part in the description. It is not working properly anyways.

 

I hope someone can help me :)

Link to comment
Share on other sites

  • 11 months later...
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...