test
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • griiettner Friend
    #183181

    For several aesthetic reasons, there are many designers that try to make the looks of a home page different than the rest of the site and for this we can take advantage of some Joomla ready API’s…

    [PHP]
    <?php
    $menu = $app->getMenu(); //Calling getMenu function from library
    if ($menu->getActive() == $menu->getDefault()) : //If the page you are viewing is home add the following line
    echo ‘<body id=”homepage”>’;
    else: //If not home page add the following line
    echo ‘<body>’;
    endif;
    ?>
    [/PHP]

    You can add this to templatestemplate_nametplsdefault.php or what ever other variation file that will be the home page of your website T3V3 based template

    wnrdesign Friend
    #476551

    Unfortunatly this throws an error in the template management in the most recent version of jat3v3

    The layout cannot be loaded. There might be some errors in the layout file.

    Any updates on this?

    griiettner Friend
    #476562

    What template are you using, because I just did this change to Brisk template and worked…

    wnrdesign Friend
    #476563

    <em>@griiettner 351030 wrote:</em><blockquote>What template are you using, because I just did this change to Brisk template and worked…</blockquote>

    The default t3blank template

    griiettner Friend
    #476564

    Sorry,

    there is something missing on the previous code I pasted before, it should be like

    [PHP]
    <?php
    $app = JFactory::getApplication();
    $menu = $app->getMenu(); //Calling getMenu function from library
    if ($menu->getActive() == $menu->getDefault()) : //If the page you are viewing is home add the following line
    echo ‘<body id=”homepage”>’;
    else: //If not home page add the following line
    echo ‘<body>’;
    endif; ?>
    [/PHP]

    wnrdesign Friend
    #476565

    <em>@griiettner 351033 wrote:</em><blockquote>Sorry,

    there is something missing on the previous code I pasted before, it should be like

    [PHP]
    <?php
    $app = JFactory::getApplication();
    $menu = $app->getMenu(); //Calling getMenu function from library
    if ($menu->getActive() == $menu->getDefault()) : //If the page you are viewing is home add the following line
    echo ‘<body id=”homepage”>’;
    else: //If not home page add the following line
    echo ‘<body>’;
    endif; ?>
    [/PHP]</blockquote>

    This indeed did solve this issue 😉

    zekazeka Friend
    #476627

    Hi and tnx for you tip!

    I need almost the same need, but i want to assign page class sfx to body tag, for that i use code
    [PHP]$menu =& JSite::getMenu();
    $active = $menu->getActive();
    $pageclass_sfx = ”;
    $params = $menu->getParams( $active->id );
    $class = $params->get( ‘pageclass_sfx’ );[/PHP]

    but i get errors in template manager.

    Can you advise something?

    Jeka

    griiettner Friend
    #476689

    I’m not sure what template you are trying, but, I got no error using the same exact code you posted… it worked fine for me on JA_Blank template…

    zekazeka Friend
    #476691

    I also using ja_blank. It work great in frontend, but in backend (in template manager) i got message
    .
    Please, check this in your instalation.


    1. administrator_index_php_optioncom_templatesviewstylelayouteditid19layout
    griiettner Friend
    #476811

    Sorry, I could not replicate the error you are having on the admin area… what I can think now, is, maybe, one of the variables are being used by some other function on the template… try renaming the variables to something different, by adding some sort of suffix…

    zekazeka Friend
    #476823

    <em>@griiettner 351354 wrote:</em><blockquote>Sorry, I could not replicate the error you are having on the admin area… what I can think now, is, maybe, one of the variables are being used by some other function on the template… try renaming the variables to something different, by adding some sort of suffix…</blockquote>

    Thank you for your help!

    Here the code that work for me[PHP]<?php
    $app = JFactory::getApplication();
    $menu = $app->getMenu(); //Calling getMenu function from library
    $active = $menu->getActive();
    $pageclass_sfx = ”;
    $params = $menu->getParams( $active->id );
    $class = $params->get( ‘pageclass_sfx’ );

    if ($menu->getActive() == $menu->getDefault()) : //If the page you are viewing is home add the following line
    echo ‘<body id=”homepage”>’;

    else: //If not home page add the following line
    echo ‘<body id=”‘.$class.'”>’;
    endif; ?>[/PHP]

    griiettner Friend
    #476834

    So… is this working for you now??

    zekazeka Friend
    #476897

    griiettner, yes!

Viewing 13 posts - 1 through 13 (of 13 total)

This topic contains 13 replies, has 3 voices, and was last updated by  zekazeka 12 years ago.

We moved to new unified forum. Please post all new support queries in our New Forum