开发者

How can I add HTML near the </body> tag within a Joomla Module?

I am quite new to using Joomla. I have created a custom module, however I would like to add some code near the </body> tag (or near the opening <body> tag) so it is 开发者_运维知识库guaranteed to be not nested in any tables whatsoever that might be in the template.

I have located details on how to do this within a content plug-in, however I would like to just have the module.

Any ideas? Thank you.


If the entire module is to go just before </body> then you will need to create a module position in your template. In the file /templates/[name]/index.php put this in the required location:

<jdoc:include type="modules" name="endofpage" />

Now when you add the module you can put it in the position "endofpage" (or a better name if you choose).

Otherwise, if your main module content is to be within the regular design, you will have to create two modules or use the plugin method like you said. There is no way to inject content into two different parts of a page with one module (unless you use Javascript to generate it).


I'm not quite sure I follow why what DisgruntledGoat suggested won't work.

If you want to add code immediately at the start of the

1) Create a new module position in your template.xml (call it startofpage, or endofpage) 2) In you template index.php place the code 3) Depending on what you want to output, change the style attribute of the module

</head>
<body>
<jdoc:include type="modules" name="startofpage" style="xhtml" />
...YOUR CONTENT IN HERE
<jdoc:include type="modules" name="endofpage" style="xhtml" />
</body>
</html>


Stuff on a joomla website is placed inside positions, so it depends on the positions your template has.

So, if there is an empty position available (that comes after all the other positions), placing your module there will have it as the last thing before the end of body.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜