开发者

How to show a module in Joomla when it's not a Menu item

I am t开发者_Go百科rying to show a module, but the article I want to show the module on is not linked to a menu item. Is this possible? Seems like a module can only show when it is a menu item. But I have a ton of articles that are not menu items - so what is easiest way to show the module? Any help would be greatly appreciated.


The way to do this is as follows.

Let's suppose you have a group of articles that you wish to all display the same modules on.

  1. Create a new category using the "category manager" option from the content menu

  2. Ensure all the articles are published into this same category.

  3. Create a new menu which you won't actually ever display anywhere (I like to publish the menu into a module position which is not present in the template)

  4. Add a category blog layout option to this new menu

  5. Now go through each of the modules that you wish to display for the group and add them to the new menu item you have created.

Hope this helps!


This will be my first answer after getting so many help through stackoverflow without being a member. I will just add something to buzzki's answer. Because i was almost loosing my mind until i figure out how to solve.

If you used an article in a module with an extension like mod_articleasmodule; it adds the aliases of articles on URL of Read More. Simply change the line;

$link = "index.php?option=com_content&view=article&id=".$item->id.":".$item->alias."&catid=".$item->catid.":".$item->catalias;

to

$link = "index.php?option=com_content&view=article&id=".$item->id."&catid=".$item->catid;

to get the pure URL Link and your menu assigned by MetaMod will work. Also great thanks to buzzki for help.


While the {loadposition xxx} technique is very handy, what it won't do is to put the module into any of the "standard" module positions (e.g. left, right, banner, or whatever your template has).

If you want your module in one of those positions, a great method is to use MetaMod. MetaMod is a placeholder module, that includes other modules inside of itself according to rules that you set up.

So you can set it up with a rule that says, in effect, "if we are on article A, B, C, D or E, display the module".

if ($content_genius->check("article_id = 50, 51, 52, 53, 54")) return XXX;
// replace XXX with the module id to show on those articles

Now, if the number of articles is going to change regularly, you don't want to have to edit the MetaMod to change the list of ids. So another way is to use the Meta Keywords field in the articles to determine whether the module will appear. Then all you have to do is include that keyword on any article you want the module to appear on. Let's say the keyword will be "SHOWMOD".

So in MetaMod you can simply use this:

if ($content_genius->check("article_metakeywords contains SHOWMOD")) return XXX;
// replace XXX with the module id to show on those articles

In that way, the module will appear on every article page where the article contains that meta keyword. And the module position can be any position on the page (wherever the MetaMod is assigned).


Step 1: On the front end of your website, click to the specific article that you want, highlight and copy the URL.

Step 2: Create a menu item, item type is URL and paste your article URL in there. (You can have the menu item be in an unpublished menu i think)

Step 3: Select it from the Menu Items list in the module.


You simply name your module position whatever you want, say 'monkey' where your module offers a 'select position'. You actually type it in. Then in the article you want to place it in, you add

{loadposition monkey} 

to any location of your article you want the mod to work in the html editor.


Follow these steps in your joomla site Admin panel:

  1. Go to the module manager, open the desired module and give a unique name in the position field. If you want to use it also at other common position such as left or right, then first create a copy of this module and then for the new copy, create a unique position name. Example: custom1.

  2. Create a new article preferably uncategorized. Give it the name of your module.

  3. In the body area of the article type {loadposition custom1} and save your article.

  4. Create a Menu link to this article in the desired menu. You should select 'Article layout.'

Thats all, your module will now load from the menu link directly.

This has an added advantage of giving you SEO prominance based on the meta info you give for this article.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜