Different Logo for Mobile Layout

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Wed Mar 13, 2013 3:27 pm
Reply with quote
Report this post
Hey

Is it possible to include a diffrent (smaller) Logo for the mobile layout? When the page is visited on an iPhone the Logo is to big and the button for the menu skips to the next line.

Website: wnsl.biz/columba3

Thanks
User avatar
Junior Boarder

Konrad M
Wed Mar 13, 2013 4:01 pm
Reply with quote
Report this post
Hi,
you can try set 'Logo type' option to image in 'Features section' of template settings. Then upload your image and try add to override.css
Code: Select all
#gkLogo {
width:22%;
}
#gkLogo img {
max-width:100%;
height:auto;
}

This should make your logo responsive. Remember to enable override.css option in template settings.
User avatar

GK User
Wed Mar 13, 2013 4:10 pm
Reply with quote
Report this post
Konrad M wrote:Hi,
you can try set 'Logo type' option to image in 'Features section' of template settings. Then upload your image and try add to override.css
Code: Select all
#gkLogo {
width:22%;
}
#gkLogo img {
max-width:100%;
height:auto;
}

This should make your logo responsive. Remember to enable override.css option in template settings.


I think this is not an option because i have 2 diffrent logo's (white for the header/blue for the menu). When i set the logo type to image i have only 1 logo right?.. Is there another way?

Thanks
User avatar
Junior Boarder

Konrad M
Wed Mar 13, 2013 4:57 pm
Reply with quote
Report this post
Please try go to layouts/blocks/logo.php and find:
Code: Select all
<a href="<?php echo JURI::root(); ?> " id="gkLogo" class="cssLogo"><?php echo $this->API->get('logo_text', ''); ?></a>

and chamge it to:
Code: Select all
<a href="<?php echo JURI::root(); ?> " id="gkLogo" class="cssLogo <?php if($this->browser->get("tablet") == true || $this->browser->get("mobile") == true) echo ' mobileLogo'; ?>"><?php echo $this->API->get('logo_text', ''); ?></a>

Then please add to override.css
Code: Select all
#gkLogo.cssLogo.mobileLogo {
    background: url("../images/mobile_logo.png") top left no-repeat;
    height: 175px;
    width: 198px;
}

and set width and height as same as your logo dimensions. Remember to upload your image to images folder inside template folder and enable override.css option in template settings.
User avatar

GK User
Thu Mar 14, 2013 10:47 am
Reply with quote
Report this post
Konrad M wrote:Please try go to layouts/blocks/logo.php and find:
Code: Select all
<a href="<?php echo JURI::root(); ?> " id="gkLogo" class="cssLogo"><?php echo $this->API->get('logo_text', ''); ?></a>

and chamge it to:
Code: Select all
<a href="<?php echo JURI::root(); ?> " id="gkLogo" class="cssLogo <?php if($this->browser->get("tablet") == true || $this->browser->get("mobile") == true) echo ' mobileLogo'; ?>"><?php echo $this->API->get('logo_text', ''); ?></a>

Then please add to override.css
Code: Select all
#gkLogo.cssLogo.mobileLogo {
    background: url("../images/mobile_logo.png") top left no-repeat;
    height: 175px;
    width: 198px;
}

and set width and height as same as your logo dimensions. Remember to upload your image to images folder inside template folder and enable override.css option in template settings.


Thanks! I will try this at the weekend.
User avatar
Junior Boarder

GK User
Wed Mar 27, 2013 9:20 pm
Reply with quote
Report this post
Konrad M wrote:Please try go to layouts/blocks/logo.php and find:
Code: Select all
<a href="<?php echo JURI::root(); ?> " id="gkLogo" class="cssLogo"><?php echo $this->API->get('logo_text', ''); ?></a>

and chamge it to:
Code: Select all
<a href="<?php echo JURI::root(); ?> " id="gkLogo" class="cssLogo <?php if($this->browser->get("tablet") == true || $this->browser->get("mobile") == true) echo ' mobileLogo'; ?>"><?php echo $this->API->get('logo_text', ''); ?></a>

Then please add to override.css
Code: Select all
#gkLogo.cssLogo.mobileLogo {
    background: url("../images/mobile_logo.png") top left no-repeat;
    height: 175px;
    width: 198px;
}

and set width and height as same as your logo dimensions. Remember to upload your image to images folder inside template folder and enable override.css option in template settings.


Hey i just had the time to try it and it doesn't work.. When i replace the code in the logo.php file the page doesn't load up anymore.

Any ideas?

Thanks
User avatar
Junior Boarder

GK User
Wed Mar 27, 2013 9:26 pm
Reply with quote
Report this post
addition: there is no error or message showing.. the webbrowser simply stays white.
User avatar
Junior Boarder

Konrad M
Fri Apr 05, 2013 7:03 pm
Reply with quote
Report this post
Please try set 'display_errors' option to on in your php.ini file and let me know if you have some errors.
User avatar

GK User
Thu Aug 08, 2013 4:05 am
Reply with quote
Report this post
I had the same issue where I needed a second logo for the menu, in the end it was easier to add in a altlogo which I printed out in place of the small logo.

Take a copy of the /gk_simplicity/layouts/blocks/logo.php file, call the file altlogo.php, edit the /gk_simplicity/layouts/blocks/altlogo.php file you just created and add alt before logo, you'll end up with this;

Code: Select all
<?php

// No direct access.
defined('_JEXEC') or die;
$altlogo_image = $this->API->get('altlogo_image', '');

if(($altlogo_image == '') || ($this->API->get('logo_type', '') == 'css')) {
     $altlogo_image = $this->API->URLtemplate() . '/images/altlogo.png';
} else {
     $altlogo_image = $this->API->URLbase() . $altlogo_image;
}

$altlogo_text = $this->API->get('altlogo_text', '');
$altlogo_slogan = $this->API->get('altlogo_slogan', '');

?>

<?php if ($this->API->get('altlogo_type', 'image')!=='none'): ?>
     <?php if($this->API->get('altlogo_type', 'image') == 'css') : ?>
     <a href="<?php echo JURI::root(); ?>" id="gkLogo" class="cssLogo"><?php echo $this->API->get('altlogo_text', ''); ?></a>
     <?php elseif($this->API->get('altlogo_type', 'image')=='text') : ?>
     <a href="<?php echo JURI::root(); ?>" id="gkLogo" class="text">
      <span><?php echo $this->API->get('altlogo_text', ''); ?></span>
        <small class="gkLogoSlogan"><?php echo $this->API->get('altlogo_slogan', ''); ?></small>
     </a>
     <?php elseif($this->API->get('altlogo_type', 'image')=='image') : ?>
     <a href="<?php echo JURI::root(); ?>" id="gkLogo">
        <img src="<?php echo $altlogo_image; ?>" alt="<?php echo $this->API->getPageName(); ?>" />
     </a>
     <?php endif; ?>
<?php endif; ?>


Then edit the /gk_simplicity/templateDetails.xml file and find the line containing;

Code: Select all
<field name="logo_slogan" type="text" default="" label="TPL_GK_LANG_LOGO_SLOGAN" description="TPL_GK_LANG_LOGO_SLOGAN_DESC" />


Add this after it so that you can add;

Code: Select all
            <field name="altlogo_type" type="list" default="image" label="TPL_GK_LANG_LOGO_TYPE" description="TPL_GK_LANG_LOGO_TYPE_DESC">
                                        <option value="image">TPL_GK_LANG_LOGO_TYPE_IMAGE</option>
                                        <option value="text">TPL_GK_LANG_LOGO_TYPE_TEXT</option>
                                        <option value="css">TPL_GK_LANG_LOGO_TYPE_CSS</option>
                                        <option value="none">TPL_GK_LANG_LOGO_TYPE_NONE</option>
                                </field>
                                <field name="altlogo_image" type="media" default="" label="TPL_GK_LANG_LOGO_IMAGE" description="TPL_GK_LANG_LOGO_IMAGE_DESC" />
                                <field name="altlogo_text" type="text" default="" label="TPL_GK_LANG_LOGO_TEXT" description="TPL_GK_LANG_LOGO_TEXT_DESC" />
                                <field name="altlogo_slogan" type="text" default="" label="TPL_GK_LANG_LOGO_SLOGAN" description="TPL_GK_LANG_LOGO_SLOGAN_DESC" />


That will allow you to specify an alternate logo in the administration section, just below the logo details, to make it neater you can add in different labels.

Then adjust your /gk_simplicity/layouts/default.php and replace;

Code: Select all
<?php $this->layout->loadBlock('logo'); ?>


With

Code: Select all
<?php $this->layout->loadBlock('altlogo'); ?>


Anywhere in the template where you want to print out your alternate logo in place of your primary logo.

I had to do this as my header image was black whereas my menu was white, inverted logo colours (black with transparency rather than white with transparency) was needed in the altlogo area so that the logo appeared in the menu.
User avatar
Fresh Boarder

GK User
Tue Jan 14, 2014 11:14 pm
Reply with quote
Report this post
I just made the css change:

#gkLogo {
width:22%;
}
#gkLogo img {
max-width:100%;
height:auto;
}

and it worked perfect... thxs much
User avatar
Fresh Boarder


cron