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.
Related
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.
I've created a custom hook, so that I can include my custom module in any .tpl file by a single line: {hook h='calcSubstrate'}.
However, I can't use it in CMS page, at least not by using the admin panel - including smarty code in a CMS page won't render, the code would appear just as it is, as a text: {hook h='calcSubstrate'}.
Alternatively, if that would be easier/faster - how can I choose on which pages my module would appear?
The editor for CMS page won't recognize any Smarty code. To include hooks in chosen articles/pages, I can think of two options:
Include the hook in the template (cms.tpl), and check for the id of the current page to conditionally display the module. The list of the page ids can be made as the module's configuration.
Build a module to add functionality similar to Wordpress's shortcode to the CMS content. I do this with module instead of overriding the CmsController class, hence I have to display the content with {$cms->content|module}. You can look at the simplified code here for inspiration: https://gist.github.com/tungd/cef0ca1ac1063c1ee90b. Of course you can make it more generic like Wordpress, by having only one Smarty modifier do_shortcode that does everything (just like Wordpress's do_shortcode function).
Last time I did this it was because my client want to put slideshows in some CMS pages, and I chose the second approach because it gives a lot of flexibility about when the module is displayed and where it is displayed between the content. For something else, for example Contact Form, or Map, this would be overkill and the first approach is better.
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.
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.
I have some custom extensions. They're shown in the right sidebar, and I previously had them appearing directly underneath the sidebar cart, which appears at the top, as it has before="-" in the checkout.xml file.
Since upgrading to 1.4.2, my custom extensions now appear at the top of the sidebar. I've added after="cart_sidebar" to the extensions xml layouts, but they still appear above the sidebar cart regardless.
Changing the order of the extensions, they only move amongst themselves, always at the top - for example, if I add after="-" to any of them, they just appear after the other custom extensions, but still at the top above the cart and other default sidebar items.
Anyone any idea why?
UPDATE:
I turned on the "Template Path Hints", and for my custom sidebar blocks, the red text showing the template paths appears further down the sidebar, where the block should be showing, but the actual html of the block is appearing at the top of the sidebar still!
Before trying to find out what's happening in here you should notice following:
All Magento modules and extensions are loaded in such an order that they meet their declaration section requirements (xmls in app/etc/modules/). So that modules that depend on other modules are loaded only after them.
If modules are equal by their needs, then priority goes to 'Mage' namespace, then to custom modules namespaces. Inside namespaces priority is given by alphabetical order.
Module layout configuration is created during module load. So result of "before" and "after" instructions depends on blocks already added by previously loaded modules. I.e. when some block has 'before="-"' instruction - it places block first, but later other blocks from next modules can use their instructions to be attached before this block.
Now let's return to your case. Your problem can have multiple reasons heavily depending on your Magento configuration.
First of all I recommend to
Turn off whole cache - so that you'll see all changes instantly
Turn off all your extensions and test things only with one of them
Turn on default Magento CE theme and skin ("default" package)
Then check following cases:
Maybe your layout scheme is modified and your extension not referencing correct block (same as "cart_sidebar" uses) to put self in.
Maybe some extension deletes original cart_sidebar block and then puts it last in queue of blocks.
Maybe some CSS or JS rules place block only visually before other blocks (check blocks order in original html source)
Maybe some extension is modifying layout composition rules. Try to turn only one of them. Then try to turn only other one and check result.