Jump to content

Revolutionize site structure with Custom Lists and Advanced Module Manager


Steven Koontz

Recommended Posts

Many thanks to Alejandro (JReviews) and Peter (NoNumber Extensions) for help getting this working.

Joomla! is a category-based CMS which, when coupled with JReviews, presents some drawbacks concerning site navigational structure and module assignments. The Custom Fields in JReviews free us up quite a bit and JReviews as a Content Construction Kit is second to none when it comes to CCKs. The fact that JReviews works alongside Joomla!'s core article system allows great flexibility when integrating with other extensions such as AJAX search modules and SEF URLs. However, we are still restrained to Joomla!'s category system, limited module assignment options and strict menu structure.

[EDIT] Don't know what's up with the images, please see bottom of post [/EDIT]
Because JReviews allows custom fields, all of us that use it end up wondering how we can tailor our listings according to a certain field. For example, if you have a computer review site, you may have a single select list with a series of brands. Unfortunately, you cannot assign specific modules according to brand because all your brands likely fall under the same category, with only one menu item controlling them. The JReviews Related Widgets are a powerful tool for showing related content, but what if you wanted to show some specific advertising widget, or a photo gallery, or special links to other pages depending on the brand of the computer listing the user is viewing? Without heavy JReviews theme modifications, you can't. This tutorial will explain how to use JReviews Custom Lists and the Advanced Module Manager plugin to completely revolutionize your site navigation and content, and use any module you want, where you want, on the listing(s) you want.

For this tutorial I will use my own site, MiraArgentina.com, as an example. It is a travel guide (in Spanish) and is city-based. Given the amount of posts on the JReviews forums asking how to base site navigation on cities rather than categories, I think this expo will come in handy for many JReviews users. Sure, you could create a category for every city, but then you would end up recreating listing types, custom fields and review criteria on an endless basis. Not to mention miss out on JReviews' powerful sorting and search capabilities.

Advanced Module Manager is a very flexible module assignment extension. Individual modules can be assigned to just about everything you can imagine. More about how it works will come later.

First, we need to unleash the power of the JReviews Custom List menu item. I suggest putting ALL of your "normal" JReviews List Pages in a hidden menu. For example, I have two menus dedicated to JReviews that are not shown to the user, but are used on the entire site. One is named "JReviews List Pages". This is where I put all of my required JReviews Directory and List Page menus. The other is called "JReviews Joomla Category Lists". That is where I have all of my Joomla Category List pages for SEF URLs. [EDIT]Jreviews v2.4.10 and the debut of the Jreviews SEF plugin which allows core Joomla category menus to double as Jreviews pages has rendered the required Jreviews menus obsolete. However, that does not affect this tutorial in any way. [/EDIT]

The JReviews Custom List menu item, IMHO, should be the one we are all directing traffic to. Why?

1) Unlimited filtering through Custom Where, Custom Order and Category. You can show any results you want to, and depend less on the advanced search module. You can create direct links in you menu to the results you want users to see.
2) SEO Power: The options I stated in point (1) allow you to target specific keywords. Through your page title and the page description, you can create a heavily-optimized page targeting good search keywords as well as allow users direct access to what they are looking for.
3) Page Description: The little box you see that says "Page description for Custom List only" is not just some useless text area. It is an article. It appears above the results in the List Page. You should treat is as an article. It allows HTML. If your HTML skills are weak, you can build out your page description in a WYSIWIG editor and then copy the HTML over to the page description in the Custom List. This way you can put a few introductory sentences or a detailed article, with bolding, h tags, images, etc... Basically, anything you can do with a normal article. The sheer power of the JReviews Custom List can only be seen when you actually take the time to create it.

My site is set up for users in the following way: I have direct links from the main menu to city landing pages, which are Jreviews listings with direct links using the core Joomla! Single Article menu item. I have some info on the city and I use NoNumber's Sliders plugin as an accordian style menu with links to hotels, guest houses, restaurants, steak houses, ski resorts, bars etc... You get the picture. If you have a template that has sidebar menus that slide out and drop down, then you can use regular menu modules.

I have Custom Lists set up for all of the categories in each city (well, not all yet, it's a big site and I'm still working on it!). Here are two examples of using Custom Lists:
1) Hotels in Chicago: Your Custom List is for the Hotels category, and your Custom Where is Field.jr_city = '*chicago*'. This way you can direct users instantly to hotels in Chicago without relying on the standard JReviews List Page and a JReviews Fields Module that filters by city, where the resulting page has very little SEO value and is likely plagued by duplicate content warnings from Google and Bing Webmaster Tools. I CAN CONFIRM 90% THAT THE DUPLICATE CONTENT WARNINGS FOR CLICK2SEARCH PAGES AND OTHER SEARCH RESULTS PAGES DOES NOT HURT YOUR RANKING. I have come to this conclusion after work on five JReviews sites.
2) You have the computer site. One of your categories is for monitor reviews. Instead of having just one page (the JReviews List Page) for computer monitor reviews, you can set up a Custom List for Toshiba monitor reviews, another for SONY monitor reviews, etc... Incredible SEO power here!

OK, so we have now set up our Custom Lists and either use them directly in the main menu or have them hidden and we use the Joomla! Menu Alias Menu Item to link to them from the main menu. It all depends on how you want to approach it. I tend to hide most of my "real" menus and build my main menu from Alias links, to avoid having useless parent items showing up in the URLs. Short URLs are good URLs!

By assigning breadcrumbs to the core Joomla! article city landing page and the Custom Lists, we can now achieve a site structure like:
HOME --> CHICAGO --> HOTELS

So, that's great, right? You might be thinking now "this Steve guy is nuts, that's just normal JReviews stuff." But...what happens when someone is on mysite.com/chicago/hotels and clicks on one of the listings? They're taken to mysite.com/hotels/1234-the-drake. There are no Chicago-specific modules on this page. The Related Listings Widgets only show other listings in Chicago. The JReviews breadcrumbs direct them back to the JReviews Category List page. And on that page your top listings are probably in another city, so you have to depend on a JReviews Fields Module embedded in the List Page to direct them back to Chicago, or rely on the user to click the "Back" button on the browser from the Listing Detail Page to return to Hotels in Chicago. Even worse, what about the users that land on the Listing Detail page through search? If they hit the "Back" button on their browser, they're back to Google and your bounce rate is going up. How do we provide a continuous navigational structure all the way down to the listings themselves? How do we entice users to stay on our site?

All JReviews users at this point have two problems:
1) Any module assigned to the Hotels category will show up on any hotel listing. So you can forget about your Chicago city guide menu module or any other Chicago-specific module. You are totally dependent on JReviews Related Listings Widgets, which are for showing related listings, not related advertising or anything else. And without hefty JReviews theme customization, you cannot even assign a JReviews Listings or Reviews Module to listings depending on the value of jr_city.
2) What do you do with users who have landed on the site through search or referral, and want to see your fantastic article about Chicago, or go directly from Hotels in Chicago to Bars in Chicago?

Enter Advanced Module Manager, from NoNumber Extensions. This extension, as stated earlier, allows a huge variety of module assignments not available in core Joomla! AMM can be used to assign specific modules to specific articles and much more. The sky's the limit.

The free version of AMM allows article-by-article module assignment. This is fine if your site is not big (IMHO < 1000 listings) and does not see new listings very often. But what about sites with 100 cities, 10,000 listings and is constantly adding content? There is NO WAY we're going manually assign all those articles plus any new ones manually, right?

Right! Well, only if you pay the €50 for the PRO version of AMM. It's a pretty steep price, I'll admit. But if you've forked out the dough for JReviews and you are building the mother-of-all-sites (which is what JReviews does best), then the €50 is worth it to revolutionize your listings. AMM PRO has an option to assign modules according to PHP scripts. That means we have the entire Joomla! site at our disposal. Since we will likely be assigning non-JReviews modules to the listings, we don't have direct access to the PHP variables available in JReviews theme files. But we can check the database and assign modules according to custom fields in this manner. In this example, I am checking a value of jr_city. But you can check any JReviews custom field, even more than one (if you modify the following basic code correctly).

To assign a module to a listing depending on the city, we enter the following code into the PHP box in AMM:

$check = '*chicago*';
$pass = 0;
if (isset($article->id) && $article->id) {
  $query = 'SELECT jr_city FROM #__jreviews_content WHERE contentid = '.(int) $article->id;
  $db->setQuery($query);
  $city = $db->loadResult();
  $pass = ($city == $check);
}
return $pass;

This can be done for any JReviews Custom Field. Just replace all instances of "city" with your custom field.

Awesome. Now we can assign specific modules dynamically to listings depending on a Custom Field. But the breadcrumbs are still a problem. What on Earth do we do about that?

With the Sourcerer extension, also from NoNumber Extensions, we can create a "fake" breadcrumbs using the Joomla! Custom HTML Module. Create a new Custom HTML module and enter this code:

<div class="breadcrumbs"><a href="/" class="pathway">Home</a> <img src="/media/system/images/arrow.png" alt="" /> <a href="/chicago" class="pathway">Chicago</a> <img src="/media/system/images/arrow.png" alt="" /> {source}<?php
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
if ($option=="com_content" && $view=="article") {
$ids = explode(':',JRequest::getString('id'));
$article_id = $ids[0];
$article =& JTable::getInstance("content");
$article->load($article_id);
echo $article->get("title");
} ?>{/source}</div>

The HTML is for the breadcrumbs on the Kirigami template from RocketTheme. Your breadcrumbs code will be different. Use Firebug to get the necessary HTML that shows the breadcrumbs style. The important part here is what is between the {source} tags. That code grabs the article title and displays it at the end of these "fake" breadcrumbs. The example here is kind of generic. I only have the homepage and the city landing page in the breadcrumbs. You could go even further and make fake breadcrumbs for your JReviews categories, and use the PHP code along with the AMM category filter to show incredibly accurate breadcrumbs. For me, just having the listing title with a link back to the city landing page is fine.

OK, another big step taken. But we need to go further. If you leave JReviews breadcrumbs on in the configuration, then we will want to get rid of them on the Listing Detail Pages. For that you will have to edit listings.thtml and remove the following code:

<?php if($this->Config->dir_show_breadcrumb && !empty($crumbs)):?>
<!-- BEGIN PATHWAY -->
<div class="jr_pathway">
       <?php foreach($crumbs AS $crumb):?>
           <?php if($crumb['link']!=''):?>
               <a href="<?php echo $crumb['link'];?>"><?php echo $crumb['name'];?></a>
           <?php else:?>
               <?php echo $crumb['name'];?>
           <?php endif;?>
       <?php endforeach;?>
   </div>

<div class="clr"> </div>
<!-- END PATHWAY -->
<?php endif;?>

That will get rid of JReviews breadcrumbs in listings but keep them for JReviews List Pages, where I think they are important to keep.

The code to remove in 2.4 is this:

<?php $Jreviews->listingDetailBreadcrumb($crumbs);?>

or you could follow Kristian's tip using CSS: http://www.reviewsforjoomla.com/forum/index.php?topic=21949.0

 

[uPDATE] JReviews 2.7, which added the new listing header cover and logo options, has moved the breadcrumbs code from the listing detail theme file to a global listing header file called "detail_header.thtml". You may override that file as need be. [/uPDATE]

Now that we have gotten rid of JReviews breadcrumbs in the Listing Detail page, what if we want to keep a link to the JReviews Category List Page, just in case? Again, we have to modify listings.thtml, and add the category link. I have placed the link next to the favorites button, so my modified theme file looks like this:

<!-- FAVORITES -->
           <?php if($this->Config->favorites_enable):?><?php echo $Widgets->favorite($listing);?><?php endif;?>

           <span class="jr_loadingSmall jr_hidden"></span>
                   <span> <?php __t("Category");?>: <?php echo $Routes->category($listing,isset($listing['Section']) ? $listing['Section'] : '',$listing['Category']);?> </span>
       </div>    
   
       <div class="contentInfoButtons">
           
           <?php if($social_bookmarks == true): ?>
           <span class="socialBookmarks">
               <?php echo $Community->socialBookmarks($listing); ?>        
           </span>
           <?php endif;?>
           
           <!-- COMPARE -->

The raw code is:

<?php __t("Category");?>: <?php echo $Routes->category($listing,isset($listing['Section']) ? $listing['Section'] : '',$listing['Category']);?>

and you can paste it anywhere in the theme file you want. Just be warned that it doesn't work in the content heading area.

The category code in 2.4 is similar:

<span> <?php __t("Category");?>: <?php echo $Routes->category($listing,isset($listing['Section']) ? $listing['Section'] : '',$listing['Category']);?> </span>

[uPDATE] JReviews 2.7, which added the new listing header cover and logo options, has moved this area from the listing detail theme file to a global listing header file called "detail_header.thtml". You may override that file as need be, and that is where a category link would look best. [/uPDATE]

 

So we have completely changed the way our site works. The PHP code for module assignments works for Single Select Lists. Other types of fields might need a tweak in the code. But using the PHP module assignment option in AMM allows to assign any module we want to listings based on the value of a certain custom field.

I hope this is useful for someone. It sure is for me.

post-10188-14242989694864_thumb.jpg

post-10188-14242989695456_thumb.jpg

Edited by Steven Koontz
Link to comment
  • 3 weeks later...
  • 4 weeks later...
  • 1 month later...
  • 2 weeks later...
×
×
  • Create New...