0
Welcome Guest! Login
0 items Join Now

ROCKETTHEME IS CLOSING ON JUNE 30, 2025. As a thank-you to our community, enjoy 50% off all themes with the promo code THANKYOU before we shut down. Read our Farewell Blog Post for more details.

Hide text only in front page

    • Hernan's Avatar
    • Hernan
    • Sr. Rocketeer
    • Posts: 147
    • Thanks: 0
    • Student.

    Hide text only in front page

    Posted 15 years 4 months ago
    • Hi!

      I've been searching over the whole internet and I cannot find a php code that allows me to hide/display some text only from the frontpage on a Joomla! site.

      The idea is to have a code like this:

      <?php if is joomla homepage

      Show or hide this

      ?>

      I've found a lot for Wordpress, but nothing that really works in Joomla!.

      Thanks in advance.

      Hernán.

      PD: I'm using Sourcerer ( http://www.nonumber.nl/extensions/sourcerer ) to insert PHP code in an article
  • Re: Hide text only in front page

    Posted 15 years 4 months ago
    • You can try this:
      <?php if (JRequest::getVar('view') == 'frontpage'): ?>
      // show something on frontpage
      <?php endif; ?>
    • Hernan's Avatar
    • Hernan
    • Sr. Rocketeer
    • Posts: 147
    • Thanks: 0
    • Student.

    Re: Hide text only in front page

    Posted 15 years 4 months ago
    • Hi!..thanks for your answer :D

      The code doesn't work, the text is hidden in both, the frontpage and the article view. As well as when I list it as a blog.

      Other idea??

      Thanks.
  • Re: Hide text only in front page

    Posted 15 years 4 months ago
    • To hide it on frontpage, you can reverse it, so it will be like:
      <?php if  (JRequest::getVar('view') != 'frontpage'): ?>
      // something that will not show on frontpage here
      <?php endif; ?>
    • Hernan's Avatar
    • Hernan
    • Sr. Rocketeer
    • Posts: 147
    • Thanks: 0
    • Student.

    Re: Hide text only in front page

    Posted 15 years 4 months ago
    • Yeah..I know that if I add the ! I do not show it, but the problem is that using the first one, the text dissapers from everywhere. It doesn't show up anymore.


      Do you know another code to accomplish the same, or what could be the problem?

      Thanks.
  • Re: Hide text only in front page

    Posted 15 years 4 months ago
    • I usually only use that and it always works for me. May I know what code or text you want to hide in the frontpage only? You may try another option by Itemid too.
      <?php if   (JRequest::getVar('Itemid') != 1): ?>
      // something that will not show on the menu with Itemid 1
      <?php endif; ?>
    • Hernan's Avatar
    • Hernan
    • Sr. Rocketeer
    • Posts: 147
    • Thanks: 0
    • Student.

    Re: Hide text only in front page

    Posted 15 years 4 months ago
    • This is the code as I'm using it now. The {source} tag is the plugin parameter {sourcerer}
      {source}
      <?php if (JRequest::getVar('view') == 'frontpage'); ?>
      <p style="text-align: left;"><span style="font-size: 22px;"><strong><a href="http://www.perrerac.org/radio-online">Escuchar Radio Online</a></strong></span></p>
      <p style="text-align: left;">&nbsp;</p>
      <?php endif; ?>
       
      {/source}
  • Re: Hide text only in front page

    Posted 15 years 4 months ago
    • I never try that plugin before. Does that plugin will work with that php code?
      How about trying to put that directly in the template index.php file?

Time to create page: 0.069 seconds