Publishing certain modules only on article page?
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
-
- Joomla! Apprentice
- Posts: 29
- Joined: Mon Jul 23, 2007 6:22 am
Publishing certain modules only on article page?
I'm definitely a new one when it comes to templates....anyway, I'm playing with this on local machine, trying to get inside all nuts and bolts. My question probably fits here (I couldn't find a better place to put it in).
How can I publish certain module only on article page? Everything is working nicely, except this. I don't want that module to appear anywhere else (front page, section, categories)...is this involves some modification inside templates/html or something else? The trick is that the idea is that frontpage, sections and categories hold some other modules in that position, but the article page should display another module right next to the article. As far as I understood, there may have been a way to do this, and looking through the forum I picked up a few interesting ideas... like "assign module to certain position which will not be published anywhere else, but on the article page" or "the module that holds vertical banners is to be copied to templates/html/... and then something needs to be done there (and I don't know what)"...anyway, the position is on the right side (it's a simple 3-way column, and position is called 'right'). On category and section page, that position holds other modules....
Anyone had some similar issue??? Any leads to the right direction???
Thanks in advance...
How can I publish certain module only on article page? Everything is working nicely, except this. I don't want that module to appear anywhere else (front page, section, categories)...is this involves some modification inside templates/html or something else? The trick is that the idea is that frontpage, sections and categories hold some other modules in that position, but the article page should display another module right next to the article. As far as I understood, there may have been a way to do this, and looking through the forum I picked up a few interesting ideas... like "assign module to certain position which will not be published anywhere else, but on the article page" or "the module that holds vertical banners is to be copied to templates/html/... and then something needs to be done there (and I don't know what)"...anyway, the position is on the right side (it's a simple 3-way column, and position is called 'right'). On category and section page, that position holds other modules....
Anyone had some similar issue??? Any leads to the right direction???
Thanks in advance...
Last edited by A1ex037 on Fri Feb 29, 2008 5:40 pm, edited 2 times in total.
- radiant_tech
- Joomla! Guru
- Posts: 531
- Joined: Sat Dec 15, 2007 3:02 pm
- Location: Washington DC Metro
Re: Publishing ads only on article page?
I'd start with creating a position that will only be used by these banner ads (don't forget to add it to your templateDetails.xml file). Then add php logic to the template index.php file that checks whether the page being displayed is an article. Further in the template, use that logic to decide whether to display the new position.
Catch up with me on Google+: https://plus.google.com/106742096640193690159
-
- Joomla! Apprentice
- Posts: 29
- Joined: Mon Jul 23, 2007 6:22 am
Re: Publishing ads only on article page?
OK, this one was easy...radiant_tech wrote:I'd start with creating a position that will only be used by these banner ads (don't forget to add it to your templateDetails.xml file).
...but could you please explain how do I accomplish this?radiant_tech wrote: Then add php logic to the template index.php file that checks whether the page being displayed is an article. Further in the template, use that logic to decide whether to display the new position.
Thanks.
- radiant_tech
- Joomla! Guru
- Posts: 531
- Joined: Sat Dec 15, 2007 3:02 pm
- Location: Washington DC Metro
Re: Publishing certain modules only on article page?
Here's the logic that checks whether an article is being viewed and displays all modules assigned to that position:
If you want module chrome to be applied you'll want to add the style="attrib_name" attribute (i.e., style="rounded").
Code: Select all
<?php if( JRequest::getVar( 'view' ) == 'article' ): ?>
<jdoc:include type="modules" name="your_custom_position" />
<?php endif; ?>
Catch up with me on Google+: https://plus.google.com/106742096640193690159
-
- Joomla! Apprentice
- Posts: 29
- Joined: Mon Jul 23, 2007 6:22 am
Re: Publishing certain modules only on article page?
That's exactly what I needed!
Thank you very much!
I really appreciate it...
Thank you very much!
I really appreciate it...
-
- Joomla! Apprentice
- Posts: 18
- Joined: Mon May 26, 2008 11:09 am
- Location: india
- Contact:
Re: Publishing certain modules only on article page?
i aplied this but tis giving error at that position
Fatal error: Class 'JRequest' not found in C:\wamp\www\joomlatest\templates\canada\index.php on line 240
Fatal error: Class 'JRequest' not found in C:\wamp\www\joomlatest\templates\canada\index.php on line 240
-
- Joomla! Apprentice
- Posts: 24
- Joined: Mon Jun 30, 2008 8:51 pm
Re: Publishing ads only on article page?
Hi, I have the other way around question. I have a module that I would like to appear on a "blog view" but then not on the individual articles when they are clicked from that view. I see I could add the same logic with the negative condition, but perhaps there is a different way that would not require customization.radiant_tech wrote:I'd start with creating a position that will only be used by these banner ads (don't forget to add it to your templateDetails.xml file). Then add php logic to the template index.php file that checks whether the page being displayed is an article. Further in the template, use that logic to decide whether to display the new position.
Also, some hints on writing the code for Joomla 1.0.x would be great.
Tks, Willie.
- toner728
- Joomla! Intern
- Posts: 57
- Joined: Wed Aug 27, 2008 1:55 pm
- Location: New York City
- Contact:
Re: Publishing certain modules only on article page?
Ok.. I want to display banner ads in article view.. where do i add the
<?php if( JRequest::getVar( 'view' ) == 'article' ): ?>
<jdoc:include type="modules" name="right" style="rounded" />
<?php endif; ?>
code in the index.php??
<?php if( JRequest::getVar( 'view' ) == 'article' ): ?>
<jdoc:include type="modules" name="right" style="rounded" />
<?php endif; ?>
code in the index.php??
-
- Joomla! Apprentice
- Posts: 35
- Joined: Wed Oct 31, 2007 7:19 pm
- Location: Singapore
Re: Publishing certain modules only on article page?
I would like to take this one step further. I would like to assign different modules to different sections / categories on the articles page. So for example, module1 is linked to all articles of category 1 and section 1; whereas module 2 is assigned to all articles of category 2 section1; etc.
I cannot define this through menu assignment as the article pages are being displayed through the latestnews module.
thanks
I cannot define this through menu assignment as the article pages are being displayed through the latestnews module.
thanks
-
- Joomla! Intern
- Posts: 51
- Joined: Thu Sep 27, 2007 4:40 pm
Re: Publishing certain modules only on article page?
is there a component that could help out with this? hmm..
-
- Joomla! Fledgling
- Posts: 4
- Joined: Fri Dec 05, 2008 8:49 pm
Re: Publishing certain modules only on article page?
Just an FYI...
One thing you could do if you want a module to show up in an article is assign the module to an unused position, then put the following code in your article:
{loadposition positionname}
This will load the module in that article only, and you can put it in any articles you want.
Not sure if this works in Joomla 1.0 or not. I've only done it in 1.5
(http://docs.joomla.org/How_do_you_put_a ... article%3F)
One thing you could do if you want a module to show up in an article is assign the module to an unused position, then put the following code in your article:
{loadposition positionname}
This will load the module in that article only, and you can put it in any articles you want.
Not sure if this works in Joomla 1.0 or not. I've only done it in 1.5
(http://docs.joomla.org/How_do_you_put_a ... article%3F)
- ruigato
- Joomla! Enthusiast
- Posts: 129
- Joined: Sat Aug 20, 2005 4:12 pm
- Location: Arouca - Portugal
- Contact:
Re: Publishing certain modules only on article page?
is there any documentantion on this?
can someone replicate this code to J1.0
This opens lots of possibilities for me
can someone replicate this code to J1.0
Code: Select all
<?php if( JRequest::getVar( 'view' ) == 'article' ): ?>
<jdoc:include type="modules" name="your_custom_position" />
<?php endif; ?>
-
- Joomla! Apprentice
- Posts: 35
- Joined: Wed Oct 31, 2007 7:19 pm
- Location: Singapore
Re: Publishing certain modules only on article page?
Another way of course is the "metamod". This will allow you to specify specific rules to display modules. Rules such as which sections, categories and/or article ids. Metamod, well ... its perfect
http://extensions.joomla.org/extensions ... 91/details
http://extensions.joomla.org/extensions ... 91/details
- mermedia
- Joomla! Apprentice
- Posts: 6
- Joined: Fri May 04, 2007 2:03 pm
- Location: Virginia
- Contact:
Re: Publishing certain modules only on article page?
Thanks! that is what I was looking forsoylent wrote:Just an FYI...
One thing you could do if you want a module to show up in an article is assign the module to an unused position, then put the following code in your article:
{loadposition positionname}
This will load the module in that article only, and you can put it in any articles you want.
Not sure if this works in Joomla 1.0 or not. I've only done it in 1.5
(http://docs.joomla.org/How_do_you_put_a ... article%3F)
-
- Joomla! Apprentice
- Posts: 9
- Joined: Wed Sep 27, 2006 6:16 am
Re: Publishing certain modules only on article page?
Hi,
This is something I need as well so thanks for the advice.
One other thing....
The module I am inserting in the article is a slideshow of images. Is there any way to wrap the text in the article around the inserted module (as you would with a single image being inserted into and article)?
This is something I need as well so thanks for the advice.
One other thing....
The module I am inserting in the article is a slideshow of images. Is there any way to wrap the text in the article around the inserted module (as you would with a single image being inserted into and article)?
-
- Joomla! Fledgling
- Posts: 4
- Joined: Sun Jun 07, 2009 11:18 am
Re: Publishing certain modules only on article page?
hi!. I have inserted a Prayer center menu module into an article. the problem i m facing is it does not have the same look feel as the original module(when i link the module directly to menu item).
here's are the two pages please compare. and tell me what i should do.
Link1:http://knowjesus.in/joomla/prayer-center.html(the article where i have inserted the module)
Link2:http://knowjesus.in/joomla/component/pr ... ?task=view( here i have the original module when it is directly linked to the menu item )
here's are the two pages please compare. and tell me what i should do.
Link1:http://knowjesus.in/joomla/prayer-center.html(the article where i have inserted the module)
Link2:http://knowjesus.in/joomla/component/pr ... ?task=view( here i have the original module when it is directly linked to the menu item )
-
- Joomla! Apprentice
- Posts: 6
- Joined: Fri Sep 07, 2007 1:48 pm
Re: Publishing ads only on article page?
Another way is this:radiant_tech wrote:I'd start with creating a position that will only be used by these banner ads (don't forget to add it to your templateDetails.xml file). Then add php logic to the template index.php file that checks whether the page being displayed is an article. Further in the template, use that logic to decide whether to display the new position.
1. Define the new position, eg articleright in templateDetails.xml
2. Modify your template's index.php and add the following code just before or after "right" module positioning:
Code: Select all
<?php if ($this->countModules('articleright')) { ?>
<!-- BEGIN: RIGHT COLUMN -->
<div id="ja-col2">
<jdoc:include type="modules" name="articleright" style="xhtml" />
</div><br />
<!-- END: RIGHT COLUMN -->
<?php } ?>
The stuff that makes it automagically appear only in article view is style="xhtml" !
-
- Joomla! Apprentice
- Posts: 20
- Joined: Sun Jul 26, 2009 9:37 am
Re: Publishing certain modules only on article page?
I am a newbie and found the following works for me and may offer some clues. I created a menu item called "articles" which goes to Joomla article page (write / read /edit) where users can select section / category. Now you can attach your module to this menu item under module manager->select module->menu assignment. If you want this module to appear only for certain categories, you can create a small custom code with few lines of custom code that allows only those articles to display. Not sure if this suits your need.
- bil7y
- Joomla! Apprentice
- Posts: 36
- Joined: Thu May 14, 2009 5:57 pm
- Location: San Francisco, California
- Contact:
Re: Publishing certain modules only on article page?
Modules Anywhere Extension seems to be the way to go here. Probably good to know how to doi the manual way as well. Download Modules anywhere from this link
http://www.nonumber.nl/modulesanywhere?tab=Download
or if you are more direct
http://docs.joomla.org/How_do_you_put_a ... article%3F
How do you put a module inside an article?
From Joomla! Documentation
Jump to: navigation, search
You will usually want to associate modules with articles in some way. The modules are allocated to module positions and the module positions appear somewhere on the web page as determined by the template. However, it is sometimes useful to have a module actually embedded in the article content itself.
To insert a module inside an article you use the "{loadposition xx}" command, as follows:
1.Create a module and set its position to any value that doesn't conflict with an existing template position. You can type in the position value instead of selecting it from the drop-down list. For example, use the position "myposition".
2.Assign the module to the Menu Items that contain the articles that you want the module to show in. You can also just assign the module to "All" Menu Items.
3.Edit the articles where you want this module to show and insert the text "{loadposition myposition}" in the article, at the place where you want the module to show.
The module will show at that point in the article.
Note that this only works when the plugin 'Content - Load Module' is enabled. If this plugin is disabled, the text "{loadposition myposition}" shows unchanged in the article.
http://www.nonumber.nl/modulesanywhere?tab=Download
or if you are more direct
http://docs.joomla.org/How_do_you_put_a ... article%3F
How do you put a module inside an article?
From Joomla! Documentation
Jump to: navigation, search
You will usually want to associate modules with articles in some way. The modules are allocated to module positions and the module positions appear somewhere on the web page as determined by the template. However, it is sometimes useful to have a module actually embedded in the article content itself.
To insert a module inside an article you use the "{loadposition xx}" command, as follows:
1.Create a module and set its position to any value that doesn't conflict with an existing template position. You can type in the position value instead of selecting it from the drop-down list. For example, use the position "myposition".
2.Assign the module to the Menu Items that contain the articles that you want the module to show in. You can also just assign the module to "All" Menu Items.
3.Edit the articles where you want this module to show and insert the text "{loadposition myposition}" in the article, at the place where you want the module to show.
The module will show at that point in the article.
Note that this only works when the plugin 'Content - Load Module' is enabled. If this plugin is disabled, the text "{loadposition myposition}" shows unchanged in the article.
-
- Joomla! Enthusiast
- Posts: 169
- Joined: Tue Jan 22, 2008 4:05 am
Re: Publishing certain modules only on article page?
In answer to A1ex037's original question, and agarza's "is there a component that could help out with this?" I would like to point out MetaMod:
http://extensions.joomla.org/extensions ... ntrol/3391
http://www.metamodpro.com/
MetaMod is a module that you publish in the normal way. In the MetaMod configuration, you tell it when to include other modules inside of itself.
This can then achieve what you are asking for - the rules inside MetaMod can, for example, detect when you are on a particular article page. Or, when you are on the category list/blog page (as opposed to viewing an article itself). Or, it can detect which category/section the article you are viewing is actually in.
Add to that date/time detection, browser detection, browser language detection, GeoIP, whether or not the user is logged in, and more, and you have some idea of what MetaMod is capable of.
So when MetaMod detects any of these conditions, it can decide when to display other modules, or not.
All of this is achieved without having to alter your template index.php file. A little PHP is often required to craft the rules, but there are pages of examples on the web site ("recipes" section), and an active support forum.
http://extensions.joomla.org/extensions ... ntrol/3391
http://www.metamodpro.com/
MetaMod is a module that you publish in the normal way. In the MetaMod configuration, you tell it when to include other modules inside of itself.
This can then achieve what you are asking for - the rules inside MetaMod can, for example, detect when you are on a particular article page. Or, when you are on the category list/blog page (as opposed to viewing an article itself). Or, it can detect which category/section the article you are viewing is actually in.
Add to that date/time detection, browser detection, browser language detection, GeoIP, whether or not the user is logged in, and more, and you have some idea of what MetaMod is capable of.
So when MetaMod detects any of these conditions, it can decide when to display other modules, or not.
All of this is achieved without having to alter your template index.php file. A little PHP is often required to craft the rules, but there are pages of examples on the web site ("recipes" section), and an active support forum.
-
- Joomla! Apprentice
- Posts: 5
- Joined: Wed Feb 10, 2010 1:35 pm
Re: Publishing certain modules only on article page?
Hi,
so I have added the carousel module into one article and now I want to add another carousel module in a different position in a different article. Is this possible?
Cheers
so I have added the carousel module into one article and now I want to add another carousel module in a different position in a different article. Is this possible?
Cheers
- Ghonjez
- Joomla! Exemplar
- Posts: 8770
- Joined: Sat Oct 18, 2008 3:02 am
- Location: Mars
- Contact:
Re: Publishing certain modules only on article page?
Hi...
Yes, it's possible. There are several methods for insert / embed module in article. You can embed any modules in any articles
Tutorial >>> http://docs.joomla.org/How_do_you_put_a ... article%3F
Or with extensions >>> Modules Anywhere and Metamod. See also extension on Embed & Include section on JED. There are a lots of extensions for do this
hope helps
Yes, it's possible. There are several methods for insert / embed module in article. You can embed any modules in any articles
Tutorial >>> http://docs.joomla.org/How_do_you_put_a ... article%3F
Or with extensions >>> Modules Anywhere and Metamod. See also extension on Embed & Include section on JED. There are a lots of extensions for do this
hope helps
-
- Joomla! Apprentice
- Posts: 5
- Joined: Wed Feb 10, 2010 1:35 pm
Re: Publishing certain modules only on article page?
ok, so i did this {loaduser1 yoo-slider} and it won't work. But when I do this {loadright yoo-carousel} it works?!
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Fri May 02, 2008 11:57 pm
Re: Publishing certain modules only on article page?
how would you should a different module per each article using php if/elseif/else? If I can get the info on figuring out the Article ID then I could do this easy.
-
- Joomla! Enthusiast
- Posts: 103
- Joined: Thu Jun 29, 2006 7:31 pm
Re: Publishing certain modules only on article page?
I am trying to go the {loadposition positionname} route. I have the module showing up in the article like I want.
I am using a postion that I don't need. However when I do the above it also shows in that module postion. How do I make it so that it doesn't show up in that module position. Is that possible going this route
I am using a postion that I don't need. However when I do the above it also shows in that module postion. How do I make it so that it doesn't show up in that module position. Is that possible going this route
- Ghonjez
- Joomla! Exemplar
- Posts: 8770
- Joined: Sat Oct 18, 2008 3:02 am
- Location: Mars
- Contact:
Re: Publishing certain modules only on article page?
Hi...
For display certain modules in certain article, you could try also this extension :
Advanced Module Manager >>> http://extensions.joomla.org/extensions ... ment/10307
hope helps
For display certain modules in certain article, you could try also this extension :
Advanced Module Manager >>> http://extensions.joomla.org/extensions ... ment/10307
hope helps
- Per Yngve Berg
- Joomla! Master
- Posts: 30934
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: Publishing certain modules only on article page?
Alfredo Tester wrote:I am trying to go the {loadposition positionname} route. I have the module showing up in the article like I want.
I am using a postion that I don't need. However when I do the above it also shows in that module postion. How do I make it so that it doesn't show up in that module position. Is that possible going this route
Use a position name that does not exist in your template.
Tip. You can type in a name in Module Manager without opening the dropdown box.
-
- Joomla! Fledgling
- Posts: 1
- Joined: Sat Aug 21, 2010 4:33 pm
-
- Joomla! Apprentice
- Posts: 19
- Joined: Wed Sep 29, 2010 5:08 am
Re: Publishing certain modules only on article page?
Hi All,
I am bit confused,
Now i divided the middle part into three parts(COLUMN),
By default, two columns are already filled with contents,
now i need to add some more content(Article) into the third column.Now its blank.
How can i achieve this.
Please find the attached screenshot.
Thanks in Advance,
IpRameshKumar.
I am bit confused,
Now i divided the middle part into three parts(COLUMN),
By default, two columns are already filled with contents,
now i need to add some more content(Article) into the third column.Now its blank.
How can i achieve this.
Please find the attached screenshot.
Thanks in Advance,
IpRameshKumar.
You do not have the required permissions to view the files attached to this post.
- Per Yngve Berg
- Joomla! Master
- Posts: 30934
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: Publishing certain modules only on article page?
It will be filled in automatically when you publish the 4. article. Remember to tick the Publish on Frontpage option.