Keyword

K2 Auto Categories and Auto Articles

  • Omar Ramos
  • Omar Ramos's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 3 months ago #78396 by Omar Ramos
K2 Auto Categories and Auto Articles was created by Omar Ramos
I've implemented some auto-categories menu and auto-articles menu for mod_k2_tools and mod_k2_content.Together with the Advanced Module Manager (for hiding empty modules) the modified modules I've attached add an additional "Automatic" mode.In mod_k2_tools, the new Automatic Category Menu is useful to show the immediate subcategories of the current category automatically.In mod_k2_content, the new Auto mode will show the articles for the current category, additionally it will continue to display the article list when you visit an article page.These two improvements aide tremendously in creating automatic navigation for a site and will be very useful in my situation, so I'm sure others will benefit as well.I sort of just hacked the features together so I can get going on my site, but I think you guys can clean it up and make it an included feature in a future revision.NOTE: This link may be useful if you notice that your template still sees a "phantom" column on the pages where the modules do not get displayed:http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=12858The issue is a problem with how Joomla counts its modules, which can mess up a template's display, but the above fix works very well (in addition to the Advanced Module Manager's Hide Empty Modules feature).
Attachments:

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

More
15 years 3 months ago #78397 by Simon Wells
Replied by Simon Wells on topic K2 Auto Categories and Auto Articles
I just ran a test on K2Joom.com using your files and just wanted to report back.

mod_k2_tools.
Select module functionality, Set to Category List Automatic Menu
Categories List (Automatic Menu) Settings, set to Yes
Select root category, set to my primary category, containing several sub, sub/sub cats.
Published to module position below content on home page only.
Saved

Visit home page, refresh, no change.
Hard refresh, no change.

Changed module position to "banner" as I know that this has significant change.
The banner module appears, but no content.

Inspect with Firebug, and no trace of K2_tools.

I then created another mod_k2_tools using the same folder, but this time setting up the Categories List (Menu).
Save and published to the same position, this loads.

These two examples are LIVE at the moment at k2joom.com/
They are only viewable on the home page to registered users only.

I have not tested the content_auto-articles.

K2Joom

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

  • Omar Ramos
  • Omar Ramos's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 3 months ago #78398 by Omar Ramos
Replied by Omar Ramos on topic K2 Auto Categories and Auto Articles
Hi K2Joom,

The automatic part does not depend on the root category setting.

The way it works is that it will automatically show a list of categories when you are on a K2 Category page so you want to leave the module enabled on "all" menu items. On a page that doesn't have option=com_k2 then the module will not display.

Here is a live example as well:
faculty.imperial.edu/omar.ramos (is showing the subcategories for the current category "Omar Ramos" and the articles for this category)
faculty.imperial.edu/andres.martinez (is not showing anything because this particular category "Andres Martinez" does not have any subcategories, nor does it have any articles yet)
I've enabled mod_k2_tools on all pages in the above site, but it only gets displayed when it needs to, making it really easy (once instructors start adding their own content) for them to create a simple navigation for their area, without requiring me to create 100+ instances of mod_k2_tools (one for each instructor).

I can send over some screenshots of the configuration if you still aren't able to get things working or even help to get it working on your demo site there.

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

More
15 years 3 months ago #78399 by Simon Wells
Replied by Simon Wells on topic K2 Auto Categories and Auto Articles
I checked, but both of those links are dead.

OK, I enabled for all menus and now auto cat works, it can be seen via the blog menu from the front page.

Omar Ramos said:Hi K2Joom, The automatic part does not depend on the root category setting.

The way it works is that it will automatically show a list of categories when you are on a K2 Category page so you want to leave the module enabled on "all" menu items. On a page that doesn't have option=com_k2 then the module will not display.

Here is a live example as well:
faculty.imperial.edu/omar.ramos (is showing the subcategories for the current category "Omar Ramos" and the articles for this category)
faculty.imperial.edu/andres.martinez (is not showing anything because this particular category "Andres Martinez" does not have any subcategories, nor does it have any articles yet)
I've enabled mod_k2_tools on all pages in the above site, but it only gets displayed when it needs to, making it really easy (once instructors start adding their own content) for them to create a simple navigation for their area, without requiring me to create 100+ instances of mod_k2_tools (one for each instructor).

I can send over some screenshots of the configuration if you still aren't able to get things working or even help to get it working on your demo site there.

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

  • Omar Ramos
  • Omar Ramos's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 3 months ago #78400 by Omar Ramos
Replied by Omar Ramos on topic K2 Auto Categories and Auto Articles
Glad it works now, the links shouldn't be dead (if you try again in a few minutes it'll probably work...most likely our external DNS servers are hiccuping...dodgy Windows machines :-).

I'm not sure where to look on the page (after clicking on the blog link), but I'm glad you were able to get things to work!

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

More
15 years 3 months ago #78401 by Simon Wells
Replied by Simon Wells on topic K2 Auto Categories and Auto Articles
Preparing for the next wave of questions will be, we want a horizontal list, change the bullets, show intro image thumbnail.

OK, time to sleep.

I will get these files added to K2Joom, reviewed etc.
Will test the auto articles shortly.

Omar Ramos said:Glad it works now, the links shouldn't be dead (if you try again in a few minutes it'll probably work...most likely our external DNS servers are hiccuping...dodgy Windows machines :-). I'm not sure where to look on the page (after clicking on the blog link), but I'm glad you were able to get things to work!

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

More
15 years 3 months ago #78402 by FeSys
Replied by FeSys on topic K2 Auto Categories and Auto Articles
Hello.. "Omar Ramos"..
The Idea is new and great for K2..
You start sharing something needed for main sized websites and Huge content Management portals.
I am happy to see your idea working "Omar Ramos".
Just keep the cool-ideas and of course your share.
Thank you.

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

More
15 years 3 months ago #78403 by Simon Wells
Replied by Simon Wells on topic K2 Auto Categories and Auto Articles
One very important thing to note, since I made that demo on K2Joom.
I now have a drop down menu appear in my cPanel location, in the top right of the page.
This is called k2CategorySelectBlock
Even after disabling the module, it still appears.

Is this coincidence that cat menu appears after adding the auto cat module?
It does not appear in my Module Manger, so it must be hard coded, the only change being from the auto cat module.

Knowing how to move this would be useful as to be honest, that kind of drop down category list could be useful to other, just not fixed in my cPanel ;)

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

More
15 years 3 months ago #78404 by Simon Wells
Replied by Simon Wells on topic K2 Auto Categories and Auto Articles
HUGE APOLOGIES!!!

There is NO problem - Developer Error!!

Simon hangs his head in shame for getting something wrong hahaha . . .

K2Joom said:One very important thing to note, since I made that demo on K2Joom.
I now have a drop down menu appear in my cPanel location, in the top right of the page.
This is called k2CategorySelectBlock
Even after disabling the module, it still appears.

Is this coincidence that cat menu appears after adding the auto cat module?
It does not appear in my Module Manger, so it must be hard coded, the only change being from the auto cat module.

Knowing how to move this would be useful as to be honest, that kind of drop down category list could be useful to other, just not fixed in my cPanel ;)

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

More
15 years 3 months ago #78405 by GreenDome
Replied by GreenDome on topic K2 Auto Categories and Auto Articles
Hello Omar,

How have you designed the 'List of Instructors' page? i.e. faculty.imperial.edu/index.php

I'm really interested in the Alpha Jump Links part?

Thanks
GD

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

More
15 years 3 months ago #78406 by Manny Santos
Replied by Manny Santos on topic K2 Auto Categories and Auto Articles
Thanks for the module. Now I can remove the 12 modules I created for each category.

A couple things I noticed: If I chose a different template from the default, it stopped working.
Also, I went to see about the patch you mentioned because the module shows up in pages where I have nothing but don't understand how to apply the patch.

Any help would be greatly appreciated. Thanks

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

  • Omar Ramos
  • Omar Ramos's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 3 months ago #78407 by Omar Ramos
Replied by Omar Ramos on topic K2 Auto Categories and Auto Articles
Hi Greendome,

Yeah I put that one together (I'm not particularly happy with the coding of it...it was a little messy but it gets the job done).

The attached zip has a folder named "directory" within it...this would be dropped into your k2 templates directory (after copying from the main com_k2 directory into my template directory the location for me is /templates/ja_kyanite_ii/html/com_k2/templates/directory).

An instructor already requested if it could be organized by last name, but since the category names contain the instructor names, that could be a little tricky, or at least would require some extra processing.

GreenDome said:Hello Omar,
How have you designed the 'List of Instructors' page? i.e. faculty.imperial.edu/index.php

I'm really interested in the Alpha Jump Links part?

Thanks
GD
Attachments:

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

  • Omar Ramos
  • Omar Ramos's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 3 months ago #78408 by Omar Ramos
Replied by Omar Ramos on topic K2 Auto Categories and Auto Articles
I think the template issue is due to my depending on the Default/menu.php folder location...you'll have to edit things to make that work.

For the other fix I mentioned, just go to libaries/joomla/document/html/html.php and go to line 272 (it's the commented line below) and add in the following:
//$words[$i] = ((isset($this->_buffer[$name])) && ($this->_buffer[$name] === false)) ? 0 : count(JModuleHelper::getModules($name));
$words[$i] = 0;

if(!isset($this->_buffer[$name]))
{
$modules = JModuleHelper::getModules($name);
$result = $this->getBuffer('modules', $name);
$words[$i] += !empty($result);
}

Manukat said:Thanks for the module. Now I can remove the 12 modules I created for each category.
A couple things I noticed: If I chose a different template from the default, it stopped working.
Also, I went to see about the patch you mentioned because the module shows up in pages where I have nothing but don't understand how to apply the patch.

Any help would be greatly appreciated. Thanks

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

More
15 years 3 months ago #78409 by Manny Santos
Replied by Manny Santos on topic K2 Auto Categories and Auto Articles
Thanks, I patched it and it works. Maybe for an update to the module, can you add the ability to go to deeper levels where there is content? right now it shows articles only 3 levels but I have articles in a 4th subcategory which doesn't show in the content module. I have the module set to fetch sub-categories.

Thanks again for this great addition.



Omar Ramos said:I think the template issue is due to my depending on the Default/menu.php folder location...you'll have to edit things to make that work.
For the other fix I mentioned, just go to libaries/joomla/document/html/html.php and go to line 272 (it's the commented line below) and add in the following:
//$words[$i] = ((isset($this->_buffer[$name])) && ($this->_buffer[$name] === false)) ? 0 : count(JModuleHelper::getModules($name));
$words[$i] = 0;

if(!isset($this->_buffer[$name]))
{
$modules = JModuleHelper::getModules($name);
$result = $this->getBuffer('modules', $name);
$words[$i] += !empty($result);
}

Manukat said:Thanks for the module. Now I can remove the 12 modules I created for each category. A couple things I noticed: If I chose a different template from the default, it stopped working.
Also, I went to see about the patch you mentioned because the module shows up in pages where I have nothing but don't understand how to apply the patch.

Any help would be greatly appreciated. Thanks

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

More
15 years 3 months ago #78410 by GreenDome
Replied by GreenDome on topic K2 Auto Categories and Auto Articles
Hi Omar,

Thank you for the directory file. Will test it later.

I seem to be getting the following error with this:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/joomla/testsite/libraries/joomla/document/html/html.php on line 127

Any ideas?

Thank you
GD

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

  • Omar Ramos
  • Omar Ramos's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 3 months ago #78411 by Omar Ramos
Replied by Omar Ramos on topic K2 Auto Categories and Auto Articles
Not really sure greendome, things only began being changed in that file on line 272 so I would have no idea why line 127 is giving you problems. It seems like it would be more related to some file (possibly my directory one?) calling JHTML::stylesheet or something and trying to add a CSS file to the page.

GreenDome said:Hi Omar,
Thank you for the directory file. Will test it later.

I seem to be getting the following error with this:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/joomla/testsite/libraries/joomla/document/html/html.php on line 127

Any ideas?

Thank you
GD

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

  • Omar Ramos
  • Omar Ramos's Avatar Topic Author
  • Offline
  • Junior Member
More
15 years 3 months ago #78412 by Omar Ramos
Replied by Omar Ramos on topic K2 Auto Categories and Auto Articles
For those interested in a "last name" alphabetical directory I'm attaching another zip file that will do just that.

It seems like instructors didn't exactly think that having themselves organized by first name would be that useful so this version takes a category title (in this case, the name of an instructor like, "Omar Ramos") and reorganizes it by last name = "Ramos, Omar" and the organizes them that way. So I can still name my categories normally "Omar Ramos", but in the directory list it will be organized by the last name.

GreenDome said:Hi Omar,
Thank you for the directory file. Will test it later.

I seem to be getting the following error with this:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/joomla/testsite/libraries/joomla/document/html/html.php on line 127

Any ideas?

Thank you
GD
Attachments:

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

More
15 years 3 months ago #78413 by GreenDome
Replied by GreenDome on topic K2 Auto Categories and Auto Articles
How easy would it be to change to display items (articles) instead of categories? Basically the alpha jump links point to articles inside each category rather them sub-categories. I think this could be a useful feature as it would help find articles a lot quicker when there are loads articles per category.

Many Thanks for all your hard work.

GD

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

More
14 years 9 months ago #78414 by Markus Thiel
Replied by Markus Thiel on topic K2 Auto Categories and Auto Articles
I really must say that your work is GREAT! and I would be surprised if this does not become a core module for K2!

I do have a question about a wanted feature ;)

Would it be possible to sort the articles according to the hierarchy? So that perhaps it shows only items from sub categories and they are sorted by hierarchy and date?

A nice little checkbox for "Sort by hierarchy" would really make my day(s)! :)

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

More
14 years 9 months ago #78415 by Markus Thiel
Replied by Markus Thiel on topic K2 Auto Categories and Auto Articles
hmm also I noticed that my earlier template override on the mod_k2_content no longer work...? Or am I doing something wrong?

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


Powered by Kunena Forum