Joomla different module order in different pages - joomla

I'm working with Joomla v3 and have this problem:
I have 2 modules (for example module_1 and module_2) in one position. Module_1 is above module_2 in all pages, but in one page it should be in reverse.
I know I can duplicate modules and add they to new position but I just want only one module instance. So if I change this module it will be change across website.
So how to have only one module instance and apply different order in different pages?
Thanks

You can create 2 new HTML modules and use {loadmodule module} as code and assign it on the desired position (inverted).
But in most of the cases does not work. In your case I will assign your modules position to two new positions (i.e.: assign theme to module1_position and module2_position). Then create four new html module using {loadposition position_created} and assign them on the desired real position. The four module are just for positioning and the original module are for configuration.
At the end you will have:
module_1 -> your module in position module1_position.
module_2 -> your module in position module2_position.
new_module1_a -> HTML module with the code {loadposition module_1} assigned to position a in all pages minus the one you want different.
new_module2_b -> HTML module with the code {loadposition module_2} assigned to position b in all pages minus the one you want different.
new_module1_b -> HTML module with the code {loadposition module_1} assigned to position b in the single page you want inverted.
new_module2_a -> HTML module with the code {loadposition module_2} assigned to position a in the single page you want inverted.
I hope I made myself clear ;)
EDIT: (After your comment)
In this case you can just create 2 HTML module:
new_module1 with the code {loadposition module_1}{loadposition
module_2} assigned to all pages minus the one you want different
new_module2 with the code {loadposition module_2}{loadposition
module_1} in the page you want different.

You can change your template so that you have two different positions (A and B) and assign one module to each. You can then add a parameter so that for a given style the positions go either B A or A B. Then assign the appropriate style to the appropriate page for the order you want.
Alternatively, depending on your containers, it is possible you could use css to control the positioning.

OK, so I figured it out. I'm using Joomla version 3.4.
Create module globally - in my case create custom HTML module and
don't assign it to any position/sidebar and show this module on
every page (pages can be selected by your own but at least all pages
that you want module to show up must be selected). Very important is
to check 'Prepare content' ('yes' or it must be green) under Options
tab.
Create new custom HTML module that you want to show in position
one - so select every page that you want and of course the position
you want. After creating you can of course order the module as you
want. In the content you need to add this code: {loadmodule custom,Name of your global module}. Very important thing is to check 'Prepare content' under
Options tab again.
Create another custom HTML module that you want to
show in another position - do the same as in the point 2.
Now you can assign both modules to pages you want, positions you want and order it as you want. Of course if you need to use this module for another position for other pages you can create third module and do the same. Everything you need to change is the global custom HTML module. That's all.
Hope it was helpful for anyone.

Related

Joomla - How can I opt one from various modules to display in a position

I am willing to create a logic in which If I can fetch only desirable module in a particular position.
As we know that Joomla displays the module on basis of positions given to modules created, hence there could be several modules for a single position.
Now what If I only want a single module from those modules who has the position, say "positon-1".
Thanks
Each module can be told to be shown only on specific pages. Look in the module settings at the "Menu Assignment" part. There you can set it to show on
all pages
No pages
Only on the pages selected
On all pages except those selected
So you can set a module to show on the homepage in position-1, but on all other pages there is a different module shown on the same position.
Don't position names like position-1, although the example templates shipped with Joomla! do so. Use semantic names for the module positions. Then, within your template, you define, where these positions live.
Now what If I only want a single module from those modules who has ... [a certain] position
That will never happen then. You're going to have a position called search where the serach field is located, and maybe another one called navigation, where you publish your navigational menus. You get a lot more positions, but also much more flexibility. So if you have a module that needs its own position as in your question, let's have it that.

create dynamic template for joomla 1.5

there are tutorials on the web about gow to create index.html, css file and template.xml that contain placeholders. ok, i got it, it's simple. but i need a template that has some different views. for example:
-all pages have a topmenu, header, left sidebar, mainarea and a footer but:
-first page has no header .topmenu after which sidebar, mainarea and footer comes.
-second page has sidebar moved from left to right
-third page has four blocks (blocks for special offers) instead of mainarea.
as far as i can see, i need to create three standalone templates with unique set of placeholders for each template. because i can't see the way to change laarge mainarea placeholder with four placeholders for offers blocks on some pages. dynamically.
is there if-statements in joomla templates to simply determine a document id to view four placeholders instead of mainarea. or to not show header on the main page (f.e. doc. id="mainpage")
but i want it to be selectable like:
-this page has first case of that template (index_1.php)
-and that page has a second case of the same template (index_2.php)
like a selectbox.
is that possible?
I will make this an answer as opposed to a comment since I believe it will do what you are looking for.
Once your articles are setup and your links to them are established (the site has the info on it you're looking for), you can create the modules containing the data that you want shown from time to time.
Go to the module manager - on the right you should see 'module assignment' or something along the lines of 'display this module on the following pages'; you can then pick which pages you want the module to show on. You can specify all pages, none, specific pages, however you want.
This will enable you to show them only where needed however you like.
You can ALSO do this programatically inside the module (if you do custom HTML and use an extension like Sourcerer to add PHP to the module) with PHP should you want a little more flexibility, but just choosing the pages to show on should work for what you're doing.

Same modules on one page in Joomla 2.5

I am using JA Cloris template which is a one page template for joomla 2.5. I have implemented a module in a section of the page. Is it possible to implement the same module in different position of the same page. If so please help me out!!
If you want to show the same module twice on the page, just add another copy of the module to the Module Manager and place it in a different module position. Most modules can be used as many times as you want on the same or different pages by just adding another copy in the Module Manager.
If you need to style the module differently (example: One is a wide wide horizontal module position vs. a vertical or square sidebar position), add a Module Class Suffix. That will allow you to add CSS styling to a module without affecting the other copies of it on the page.

Custom section/category viewing in Joomla

I have written some modules to have it look nicely. What I need now is to re-order Joomla's standard viewing of the content. I have looked into com_content, and my first idea was to write my own component for it. But now I realized it would be about 90% a copy of com_content.
The problem is: When you open a link to a section, com_content views a list of the categories. But I want a list of the articles in category News of each viewed, and a link to every article in category Infos on the menu to the left. And of course, view each on click.
Is there a way to achieve that without writing an own component? Or would it be advisable to customise com_content to my needs? I want this done with a minimum of fuss and complexity.
You can override components view-templates in your theme.
In your case, for articles: Articles are part of the content component. components/com_content/views/article/tmpl/default.php is the default view of an article.
To override it copy the file to templates\<yourtheme>\html\com_content\article/default.php.
As an example, see the default theme ja_purity or beez, which also override it.
That way, you will only change the layout and only for your theme. The component will stay in tact and updates will not be as complicated as otherwise.
The visible components on your website are called modules. See the modules section in the admin section. The category-view is one of the default modules. There is also a module to display a list of categories (AFAIK). That is what you want, right? The modules listed in the module section are not all available ones, but all that are created. You can create a new one and set its type to the category-list for example, and define in what block of the theme it should display.
If you want to do your own Module, do so. Code it, then add it in your admin section and you’re done.

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

I am trying 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.
Create a new category using the "category manager" option from the content menu
Ensure all the articles are published into this same category.
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)
Add a category blog layout option to this new menu
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:
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.
Create a new article preferably uncategorized. Give it the name of your module.
In the body area of the article type {loadposition custom1} and save your article.
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.

Resources