The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 26 posts ] 
Author Message
PostPosted: Sat May 17, 2008 10:17 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
Right now I'm writing a paper for the college I work for about Joomla and during my writing I was thinking about a feature from our current CMS (which isn't Joomla): When a user creates a page the page is automatically added to a menu (in Joomla terminology this would refer to a Category having a module that lists all of the Articles in that Category).

So when I thought of this I went to the Extensions site to see if there wasn't something already available and I stumbled upon the Categories 1.5 Module:
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,2423/Itemid,35/

And I thought, "Perfect!" Except for the fact that the module listed all of the Categories in a particular Section, I figured the pattern would be essentially the same for what I had in mind and I decided to begin modifying the Module so that it could display all of the Articles for a particular Category.

There are two things that I'd like to get going with this module.

1) One is unattended creation of the menu on any category page the module is published on (currently you can only choose one Category...additional copies of the module would have to be created for it to be shown in different Categories). I'm pretty sure I'll be able to figure this out with little trouble, so on to #2.
2) Integration of SEF URLs - I have a copy of Packt Publishing's Learning Joomla 1.5 Extensions Development here and it does have a section about creating SEF URLs but it is in the context of a component and I don't know how I would go about creating a router.php file for the module (like where do I place it, how do I tell the module to use it). The other thought I had is that there is probably a router.php file already (I haven't checked yet as I've just thought of it) and I only need to tap into it so that I can use it for the module.

I'll continue delving into things, but any help or tips are greatly appreciated!

EDIT: Changed title to help try and reflect that a ZIP download of the module is available in the thread.


You do not have the required permissions to view the files attached to this post.


Last edited by orware on Sun May 18, 2008 12:11 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat May 17, 2008 10:36 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
So to answer a part of my second question, since I am dealing with an already existing component (com_content), there does already exist a route.php file here:

Code:
require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');


Which I'll be able to probably use to build my SEF URLs, so I'll go and try that and report back in a few minutes.

The code above was taken from the helper.php in the modules/mod_latestnews folder.


Top
 Profile  
 
PostPosted: Sat May 17, 2008 11:10 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
After going back to the code I noticed that the line of code from my previous reply was already added but I noted that there was an additional call to a function in that file:

Code:
JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid))


That referenced those "slugs" again. After reviewing the code some more I realized that a slug is the id+alias concatenated together.

I was able to get an SEF URL generated but it was incorrect, so I'm going to go back rework the code to better reflect some of the core code so I can get those SEF URLs working :D.


Top
 Profile  
 
PostPosted: Sun May 18, 2008 12:05 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
All right! I've gotten SEF URLs working!

There's still some cleanup to be done and the implementation of the first feature I wanted to add, but the good thing is that SEF URLs are now being generated correctly!

One "bug" I noticed is that if a menu entry exists somewhere for the article, that Itemid will be attached to it, rather than the module inheriting the Itemid of the Category you are currently viewing.

For example, I had created an entry in the Main Menu for an Article named "Computer Science Department" and it was assigned an Itemid of 493. In the frontend the link generated would have an Itemid of 493 attached to it. After deleting the link the Itemid reverted to 492 (the ID of the Category I was viewing), which is exactly what I want (if the Itemid for the Article is different than that of the Category, then Joomla won't be able to track where you are in the menu structure).

I'll make another submission soon with the final cleaned up module but I encourage anybody who might be interested in it to take a look!

EDIT: I had uploaded the wrong zip file, so I deleted the other one and uploaded the correct one.


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Sun May 18, 2008 12:35 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
OK, one last update for the moment. I've reworked the portion of the code to make this module work automatically under any category.

I used JRequest:getVar twice. First to make sure that the view is equal to "category" and the second time to get the value of the "id" attribute which is the same as the catid.

So to get this working all you need to do is install the module and publish it and whenever you browse to a Category page this module will appear with all of the Articles for that particular Category listed.

I'll be finishing cleaning up the code probably later on tonight.

One additional thing I'd like to mention is that the Latest News module I adapted the SQL code from uses SELECT a.* in it's SQL, and I'm assuming that the Popular module does the same...isn't this bad practice? Shouldn't we only SELECT the fields that we are actually going to use from the table so that MySQL does less work? I'm sure people have noticed this already but I thought I'd mention it and see what others might have to say about it.

Look forward to hearing back from a few other people!


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Sun May 18, 2008 2:19 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
Last night I began looking for a parameter that I could add to the module that would allow me to list the contents of the tmpl folder for mod_articles and I was having a hard time finding that information on the Dev/Docs websites.

I tried to use wrox's Professional Joomla book (page 206-207 details the locations of certain classes in the Joomla Framework) but the folder it listed for parameters (libraries/joomla/parameter) didn't exist anymore. So I kept on searching in the folders and came across it in joomla/html/parameter/element. I haven't studied the code enough to know whether that is the main location of the functionality, but looking at the filelist.php file in that folder didn't help me enough to understand how to use the parameter.

It wasn't until I used Google to search for "joomla filelist parameter" that I found this PDF file (I also attached the file to this post):
http://help.joomla.org/ghop/feb2008/task095/final_coreparameters.pdf

And it proved really helpful in figuring out how to do what I wanted to do (I didn't know there was an additional directory attribute that I needed to use).

I'll continue plugging away at this in the afternoon.

I can't remember if one of the Whitepaper threads is related to this topic, but since we have a sections module...shouldn't we also have a Categories and Articles module in the core? When I'm done with the Articles module I'm going to go back and rework Rich's Categories module so that it supports SEF URLs correctly, along with any of the other additions I come up with :-).


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
 Post subject: Re: JRoute SSL Parameter
PostPosted: Sun May 18, 2008 2:47 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
One thing I'd like to add to the module is support for making the URLs SSL/non-SSL using JRoute's third parameter (0 = ignore, 1 = SSL, -1 = non-SSL).

http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,framework:router_part1/#creating-custom-urls

The URL above talks more in-depth about the JRoute class and How to Create Custom URLs.

The reason why I'd like this option is that I've noticed when a menu item is set to ignore, and one URL is set to use SSL, then after you visit the SSL page the links across the entire site are all using SSL...so how do you get back to the non-SSL page? You could set the Home menu item, but you can't guarantee that a visitor is going to want to go back to the homepage after visiting the SSL link...maybe they are going to want to browse articles/categories/some-other-component?

For me I know it'd be nice to be able to set a parameter in mod_articles to set SSL to be always off because I can't think of a situation where I'd need anybody to view an article that needed SSL (unless there was a form, but more likely in that case I could probably create/use a component).

It seems like this would be a smart thing to do since processing https requests is supposed to create a substantial amount of overhead on the server (though after running some Google searches it looks like session caching in Apache can reduce this considerably...I didn't find any actual metrics to allowed me to see for sure) and I would want to limit SSL connections to only those pages/components that required them.


Top
 Profile  
 
PostPosted: Sun May 18, 2008 2:56 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
orware wrote:
Last night I began looking for a parameter that I could add to the module that would allow me to list the contents of the tmpl folder for mod_articles and I was having a hard time finding that information on the Dev/Docs websites.

I tried to use wrox's Professional Joomla book (page 206-207 details the locations of certain classes in the Joomla Framework) but the folder it listed for parameters (libraries/joomla/parameter) didn't exist anymore. So I kept on searching in the folders and came across it in joomla/html/parameter/element. I haven't studied the code enough to know whether that is the main location of the functionality, but looking at the filelist.php file in that folder didn't help me enough to understand how to use the parameter.

It wasn't until I used Google to search for "joomla filelist parameter" that I found this PDF file (I also attached the file to this post):
http://help.joomla.org/ghop/feb2008/task095/final_coreparameters.pdf

And it proved really helpful in figuring out how to do what I wanted to do (I didn't know there was an additional directory attribute that I needed to use).

I'll continue plugging away at this in the afternoon.

I can't remember if one of the Whitepaper threads is related to this topic, but since we have a sections module...shouldn't we also have a Categories and Articles module in the core? When I'm done with the Articles module I'm going to go back and rework Rich's Categories module so that it supports SEF URLs correctly, along with any of the other additions I come up with :-).


In reply to my post above, I ran a search on "filelist" in the Dev Wiki and an article did popup which details the XML Parameters:
http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,references:xml_parameters/&s=filelist

So I'm going and change my opinion of the Developer site because the Developer Wiki seems to be the manual that I'll probably be using the most (and it's searchable :-):
http://dev.joomla.org/component/option,com_jd-wiki/Itemid,32/

I've read a number of threads that post information on Developing in Joomla, but at the time I never had the need to create anything myself and now that I'm actually trying to do something I'm realizing which resources are the most helpful and I think that it might be able to help somebody else who's getting started (sometimes you need to know where to start in order to get off on the right foot, at least that's the way it is for me :-).


Top
 Profile  
 
PostPosted: Mon May 19, 2008 5:53 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
I got a little preoccupied with Sunday things today and a few other forum threads I was posting on so I'll be trying to work on this module tomorrow afternoon. At the latest the final version will be done by next Sunday, promise :-).


Top
 Profile  
 
PostPosted: Fri May 23, 2008 4:35 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
OK, today I updated the module a little bit:

Articles 1.5
Version: 1.5.1
Copyright (C) 2007, 2008 Omar Ramos, Imperial Valley College and Rich Dorfman, WebFeats! (http://www.web-feats.com)
license GNU/GPL

Legend:
# -> Bug Fix
+ -> Addition
! -> Change
- -> Removed
! -> Note

1.5.1 2008-05-22 / Omar Ramos
# Fixed SQL error when module was called on Section page
+ Added new layout in tmpl directory named "menustyle"...uses the menu class for displaying links
+ Added switch that allows users to use the module in "automatic" and manual modes.
# Added 'stripext=".php"' attribute to filelist parameter in mod_articles.xml so that layouts do not show .php extension. Having the extension breaks JModuleHelper::getLayoutPath()
+ Added filename entry in mod_articles.xml for menustyle.php tmpl file

1.5.0 2008-05-17 / Omar Ramos
! Initial Release, Based off of the work of Rich Dorfman on Categories 1.5
+ Added support for SEF URLs
+ Added support for automatic display of Article listings on Category Pages (rather than creating individual modules for each Category you want to Display articles for)
! Cleaned up helper.php to use conventions used in Latest News and Popular Core Modules
! Modified Text to reflect mod_articles rather than mod_categories

----
Still have some cleanup to do with the SQL query. I don't know if I noticed it correctly but it looks like Joomla is still executing the query when nothing is being set.

I would welcome any comments that anybody may have!


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Tue May 27, 2008 12:49 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
Now that I've combined Rich's original mod_categories and my mod_articles I've renamed the module to mod_artcats to reflect the dual-purpose functionality and restarted the versioning at 1.5.0. There is just one little item I'm trying to workout that will allow the "Both" mode to function as expected (how to change module's title from within the module code). I've attached it

ArtCats 1.5.0
Version: 1.5.0
Copyright (C) 2007, 2008 Omar Ramos, Imperial Valley College and Rich Dorfman, WebFeats! (http://www.web-feats.com)
License GNU/GPL

Legend:
# -> Bug Fix
+ -> Addition
! -> Change
- -> Removed
! -> Note

1.5.0 2008-05-26 / Omar Ramos
! Added Categories functionality to mod_articles and renamed to mod_artcats (ArtCats)
+ Added "Both" Capability which allows the module to function on Section and Category pages automatically
+ Added ability to sort by multiple fields
+ Added ability to change sort order (ascending/descending)
+ Allowed for sorting/sort order to be mode independent (separate settings for Article/Category modes)
+ Reimplemented Show Empty Categories Feature from mod_categories (I had removed it for mod_articles)
! Tested with/without SEF URLs enabled
! Need to figure out how to change module title via module parameters for "Both" mode to function seamlessly


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Tue May 27, 2008 2:30 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
1.5.1 2008-05-27 / Omar Ramos
+ Made small correction in mod_artcats.xml that still referenced mod_articles (thanks to ah72ah on the Joomla Forums)


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Wed May 28, 2008 2:42 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
1.5.2 2008-05-27 / Omar Ramos
+ Added Dynamic Module Title with help from Andrew Eddie and Rob Schley of Joomla/JXtended
+ Added Two Module Title Parameters for Both Mode (one for Category Page Title, one for Article Page Title)
+ Added Check for option=com_content since there are other components that also use section/category as view names (e.g. jxtended Magazine)


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Mon Jun 02, 2008 5:02 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 18, 2008 6:41 pm
Posts: 6
This module is invaluable in the creation of an intelligent conditional layout presentation for content navigation for site users. I was tasked with building something similar, but found every feature in this and then some. Really nice and both thumbs UP!
Thanks once again for sharing Orware


Last edited by otuyelu on Mon Jun 02, 2008 5:29 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Jun 02, 2008 5:11 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
I'm glad you have found it useful :-).


Top
 Profile  
 
PostPosted: Thu Jun 12, 2008 2:37 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Jun 12, 2008 1:34 pm
Posts: 2
God idea, but...
After installing and activating this module i see only blank page instead of my site. :-(
Joomla 1.5.0.


Top
 Profile  
 
PostPosted: Thu Jun 12, 2008 7:57 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Jun 12, 2008 1:34 pm
Posts: 2
Now it work fine! :-)
After upgrading my joomla to 1.5.3
Thanks!


Top
 Profile  
 
PostPosted: Thu Jun 12, 2008 11:56 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
Thank you for the update (I didn't know the module was incompatible with the earlier Joomla 1.5 version).

Enjoy!


Top
 Profile  
 
PostPosted: Fri Jun 13, 2008 1:20 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 12, 2006 1:23 pm
Posts: 8
Everything I've read is _exactly_ what I was looking for but.... on J! 1.5.3 and have tried every possible module combination using first your 1.5.2 then reverting to 1.5.1 and setting within your module but still can't get it to run at all even though it shows as an active module. Using debug on, only the artcat.ini loads but no errors. Even tried legacy mode and still no luck. Do I need to change my template in any way?


Top
 Profile  
 
PostPosted: Fri Jun 13, 2008 2:12 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
It sounds like it's probably working...the only thing maybe is the type of page you are trying to view the module on...it will only provide output on either a Section/Category type menu item (on a Section type page it will display Category links, on Category type pages it will display Article links). I had helped somebody out the other day and the reason why he was having trouble was because he was trying to make it work on Article pages (currently the module doesn't display anything when viewing an actual article, though I'm thinking of adding the capability so that on an article page it will still show the links to other articles in the same category).

I hope that helps, if not you can feel free to email/PM and I'll try and figure out what the problem is.


Top
 Profile  
 
PostPosted: Fri Jun 13, 2008 2:37 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 12, 2006 1:23 pm
Posts: 8
>ouch< Seems I misunderstood what artcat was for. I was really hoping that as someone reads an article page on the top they would see other links within that category/section, these additional internal links help SEO as well. Something like http://www.mayoclinic.com/health/gerd/DS00967

I'm thinking I will reorganize my pages and poke around with formating joomla core table of contents view


Top
 Profile  
 
PostPosted: Fri Jun 13, 2008 2:46 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
Ah, I see what you're looking for...that one's a built-in feature for Joomla you just enter in the Page Breaks for the different Sections of the page and that should automatically generate the table of contents for you like in the example you provided.


Top
 Profile  
 
PostPosted: Fri Jun 13, 2008 3:35 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 12, 2006 1:23 pm
Posts: 8
Yes, but I like your "adding the capability so that on an article page it will still show the links" idea much better since I want pages. not just pagebreaks of a longer article. Keep up the great work


Top
 Profile  
 
PostPosted: Sat Jul 19, 2008 7:53 pm 
Joomla! Intern
Joomla! Intern

Joined: Tue Jan 22, 2008 6:38 pm
Posts: 80
Wooow great extension ! I'm actually looking for a way to autmaticaly list the article's in a category in my dropdown main menu. Richt now I have to create a menu item for each article...

Franky


Top
 Profile  
 
PostPosted: Wed Sep 24, 2008 2:22 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
I added some better Category SEF URL support. The download's right here:
http://forum.joomla.org/viewtopic.php?f=46&t=295262&p=1426730#p1426730

I need to update the Extensions Website as well, but that may not happen for a bit.


Top
 Profile  
 
PostPosted: Fri Mar 20, 2009 4:35 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Jul 10, 2006 8:16 pm
Posts: 249
Location: CA
Hello everyone!

You can now download the latest version of the ArtCats module (version 2.0.0) at my homepage, along with some demo documents here:
http://orware.net

The latest version of my subcategories patches are also available (with some recent updates!) if anybody is interested in trying them out :-).

Feedback is always welcome!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 26 posts ] 



Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group