Publishing certain modules only on article page?

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.
rameshkumar
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Wed Sep 29, 2010 5:08 am

Re: Publishing certain modules only on article page?

Post by rameshkumar » Tue Oct 05, 2010 2:02 pm

Hi Thanks for the reply,

How can i customize that "xxx article should display only in pageA and yyy article should display only in pageB"?


Thanks,
IpRameshKumar.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30891
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Publishing certain modules only on article page?

Post by Per Yngve Berg » Tue Oct 05, 2010 2:24 pm

Make a new menu item of type Article Layout and point it to article A
Do the same with article B.

I do not see where the modules mentioned in the subject apply.

However you can assign modules to only show on specific menu items in Module manager.

rameshkumar
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Wed Sep 29, 2010 5:08 am

Re: Publishing certain modules only on article page?

Post by rameshkumar » Wed Oct 06, 2010 4:16 am

:p Yeah,
Thats Great, it works...

Thank you,
IpRameshKumar.

lrdeepak
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Sun Jun 20, 2010 10:32 am
Location: India
Contact:

Re: Publishing certain modules only on article page?

Post by lrdeepak » Fri Aug 10, 2012 5:06 pm

how to show a module only when article is edited
Regards
Deepak Labde

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30891
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Publishing certain modules only on article page?

Post by Per Yngve Berg » Sat Aug 11, 2012 6:31 am

You have to use Jrequest::getvar('task')

Do a search. There are many examples in this forum.

lrdeepak
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Sun Jun 20, 2010 10:32 am
Location: India
Contact:

Re: Publishing certain modules only on article page?

Post by lrdeepak » Sat Aug 11, 2012 7:24 am

i want "Indic Writer - Google Transliteration API" module to be displayed when an editor or author edit the article in front-end.

I am not good at editing the php files so if you can refer me some simple solution or topic in this forum where i can find the solution will be helpful to me.
Regards
Deepak Labde

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30891
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Publishing certain modules only on article page?

Post by Per Yngve Berg » Sat Aug 11, 2012 8:18 am

Code: Select all

<?php if (JRequest::getVar('task') == 'edit') { ?>
<jdoc:include type="modules" name="edit-only" style="xhtml" />
<?php } ?>

lrdeepak
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Sun Jun 20, 2010 10:32 am
Location: India
Contact:

Re: Publishing certain modules only on article page?

Post by lrdeepak » Sat Aug 11, 2012 8:46 am

i didn't understand the code, where to put module name?
Regards
Deepak Labde

discy
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sat Mar 23, 2013 4:42 pm

Re: Publishing certain modules only on article page?

Post by discy » Sat Mar 23, 2013 4:43 pm

radiant_tech wrote:Here's the logic that checks whether an article is being viewed and displays all modules assigned to that position:

Code: Select all

<?php if( JRequest::getVar( 'view' ) == 'article' ): ?>
    <jdoc:include type="modules" name="your_custom_position" />
<?php endif; ?>
If you want module chrome to be applied you'll want to add the style="attrib_name" attribute (i.e., style="rounded").

thanks!!! I extended the existing if-statement in the template's index.php, and it worked beautifully!!!

Code: Select all

if ($this->countModules('mainbody-bottom') > 0) {
to:

Code: Select all

if ($this->countModules('mainbody-bottom') > 0 && (JRequest::getVar( 'view' ) == 'article'))

andrei_ro
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Mar 24, 2015 2:25 pm

Re: Publishing ads only on article page?

Post by andrei_ro » Tue Mar 24, 2015 2:31 pm

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.

Hy

Can you please help me with the following problem: I want to add a module al all the article pages (but below them, not inside).

What should I pick in the Module's "Menu Assignment"? It doesn't render on "No pages".

Thank you!


Locked

Return to “Templates for Joomla! 1.5”