What is the easiest way to add a code snippet to third party Joomla theme? - joomla

Completely new to Joomla. Hope that what I'm asking is simple and quick.
I thought it was module (the easiest way that is). So I created it, made it to properly include required scripts and styles, made it show up only on home page. But now that it shows, it appears in a default module structure, with a title and module content container. Can't I simply inject my snippet without extra markup? Simply a div with id and a script tag?

You can create a System Plugin for Joomla and use the onAfterFilter event to add your script's and style's to the document.
$doc = JFactory::getDocument();
$doc->addScript("http://www.example.com/js/myscript.js");
$doc->addStyleSheet("http://www.example.com/css/mystylesheet.css");
A documentation on how you can create plugins can be found here: http://docs.joomla.org/Plugin

Related

How to show the plugins in the page in joomla

I have installed the plugin simple image gallery module in joomla. But i cannot figure out how to show the plugin in the site page, as menu item. Anyone could help me?
Thank you.
Try this,
If that is module then:
create an article,
also create a menu and assign that article to the menu system,
then inside your article content load the module with their position like this:
{loadposition your_mod_psoition}
where "your_mod_position" is the module position. Make sure you have content load plugin enabled.
For more information check last section of this article.
If it's Plugin it may have short code for embedding to the page, so you can use that inside your article.
Hope its helps..
First of all, what Plugin are you exactly using? There are a view called simple image gallery. Please add a link.
To show the gallery I suppose the plugin has some kind of syntax to do that. In most cases you can find the syntax you have to use in the plugin manager. Backend: Extensions > Plugin Manager.
Then pick a article that you can see in the frontend and put the syntax in there according to the syntax of the plugin.

Are there any special event hooks for joomla modules

I have been searching special event hooks for use to track and update module forms. I found contenthooks on the documentation site but I couldn't get anything for modules. I want to add a plugin so that it adds an extra field viz. radio button to every module form. Finally I want to use the value of this radio field in templates/your-template/html/module.php. Can someone point me in the right direction towards this. Thanks :)
Jooma does not have event driven structure like for example .NET or Java. However if you want to trigger some additional functionality on certain event you may create a plugin. Plugin is something different than module or component but it 'collaborates' with them. It handles some per-defined events:
[http://docs.joomla.org/Plugin/Events][1]
[1]: http://docs.joomla.org/Plugin/Events and it lets you define your own.
You may also try the way I usually take which is customize module display. You simply copy
view file of the module you want to modify to your template. For example:
/modules/mod_feed/tmpl/default.php
to
/templates/{your template}/mod_feed/default.php
Now you can freely modify this file without any risk that it may be overwritten on the next Joomla update. Just don't forget to set your overwrite in module settings: go to administrator, modules, choose module to edit and in the tab 'Advanced' select 'Alternative Layout'.
I hope this helps and good luck!
Take a look at the new com_ajax that is in 3.2.

Joomla plugin {calls} - how to make them invisible in news display modules?

I am using sigplus image gallery extension for JOomla and sometimes I need to put a call to its plugin by using {gallery /} statement. It works well and it's not visible in the article. But when I want this article to be visible on frontpage and I use any module from JED for that purpose (news scrollers/sliders) the statement is visible.
Look at the example.
Is there a way to make this {statement} disappear? Or is there a slider module which doesn't show it?
The reason you are seeing the call to the plugin is that the modules you are using do not trigger the plugin code so it never gets replaced with a gallery. That's going to be an issue no matter what module you are using because the call if part of the content. Either that will show up or the gallery will unless you manipulate the code to do otherwise.
Your best bet is to modify which ever module you like best. If you look in the SIG plugin there is a regular expression they are using to replace the plugin call with the gallery code. Copy that and place it in your module, but instead up adding in the gallery code, replace the call with nothing and it will no longer appear in your module.

How to add js to a joomla template

i need to add js to a specific page in joomla. How do i do that? I cant find any option to edit the html of each page, since i also have to add some little html. How does joomla do that? i can assign a template for a specific site but then you would have to do each change twice...
I need to add a javascript file and some html to one specific site. i read the wiki and googled but i dont get it...
The reason you couldn't find a page to edit is that there is only one page in a Joomla site that builds all the other pages based on the URL, menu ID, and other parameters passed in the query string.
If you only need the javascript on a single "page" then there are a couple of ways to do it depending on where the content needs to be.
If it needs to go in the main content area (the component position) then you should get an extension that allows you to put javascript inside a regular Joomla article. Then you can put what ever code and HTML you need in the article and link to it with a regular menu item.
If you want it to go in a module position, then you can simply use the Custom HTML module. If you turn off the WYSIWYG editor editor, you can put the javascript right in to the content area of the module. It does require the editor to be off though, otherwise the code will be evaluated and you will lose what ever you had in there. You can also limit where the module displays under the menu assignment selection.

How to have custom sidebar content per article in Joomla?

I'm in the process of porting an existing website to Joomla. Most pages of this website consist of a main content area and a sidebar containing additional items relating to the main content, such as (in-page) links, images, additional information, etc.
In Joomla, the main page content would probably be an article, but I'm not sure what would be the best way to create the sidebar content in Joomla.
Examples of pages-with-sidebar:
http://www.aikikan.nl/en_watisaikido
http://www.aikikan.nl/dojo?id=2
I'm creating a custom template for this website, so any solutions that require modifying the template are fine as well. What would be the best way to set this up?
Keep the content of each sidebar in an article and then assign it to a module by means of the article-as-module extension. You can then control the scope for each module (i.e. choose menu postions for which it will be shown) in the admin interface.
There is an extension called meta mod which is perfect for this sort of thing. It allows you to show modules based on any condition you can evaluate with PHP

Resources