template if statement depending on which component is current.

For Joomla! 1.0 Coding related discussions.
User avatar
mojito
Joomla! Guru
Joomla! Guru
Posts: 630
Joined: Wed Sep 07, 2005 10:18 pm
Location: London
Contact:

template if statement depending on which component is current.

Postby mojito » Sun Apr 08, 2007 7:01 pm

???
Can I work out what component is currently displayed in my template as I want to use an if statement to show more of my component and hide some modules if the custom component is showing.. I suppose I could read the url string, but this seems a little clunky to me requiring some string functions etc, and im sure there is a variable available which denotes which component.
Check out the 'bad toilet' online !

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4785
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: template if statement depending on which component is current.

Postby ianmac » Sun Apr 08, 2007 7:57 pm

This is easy.  The current component is stored in the $option variable.

So...

Code: Select all

if ($option == 'com_mycomponent') {
...

}


Ian

User avatar
mojito
Joomla! Guru
Joomla! Guru
Posts: 630
Joined: Wed Sep 07, 2005 10:18 pm
Location: London
Contact:

Re: template if statement depending on which component is current.

Postby mojito » Mon Apr 09, 2007 11:01 am

Thanks that did it.

SOLVED
Check out the 'bad toilet' online !

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 21266
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, The Netherlands
Contact:

Re: template if statement depending on which component is current.

Postby pe7er » Tue Apr 10, 2007 7:59 am

Thanks for marking your question as solved!

Could you please mark your first message in this thread as "solved" instead?
(Modify the first message and choose the Message Icon [solved] Image).
This way the list of messages shows that the question has been solved, and other users can benefit from it.
Kind Regards,
Peter Martin, Global Moderator
http://www.db8.nl - Joomla specialist, Nijmegen, Nederland
Latest website: https://pronounce.eu/

skovmand
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Thu Nov 19, 2009 7:05 pm

Re: template if statement depending on which component is cu

Postby skovmand » Mon Dec 06, 2010 11:33 pm

ianmac wrote:This is easy.  The current component is stored in the $option variable.

So...

Code: Select all

if ($option == 'com_mycomponent') {
...

}


Ian


Thank you :) Just what I was looking for


Return to “Joomla! 1.0 Coding”

Who is online

Users browsing this forum: No registered users and 2 guests