lordrt Posted August 18, 2009 Share Posted August 18, 2009 Hello all Am trying to modify a php template for my website, which has multilanguage support. I in fact have to use 2 logos, one for each language french and german, and am using drupal to create the site. the following code is taken from a file called page.tpl.php <div id="logo-floater"> <h1> <a href="<?php print check_url($front_page); ?>"> <?php if ($logo): ?> <img src="<?php print check_url($logo); ?>" title="<?php print check_plain($site_name) . check_plain($site_slogan); ?>" alt="<?php print check_plain($site_name) . check_plain($site_slogan); ?>" id="logo" /> <?php endif; ?> can anyone pls explain me this part of code, what it is doing really? Quote Link to comment Share on other sites More sharing options...
minidak03 Posted August 18, 2009 Share Posted August 18, 2009 The check_url function just takes the URL and makes sure its safe to use, and the check_plain function is just used to encode special characters, so it changes the & symbol to & The if($logo) part is just there to determine if the script has a URL to a particular logo. If your trying to display logo 1 for the first language and logo 2 for a second language try the following <div id="logo-floater"> <?php if($language->name == "Dutch") { $logo = 'location_of_dutch_logo'; } elseif($language->name == "English") { $logo = 'location_of_english_logo'; } ?> <h1> <a href="<?php print check_url($front_page); ?>"> <?php if ($logo): ?> <img src="<?php print check_url($logo); ?>" title="<?php print check_plain($site_name) . check_plain($site_slogan); ?>" alt="<?php print check_plain($site_name) . check_plain($site_slogan); ?>" id="logo" /> <?php endif; ?> In this code you have to know the value of the $language->name variable but you can also change out the $language->name == "English" part with $language->language == 'en' which would be might be more stable and easier to use Quote Link to comment Share on other sites More sharing options...
lordrt Posted August 18, 2009 Author Share Posted August 18, 2009 thank u minidak03 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.