Wednesday, January 4, 2012

How to Load Joomla Component In Module ?

Hello, I was equally frustrated trying to get a component into a module until I had a moment of brilliance!
I have found a relatively simple way to get around this problem.

The method I used was to put it in a wrapper.
Step 1.
Download attachment.
Or..
Create it yourself.

The template would look something like this for joomla! 1.0.x.

1.1Create folder named "Componentshow".

1.2 Create index.php

<html><head>
<?php mosShowHead(); ?>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0">
<td width="100%" height="100%" valign="top">
<?php mosMainBody(); ?>
</td>
</table></body></html>

1.3 Create templateDetails.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall type="template" version="4.5.2">
<name>Componentshow</name>
<creationDate>16/02/08</creationDate>
<author>Unknown</author>
<copyright>GNU/GPL</copyright>
<authorEmail> nobody@nowhere.com </authorEmail>
<authorUrl>http://www.nowhere.com</authorUrl>
<version>0.1</version>
<description>Blank Mainbody Template</description>
<files>
<filename>index.php</filename>
<filename>template_thumbnail.png</filename>
</files>
<css>
<filename>css/template_css.css</filename>
</css>
</mosinstall>

1.4 Create a "template_thumbnail.png" file for the template logo.
1.5 Create folders named "Images" and "css" in template folder.
1.6 Create a blank "template_css.css" file in the css folder.

Step 2.
Go to your menu manager and create a new menu. Name it whatever you wish.
Add the component you need to the new menu.
Copy the itemid of the component.

Step 3.
Go to your module manager and copy the wrapper module and name it.
Put the component url into the wrapper replace the bracket items accordingly.
url: [site location]/index.php?option=com_[componet]&Itemid=[itemid]

Now, set your module position to an unused position for example: user9.

Step 4.
Go to mambots and make sure loadModulePositions is enabled.

Step 5.
Go to any place in your content and insert the following code. {mosloadposition user9}.

Step 6.
Go to your template manager and assign the template to your component only.

Step 7.
Go to the location and check that everything works. You can now modify the template's php's or css file to fit your needs.

Step 8.
Buy me a beer!

You are now able to put components anywhere inside content or modules!

Hope this solved your problem.

You do not have the required permissions to view the files attached to this post.  Article Source Link http://forum.joomla.org/viewtopic.php?t=219149
      

A

No comments:

Post a Comment