Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm going to disagree with <strong>Hanny</strong>. I think the answer is no, not as you describe.</p> <p>The template knows when it has reached a module position, and it gets a list of modules assigned to that position, then calls for them to be rendered. But it doesn't pass that information on. It's not stored in JApplication or JDocument etc either (like, nothing stores where in the template the rendering is up to or anything).</p> <p>There are some hacky ways to almost get what you want though. If you know the template positions you need to search (sadly there's no easy method for getting this from the template - otherwise you could parse your template's .XML file for <code>&lt;position&gt;</code> elements...), then you could do something like:</p> <pre><code>&lt;?php $positions = array('left', 'right', 'top', 'bottom') $found_in = false; foreach ($positions as $cur_position) { $module_positions = JModuleHelper::getModules($cur_position); foreach ($module_positions as $cur_module_in_pos) { if ($cur_module_in_pos-&gt;module == 'mod_MYMODULE') { $found_in = $cur_position; } } } if ($found_in) ... </code></pre> <p>Of course, this doesn't work well if your module is included multiple times on the page, but maybe that's an assumption you can make?</p> <p>Otherwise it'd be up to hacking the core - you could use a <code>JDispatcher::trigger()</code> call before the template calls a module, set some var etc. Unfortunately there's no such event in core to start (a <code>pre_module_render</code> or something).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload