开发者

How to show the outcome of joomla menu item type as a module?

I am not sure how to put it ... but I am using certain modules in my joomla site which can be shown only using a menu item e.g. Phoca gallery, hwdvideo开发者_高级运维share etc. These modules can not be displayed on any specific position, instead a menu item has to be created which links to these modules and shows them according to the configuration parameters selected. Is it possible in any way that I use the outcome of these menu item clicks in any article? e.g. I want to show the video gallery for a specific category as a module (without creating any menu item to be clicked)?

If i am not clear in making my requirement understood, please ask questions and I will respond because I am not sure how should i explain my requirement and exactly what should I search for.


To add a little more sophistication, use a module to put the base url into the iframe like so:

<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
$class = $params->get('class');
$relurl = $params->get('relurl');
$Document =& JFactory::getDocument();
$baseurl = $Document->baseurl;
$url = '';
$j = 0;
while ($j < strlen($relurl)) 
    { 
        $x = substr($relurl,$j,1);
        $j++; 
        if ( $x == '~' ) { $x = $baseurl; }
        $url = $url . $x ;
    }
echo '<iframe class="' . $class . '" src="' . $url . '"></iframe>' . "\n";
?>

This module takes a parameter like '~/index2.php?option=com_proforms&jid=3&cid=-1' and expands the tilde so the iframe points to your site. Hence you don't have to change the code if you move from development to live environment.


If you're using certain "modules" which can only be shown using a menu item, they aren't modules, they are components.

Extensions in Joomla are divided in "Components", "Modules" and "Plugins". Learn their differences.

Module

A module is an extension used for to display simple information. Latest News is an example of a module.

To accomplish your goals (at least in Phoca Gallery), you could download Phoca Gallery Module and then insert your module into articles.


Eh... here's how you can do it. You can link to a component directly by creating a link that looks like this:

http://yourblogname.com/index2.php?option=com_(yourcomponentname).

If you go into your menu manager, and select the component you want to link to, you should see a similar looking URL somewhere in there.

By changing that URL to link to "index2.php" instead of "index.php", you force Joomla to link directly to the component, and dump its raw output to the page.

Now, if you want to drop your component into a module somewhere else on the page, you can just create an Custom HTML module and drop and iframe in with that source URL. Messy, but it's the best option I'm aware of.


Create a menu item assign to a module. Name it sub menu then add this in the component default file to render the sub menu

$modules = JModuleHelper::getModules('user9');
$document   = JFactory::getDocument();
$renderer   = $document->loadRenderer('module');
$params = array('style'=>'');
$contents = '';
$contents .= $renderer->render(current($modules), $params);

echo $contents;

or use {loadposition xxx} in article or user

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜