Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • dkaneloglou Friend
    #940574

    I also tried these steps
    https://docs.joomla.org/Using_the_Page_Class_Suffix_in_Template_Code

    with this code in the default-content-left.php and default.php
    <?php
    $menus = &JSite::getMenu();
    $menu = $menus->getActive();
    $pageclass = "";

    if (is_object( $menu )) :
    $params = new JParameter( $menu->params );
    $pageclass = $params->get( ‘pageclass_sfx’ );
    endif;
    ?>

    and
    <body id="<?php echo $pageclass ? htmlspecialchars($pageclass) : ‘default’; ?>">

    but I get error
    Fatal error: Class ‘JParameter’ not found …

    Saguaros Moderator
    #940723

    Hi

    You can try with this:

    <body class='<jdoc:include type="pageclass" />'>
    dkaneloglou Friend
    #941094

    I have the page class "home" at the home page, but with this code
    <body class='<jdoc:include type="pageclass" />’>
    I get:
    <body class=’com_content view-article itemid-1350 j35 mm-hover’>
    instead of
    <body class=’home’>
    Any other solution?

    Saguaros Moderator
    #941426

    Try this way:

    • Add this code in DOCTYPE

      $app = JFactory::getApplication();
      $menu = $app->getMenu()->getActive();
      $pageclass = '';
      
      if (is_object($menu))
      $pageclass = $menu->params->get('pageclass_sfx');
    • Change the body tag like this:
      <body id="<?php echo $pageclass ? htmlspecialchars($pageclass) : 'default'; ?>">

    I attach the file here so you can compare


    dkaneloglou Friend
    #941504

    Works Perfect!
    Thank you

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

This topic contains 5 replies, has 2 voices, and was last updated by  dkaneloglou 8 years, 5 months ago.

The topic ‘page class, default.php, menu in columns, span class’ is closed to new replies.