How to use Joomlas {loadmodule} - joomla

Can somebody please provide an example how to use joomlas build in {loadmodule} feature to load a custom html module. According to the docs at http://docs.joomla.org/How_do_you_put_a_module_inside_an_article%3F
it should be something like
{loadmodule Custom HTML,My module title}
But it does not work that way...
{loadposition} works perfectly. I'm on joomla 3.2.1 btw.

Make sure the name and cases match exactly including spaces. These are examples from the learn joomla sample data.
{loadmodule articles_archive,Archived Articles}
{loadmodule> custom,Custom HTML}
Notice that the exact title goes second.

Based on your comments:
Your module type is Custom HTML, i.e. mod_custom
The title of your module is "Schema Organization DE"
Therefore, as #Elin, has said your loadmodule tag should be
{loadmodule custom,Schema Organization DE}

Try this:
{loadmodule mod_custom,Schema Organization DE}

I would recommend to not to render a specific module, but to render a custom module position like this:
{loadposition my_custom_position}, then go to Extensions > Module manager and published your desires module on my_custom_position
Hope that helps!

content plugin loads Module positions, Syntax: {loadposition user1} or Modules by name, Syntax: {loadmodule mod_login}. Optionally can specify module style and for loadmodule a specific module by title, Syntax: {loadmodule mod_login,module title,style}.
Make sure the menu assignment for the module set to the respective pages.

Related

Using variables in custom joomla module for tooltips

I'm new to joomla development, but I can't seem to figure out how to dynamically fetch descriptions to be displayed as tool tips for the form data of a module backend. I'm looking at an example module from joomlart and their code for a single field element in their xml file looks like this.
<field
name="mainWidth"
type="text"
default="auto"
size="5"
label="MAIN_WIDTH"
description="MAIN_WIDTH_DESC" />
MAIN_WIDTH and MAIN_WIDTH_DESC are obviously variables that are somehow being accessed and rendered later when the module is run in the backend but I can't find where the values to these variables are stored or how to replicate this behavior. Any help would be appreciated.
Label is the label that prints to screen, and description is rendered as the tooltip.
You can just replace these variable names with the actual text and it will work when the form is rendered.
However, in your example, I believe they are using language files to get the text to display.
Whilst you can set a language file within your module for that module's use, naming convention suggests to me that these are being pulled from somewhere like the template's language file.
( Such a file is likely to be found either under /language or /administrator/language or /templates/yourtemplate/language )
The benefit of such files is to allow for translations of the site to exist without having to write a new module / template each time.
Ultimately, if you don't want various language versions of your site, and you only intend to use the module on one site and not sell it as an extension, then there is no strong need to create a language file for your own bespoke modules (though best practise would probably be to do so).

How to include hooks in CMS pages?

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.

Building a native Joomla 3.1 component with refereing com_weblinks component

I'm going to develop joomla 3.1 component.
I have checked lend tutorial. And some people ask us to go through com_weblinks component which is fully written in new MVC style.
Can you please explain img and alt attribute in menu tag and its contents submenu section in weblinks.xml.
And also can you explain link in com_weblinks_categories (option=com_categories&extension=com_weblinks)? How it work? What is the purpose of extension parameter?
<submenu>
<!--
Note that all & must be escaped to & for the file to be valid
XML and be parsed by the installer
-->
<menu link="option=com_weblinks" view="links" img="class:weblinks"
alt="Weblinks/Links">com_weblinks_links</menu>
<menu link="option=com_categories&extension=com_weblinks"
view="categories" img="class:weblinks-cat" alt="Weblinks/Categories">com_weblinks_categories</menu>
</submenu>
And also anyone explain this check condition and parameters and its pattern in controller.php
$this->checkEditId('com_weblinks.edit.weblink', $id)
Thanks a lot
When it comes to articles, banners, weblinks, newsfeed, contacts etc, they use categories. The categories component is not only used for articles but all of the mentioned above. So when you go to view the weblinks, the URL will be option=com_weblinks however when viewing the category, it will use the parent component that's used for it option=com_categories. The child extension is then defined after like so:
option=com_categories&extension=com_weblink
As for the checkEditID function, have a look at this. It's basically a method to check whether or not the ID is in the edit list.
If you look on the Joomla 2.5 menu, you will see small icons on the left hand side of each menu item which I believe img="class:weblinks-cat" is supposed to be used for, however they don't show on Joomla 3.1. I'm not sure why but can always find out why.
Weblinks is most definitely not written in the newest mvc style used by Lendr, if you are coming from 1.5 it is written in the style you should use for 2.5. That style (now known as legacy) also works in J3, but if you extend the base classes you need to rename them.

TinyMCE: Automatic add style attribute on link creation

In TinyMCE, I need to add a in-line style attribute on link creation. The reason is that Google Mail doesn't support tags in a newsletter.
One solution can be "advlink". But who would explain to our user...that he must add css code in a new link...bad solution.
There must be a simpler, user-friendly way, but i can't find it. Is there an option that i can tell the plugin to add automatic style-attributes to a link?
//EDIT
Ok, i think another solution can be, if i can add anchor to 'style_formats'. But an anchor is not supported in 'style_formats'...someone has an idea?
You may write an own plugin which adds the inline style element to links.
An easier approch is to put the necessary code into the setup config paramter.

Joomla 1.0 - need to add drop down menu into existing template

What is the best and easiest way to add a drop down menu to an existing template in Joomla 1.0 (can't upgrade it)?
Thanks
Module SwFreeMenu works with 1.0 afaik.
Depends on what sort of options do you with to provide in that menu. If it's just some static stuff, like Select language: (options) English, German, Spanish, you might get away with adding that directly to the template by editing the template's HTML markup in the right place.
However, if you intend to do something more dynamic, than template is not the place to hack. You may want to create a "module" and ten add it to your list of site modules, to a desired position defined by the template. Then you can set which pages is this module going to appear on. I believe you can duplicate a simple module like the search box, and then change the module's code. I haven't done it before but I bet it's pretty simple.

Resources