template if statement depending on which component is current.

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

template if statement depending on which component is current.

Post by 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.
I am a freelance SEO (https://cambs.eu) web designer and developer working with Wordpress and Joomla since Mambo.

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

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

Post by 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: 755
Joined: Wed Sep 07, 2005 10:18 pm
Location: London
Contact:

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

Post by mojito » Mon Apr 09, 2007 11:01 am

Thanks that did it.

SOLVED
I am a freelance SEO (https://cambs.eu) web designer and developer working with Wordpress and Joomla since Mambo.

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

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

Post by 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
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

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

Post by 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


Locked

Return to “Joomla! 1.0 Coding”