test
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • zekazeka Friend
    #183177

    Hi devs and community.
    For now i have next problems/questions:

    I want to assign page class suffix to body tag ( for me its more flexible) for that i made these modification in default.php file in my template.
    [PHP]<?php
    $menu = JSite::getMenu()->getActive();
    $pageclass = ”;

    if (is_object($menu))
    $pageclass = $menu->params->get(‘pageclass_sfx’);
    ?>[/PHP]

    and get value

    [PHP]<?php echo $pageclass ? htmlspecialchars($pageclass) : ‘default’; ?>[/PHP]

    Code work perfectyly, but in template manager i get this error :

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

    also i was trying to transfer it to “blocks” level, but got the same error.

    So first question: how can i achieve what i want?

    Next question:
    [PHP]<html lang=”ru”>[/PHP]

    How can i dynamicly change language tag if i cant run custom php code in template file?

    Next question:
    How can i override libraries/joomla/document/html/renderer/message.php. through jat3v3?

    Many tnx for your work!

    griiettner Friend
    #476542

    Hello,

    The answer for your first question can be found here

    http://www.joomlart.com/forums/topic/change-body-tag-class-if-on-home-page/

    For the second question you can find here
    http://www.joomlart.com/forums/topic/change-dynamically-the-language-code/

    The third question, unfortunately I don’t have answer for it… But I think the best way to get around any library issue, is to create a plugin that would render before the function you want to override…

    Regards…

    zekazeka Friend
    #476824

    Here the solution:
    [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]

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

This topic contains 3 replies, has 2 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