Load a module within my article/default.php?

Everything to do with Joomla! 1.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
techism
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Tue Sep 08, 2009 6:16 pm

Load a module within my article/default.php?

Post by techism » Sat Sep 12, 2009 12:21 am

I'm trying to add my sub-navigation menu to my article layout. I don't want this on every page, just articles. So a simplified example of what I'm trying is:

Code: Select all

<div id="left">
   <jdoc:include type="modules" name="subnav" style="xhtml" />
</div>
<div id="right">
 ... code to display article
</div>
But this is not working.

When I put the jdoc::include on my theme's index.php it shows up, but when I put it in my override, it does not so I must be missing how this works?

How do I output a module to a dedicated spot in an override?

User avatar
wlrdq
Joomla! Hero
Joomla! Hero
Posts: 2672
Joined: Thu Jul 24, 2008 12:48 pm
Location: Austin, TX
Contact:

Re: Load a module within my article/default.php?

Post by wlrdq » Sat Sep 12, 2009 12:32 am

I don't know if you can use the jdoc:include in html overrides. I assume that tag is actually being rendered to your page if you view the source?

I just recently stumbled upon this (with help from another forum poster). Pretty cool way to output modules anywhere. Perhaps you can use this syntax?
http://docs.joomla.org/How_do_you_put_a ... article%3F
Will Mavis - Joomla Developer
http://www.covertapps.com/jam <<< Joomla! on your Android, iPhone, iPad, and iPod Touch
If you think I can help you, PM me a link to your post and I will respond. Please don't hijack another user's thread.

techism
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Tue Sep 08, 2009 6:16 pm

Re: Load a module within my article/default.php?

Post by techism » Sat Sep 12, 2009 12:39 am

wlrdq wrote:I don't know if you can use the jdoc:include in html overrides. I assume that tag is actually being rendered to your page if you view the source?
Yes, it is just rendering that tag in the source.
I just recently stumbled upon this (with help from another forum poster). Pretty cool way to output modules anywhere. Perhaps you can use this syntax?
http://docs.joomla.org/How_do_you_put_a ... article%3F
Yeah, not helpful here though. I've used that for other problems...but that doesn't apply to what I'm doing. I just want a side menu to appear when you are viewing an article that shows other menu items from the same menu. I'm sure there's a VERY easy way to do this.

I don't want the menu within my article, and I need to wrap two div tags around the menu.

I want the menu WITH my article, but not within the article content on every article in the section. I just need the menu beside the article...

Thanks anyway.

User avatar
wlrdq
Joomla! Hero
Joomla! Hero
Posts: 2672
Joined: Thu Jul 24, 2008 12:48 pm
Location: Austin, TX
Contact:

Re: Load a module within my article/default.php?

Post by wlrdq » Sat Sep 12, 2009 3:22 pm

How about adding code to call the JModuleHelper renderModule method?
http://api.joomla.org/Joomla-Framework/ ... nderModule

Let me know if you need help figuring out the code to add.


Another option would be to add code directly in your template that looks at the query string to see if option=com_content and view=article and then adds the jdoc:include tag.

Again, let me know if you need help adding this.
Will Mavis - Joomla Developer
http://www.covertapps.com/jam <<< Joomla! on your Android, iPhone, iPad, and iPod Touch
If you think I can help you, PM me a link to your post and I will respond. Please don't hijack another user's thread.

techism
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Tue Sep 08, 2009 6:16 pm

Re: Load a module within my article/default.php?

Post by techism » Sat Sep 12, 2009 9:21 pm

Thanks, some help would be great!

Also, I don't want one subnav on all articles, but I want that section's subnav - or the menu that was used to arrive at this article's display. What I'm trying to achieve is what's on this page:

http://www.gigoptix.com where each section has its own sub-nav.

User avatar
wlrdq
Joomla! Hero
Joomla! Hero
Posts: 2672
Joined: Thu Jul 24, 2008 12:48 pm
Location: Austin, TX
Contact:

Re: Load a module within my article/default.php?

Post by wlrdq » Sat Sep 12, 2009 9:38 pm

I typically do that kind of subnav functionality by having sub menu items and then creating another instance of mod_mainmenu on the left side of the page and have it only display that sub menu level.

This post may help:
http://docs.joomla.org/Tutorial:Creating_a_submenu


I think there are other modules to help you do what you want.

Let me know if you still can't figure it out.
Will Mavis - Joomla Developer
http://www.covertapps.com/jam <<< Joomla! on your Android, iPhone, iPad, and iPod Touch
If you think I can help you, PM me a link to your post and I will respond. Please don't hijack another user's thread.

techism
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Tue Sep 08, 2009 6:16 pm

Re: Load a module within my article/default.php?

Post by techism » Sat Sep 12, 2009 9:38 pm

Got it:
I can finish from here.

Code: Select all

<div id="sidenav">
		<?php 
			jimport( 'joomla.application.module.helper' );
			$module = JModuleHelper::getModule( 'mainmenu', 'Company' );
			$attribs['style'] = 'xhtml';
			echo JModuleHelper::renderModule( $module, $attribs );
			
		?>
	</div>

That's what I was fishin' for. Thanks a ton!

User avatar
wlrdq
Joomla! Hero
Joomla! Hero
Posts: 2672
Joined: Thu Jul 24, 2008 12:48 pm
Location: Austin, TX
Contact:

Re: Load a module within my article/default.php?

Post by wlrdq » Sat Sep 12, 2009 9:56 pm

No problem. Glad I could help.
Will Mavis - Joomla Developer
http://www.covertapps.com/jam <<< Joomla! on your Android, iPhone, iPad, and iPod Touch
If you think I can help you, PM me a link to your post and I will respond. Please don't hijack another user's thread.

aaron harding
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 226
Joined: Tue Jul 21, 2009 3:30 pm
Location: United Kingdom
Contact:

Re: Load a module within my article/default.php?

Post by aaron harding » Mon Sep 14, 2009 3:22 pm

if you just want to load a module within an article why not type "{loadposition menu}" into an article and change the module position to "menu"
-- Aaron Harding - Qlue --
-- http://www.qlue.co.uk --

User avatar
wlrdq
Joomla! Hero
Joomla! Hero
Posts: 2672
Joined: Thu Jul 24, 2008 12:48 pm
Location: Austin, TX
Contact:

Re: Load a module within my article/default.php?

Post by wlrdq » Mon Sep 14, 2009 3:31 pm

I believe techism wants the menu to show up for all articles and doesn't want to have to manually add that to every article. Make sense?
Will Mavis - Joomla Developer
http://www.covertapps.com/jam <<< Joomla! on your Android, iPhone, iPad, and iPod Touch
If you think I can help you, PM me a link to your post and I will respond. Please don't hijack another user's thread.

aaron harding
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 226
Joined: Tue Jul 21, 2009 3:30 pm
Location: United Kingdom
Contact:

Re: Load a module within my article/default.php?

Post by aaron harding » Mon Sep 14, 2009 3:46 pm

Sorry i miss read, i guess my way works if u want to do it manually :-[
-- Aaron Harding - Qlue --
-- http://www.qlue.co.uk --


Locked

Return to “Templates for Joomla! 1.5”