Keyword

How to show category desciprtion in a module pos.

  • Uldis
  • Uldis's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 10 months ago #106781 by Uldis
Hello,

Is it somehow possible to get category description in a module position ?

My site structure is built like this

Fruit
-Apples
- - Green Apples
- - Red Apples

Category Apples, has "Category Description" turned on

I'm having problems with Categories "Green Apples and Red Apples", these categories have "Category Description" turned off, but they still need to display category description, only in different position.

I tried using extra fields and plugin k2_spilt_content, but I can only get description (from extra fields) in item view

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #106782 by william white
Replied by william white on topic Re: How to show category desciprtion in a module pos.
I would start with something like
<?php if($this->params->get('catDescription')): ?>
<!-- Category description -->
<p><?php echo $this->category->description; ?></p>
<?php endif; ?>
(from category.php)
You are having a scope issue

Please Log in or Create an account to join the conversation.

  • Uldis
  • Uldis's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 10 months ago - 11 years 10 months ago #106783 by Uldis
I actually tried this code before.
I tried putting it in mod_k2_Tools (custom code mode)
But once I enable this mod, website displays only white page.

Also "Category Description" is turned of in this category, this is the reason I wanted to display category description in a module position, so category description would get displayed anyway

What is a scope issue ?

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #106784 by william white
Replied by william white on topic Re: How to show category desciprtion in a module pos.
if u are getting a white page, turn error reporting on highest and see what the error is and go from there
scoping = what is the current object, how do you address it, and how do you address things that are not in sccope

Please Log in or Create an account to join the conversation.

  • Uldis
  • Uldis's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 10 months ago - 11 years 10 months ago #106785 by Uldis
The returned error was - Fatal error: Using $this when not in object context in /tmp/tmptqy0BF on line 1

Guess I can't put that code in module position !?

Probably my idea isn't the best, but I've been thinking for quite a while on how to do that , I only post in forum as a last resort.

In this situation website design is needlessly complex. I have a fallback plan in case I can't get category description in a module position, but things would be a lot easier if I could.

In categories Fruit and Fruit->Apples I have a secondary menu module and category description

In category Green Apples I need to turn off secondary menu and move category description to secondary menu position

When going in further, viewing Green Apple 1 item I will also need category description (From Green Apples)

I don't like this construction, but In this case I can't change it.

I know that I could create an html module for each category and display category description that way, but It would be just 1 more thing to manage, besides there will be 3 languages, which means a lot of modules.

So I thought that getting category description in module position would be the best solution

Please Log in or Create an account to join the conversation.

  • Uldis
  • Uldis's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 10 months ago #106786 by Uldis

Please Log in or Create an account to join the conversation.

  • Uldis
  • Uldis's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 10 months ago #106787 by Uldis
Can no one really tell me how to get category description in a module position please ?

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #106788 by Matbev
I also need to display k2 descirption (and image if possible) in a module.

Help will be appreciated.

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #106789 by Lefteris
@Matbev

Unfortunately this is not available in K2 modules. I suggest that you search for a third-party module that might do what you need.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum