The OC Underground (OCU) is a Craigslist Clone intended for use within a single geographic zone. OCU contains several categories and organizes sub-categories using tags.
The problem
Each category needs to be easily accessible for search and new ad placement. A single wikidot category must be used for each OCU category yet each category contains several tags. How do you use a single category with a single _template that can display any list within that category based on tags alone? Also, how can we make it easy to add additional sub-subcategories (tags)?
Solution
Using _templates, you can create a listpage template for each category containing a variable that defines the tag to be displayed within the list. This will require two wikidot categories, one for storing the pages within the category, and one for storing the list pages. Here is a step by step:
1) First create a new wikidot category used to display lists. In this example, I'll be creating a category list for business services so the name of the category will be "services". Each tag will contain it's own list page within this category. So for example, a list of advertising and marketing services would be listed on the services:advertising page.
2) Next, I need to create a second category to hold all of the service ads, in this example I'll name the category "service-advertisement". Any new ad placed in this category would be so named based on the authors choice in title. So an ad advertising Street Teams, might fall on a page like service-advertisement:sign-event. So "service-advertisement" is the category and "sign-event" is the sample page.
3) Next we need to create a template used to list all of the pages within a given category and tag. This template will be used in the category used to list pages, so in this case it would ordinarily be "services:_template". However, since we want to use a variable within a page to automatically create the page, we need to imbed the template as an include element. This means that the actual code used must reside on "services:_template-include". For this we'll use the wikdot list module and replace the tag names with {$content}.
[[div style="float:right; width: 15em; padding: 0 1em; margin: 1em 0 1em 1em; border: solid #888888 1px;"]]
Create a new **{$content}** listing now.
[[module NewPage category="service-advertisement" tags="{$content}" size="15" button="New Page"]]
**[[size 12px]]View This List By Date[[/size]]**
[[module PageCalendar category="service-advertisement" tags="{$content}"]]
[[/div]]
[[table style="border: 1px solid #888"]]
[[row]]
[[cell style="text-align: center"]]
List Results:
[[/cell]]
[[/row]]
[[row]]
[[cell style="padding: 2; background: #ced"]]
[[div style="max-height: ; overflow: auto"]]
[[module ListPages category="service-advertisement" tags="{$content}" perPage="50" order="dateCreatedDesc"]]
[[div style="border-top: 2px solid #fff; padding: 0 12px"]]
**%%linked_title%%**
Date: **%%date|%e %b %Y|agohover%%**, Author: **%%author%%**, Rating: **%%rating%%**, Comments: **%%comments%%**
[[/div]]
[[/module]]
[[/div]]
[[/cell]]
[[/row]]
[[/table]]
Note that I also included the new page module. This makes it easy for users to create new pages for this category (services) that are automatically tagged with the appropriate tag name. If I let members create their own tags I won't be able to efficiently list their pages. Of course users can still add more tags if they wish, but hopefully they wont remove the initial tag. The cool thing about this is that by setting a default tag, and letting users add more tags, they can cross post the same ad within two sub-categories without the need to create a new listing. This is something CL does not feature; as we all know, many types of listings could fit in more than one sub-category.
4) Now we need to create the template that will be used to pass the include code shown above. So we create a new page "services:_template" and enter this code:
[[include services:_template-include content=%%content%%]]
That may seem redundant and if you know list pages then you may be wondering why I didn't just put the code from the include page into the template. The reason is due to the fact that that I must pass a variable (%%content%%) for each page used to list pages within a sub-category and this variable must reside within the list module.
5) Now for the cool part. To add a new sub-category, create a new page in the "services" category and for your page content, you just need a single word; the tag name. :) This means that can quickly and easily add a new sub-category.
This is the solution I used at OCU. I took it one step further though. The main page of the OCU includes a full list of all categories and sub-categories. By using the list-page module again on the main page, I'm able to automatically include new sub-categories because all sub-category list pages fall under one category (services). Cool huh?
Whane's Web
