3

Due to lack of php knowledge i cant find where i am mistaken and how it`s better to do this. I have several languages one of them LTR and the other RTL and i need sidebars to be displayed vice-versa. It means that in LTR menu would be in the first and in the RTL it would be in the second sidebar. The code returns '1' somehow and breaks the markup. Please help me to modify this code:

global $language;
switch ($language->language) {
case "en":
if ($page["sidebar_first"]):
print "<aside id='sidebar-first' role='complementary' class='sidebar clearfix'>".print render($page['sidebar_first'])."</aside>"; 
endif;
if ($page["sidebar_second"]):
print "<aside id='sidebar-second' role='complementary' class='sidebar clearfix'>".print render($page['sidebar_second'])."</aside>"; 
endif;      
break;
case "ar":
if ($page["sidebar_second"]):
print "<aside id='sidebar-first' role='complementary' class='sidebar clearfix'>".print render($page['sidebar_second'])."</aside>"; 
endif;  
if ($page["sidebar_first"]):
print "<aside id='sidebar-second' role='complementary' class='sidebar clearfix'>".print render($page['sidebar_first'])."</aside>"; 
endif;
break;
}

markup breaks

1

You missed the position of the string operator . You can try the code mentioned below.

    global $language;
    switch ($language->language) {
    case "en":
    if ($page["sidebar_first"]):
    print "<aside id='sidebar-first' role='complementary' class='sidebar clearfix'>".print render($page['sidebar_first'])."</aside>"; 
    endif;
    if ($page["sidebar_second"]):
    print "<aside id='sidebar-second' role='complementary' class='sidebar clearfix'>".print render($page['sidebar_second'])."</aside>"; 
    endif;      
    break;
    case "ar":
    if ($page["sidebar_second"]):
    print "<aside id='sidebar-first' role='complementary' class='sidebar clearfix'>".print render($page['sidebar_second'])."</aside>"; 
    endif;  
    if ($page["sidebar_first"]):
    print "<aside id='sidebar-second' role='complementary' class='sidebar clearfix'>".print render($page['sidebar_first'])."</aside>"; 
    endif;
    break;
    }
  • Thanks for the quick answer! The code validates now but there are several problems - i`ve attached an image to the question which may describe more then words can say. The markup breaks somehow and returns '1' also. – Rootical V. May 14 '12 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.