Background Image changes back to default

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
Mon Nov 05, 2012 7:41 am
Reply with quote
Report this post
Trying the Game News template for both Joomla 2.5 and 3.0, I've noticed that the background image, when selected from the style changer does not remain as chosen if you browse through the pages, it always changes back to the default background. Using Joomla 3 the colour changer as well as the background change back to default when browsing through the pages.
Now I'm not sure if this is intentional but it seems a bit pointless if it is. I have used the Sporter template before and that style remains as long as you're browsing the site and I guess as long as your cookies remain intact.

I thought it was my setup but this happens on your own demo site so I'm thinking that it's a bug perhaps.

Please could someone let me know how to fix this or whether this is supposed to function this way?
User avatar
Fresh Boarder

GK User
Mon Nov 05, 2012 8:40 am
Reply with quote
Report this post
The issue is the same when you choose one style from backend and disable style switcher ? Are you sure that your browser accept cookies ? I'm asking because information about selected style is stored in cookie file.
User avatar
Platinum Boarder

GK User
Mon Nov 05, 2012 1:26 pm
Reply with quote
Report this post
HI
Thanks for the reply.

No when I disable the style switcher the style remains as the default one I've chosen, it does not change.
My browser is accepting cookies or I wouldn't be able to login here ;)
I also used Chrome, Firefox and IE9 all set to accept cookies.

When you browse to the demo do you not get what I'm getting?

This is not specific to my Game News Installations as its also happening on the Gavick Demo page:
http://demo.gavick.com/index.php?month=Aug&year=2012
The two installations I tried here are on joomla 3:
http://www.netlive.co.za/ - this is my live site - just installed joomla and the template (no Quick install)
http://joomlastuff.za.net/ - this is where I setup a test site using the quick install. Here I've defaulted the colour to option 2 and the background to background 3 and it always defaults to the default background.
This is a test installtion of the Game News on Joomla 2.5:
http://foozle.za.net/newsite2/ - setup using the quick install file too

The test sites are setup as default so no fancy changes.
What I did was to choose background 3 for example then just choose any page off the menu, the background changes back to background 1 (obviously the default)

Like I said previously sporter works perfectly....
Thanks
Hurri
User avatar
Fresh Boarder

GK User
Tue Nov 06, 2012 9:53 am
Reply with quote
Report this post
You are right. Please make this changes and this should resolve problem :

In file lib/framework/helper.layout.php replace function getTemplateStyle with this code :

Code: Select all
public function getTemplateStyle($type) {
      if($type == 'style') {
         $template_style = $this->API->get("template_color", 1);
      } else {
         $template_style = $this->API->get("template_bg", 1);
      }
      
      if($this->API->get("stylearea", 1)) {
         if(isset($_COOKIE['gk_'.$this->parent->name.'_'.$type])) {
            $template_style = $_COOKIE['gk_'.$this->parent->name.'_'.$type];
         } else {
            if($type == 'style') {
               $template_style = $this->API->get("template_color", 1);
            } else {
               $template_style = $this->API->get("template_bg", 1);
            }
         }
      }
      return $template_style;
   }



then open file layout/default.php and add this line :

Code: Select all
$template_bg = $this->layout->getTemplateStyle('bg');


below this code :

Code: Select all
$tpl_page_suffix = $this->page_suffix != '' ? ' class="'.$this->page_suffix.'"' : '';


Few lines later you will find the body tag replace it with :

Code: Select all
<body<?php echo $tpl_page_suffix; ?><?php if($this->browser->get("tablet") == true) echo ' data-tablet="true"'; ?><?php if($this->browser->get("mobile") == true) echo ' data-mobile="true"'; ?><?php $this->layout->generateLayoutWidths(); ?> data-bg="<?php echo $template_bg ?>">


and last but least is js/gk.script.js and replace function :

Code: Select all
function changeBg(bg){
   document.body.setAttribute('data-bg', bg);

   Cookie.write('gk_creative_j25_bg', bg, { duration:365, path: '/' });
}


with :

Code: Select all
// Function to change backgrounds
function changeBg(bg){
   document.body.setAttribute('data-bg', bg);

   
User avatar
Platinum Boarder

GK User
Tue Nov 06, 2012 2:41 pm
Reply with quote
Report this post
Hi Thanks for getting back to me...

I have made the changes to both these sites:

http://netlive.co.za/ - Joomla! 3.0.1 Stable site
http://foozle.za.net/newsite2/ - Joomla 2.5.7 site

But even after deleting browser cache & joomla's cache it still the same issues.

I double checked the location of the files you mentioned to make sure I did not make an error but I found the lines of code you mentioned easily so I would think that I have made the changes correctly.

Anything else I could try?
Thanks
Hurri
User avatar
Fresh Boarder

GK User
Wed Nov 07, 2012 10:24 am
Reply with quote
Report this post
Please provide me ftp details via PM and please include link to forum topic.
User avatar
Platinum Boarder

GK User
Wed Nov 07, 2012 12:05 pm
Reply with quote
Report this post
Hi

I have PM'd you however the message still shows as sitting in my "outbox".
I have no idea as to how to "send" the message...
I guess I just need to wait?

Thanks
Hurri
User avatar
Fresh Boarder

GK User
Thu Nov 08, 2012 8:41 am
Reply with quote
Report this post
I've checked my inbox and see message from - I'll let you know as soon as I resolve your problem.
User avatar
Platinum Boarder


cron