Keyword

website background images disappear on K2 item

  • Chris Good
  • Chris Good's Avatar Topic Author
  • Offline
  • New Member
More
7 years 2 months ago #162662 by Chris Good
Hi there,

I have only had this problem since Joomla 3.7 update, but I have found that it's only occurring on K2 item pages, and no one seems to be able to help.

I have made a template which has some images set from template parameters, which are used as background images for sections of the website and the website background in general. In template parameters, these are simple image media selectors. I use a style declaration at the top of my template to assign these images as the background images of various section classes. This has always worked fine and still does, unless I'm on a K2 item.

You can see examples here. There is a parallax section near the bottom of the page. On the first, it works and displays the background image. On the second (which is a K2 item, it doesn't.

www.iamchris.co.uk/demo/quickstarts/Helix/LockeandQuay/ . (Shows the horribly colourful background image)
www.iamchris.co.uk/demo/quickstarts/Helix/LockeandQuay/services/financial-planning . (Doesn't work as it's a K2 item)

On the K2 item, the console shows the image is '404'.

I can only think that K2 has added to the URL and so the link to the image doesn't work correctly, but this doesn't happen elsewhere, and only messes up background images. The logo in the top left is also assigned from template parameters, but is not a background one. Also, background images work on category pages, just not on item pages.

Anyone's help would really be appreciated. This has happened on a number of my websites, with different templates. I need to use K2 for these, it's my favourite CCK, but this only happens with K2. I don't know where I've gone wrong...but, this didn't happen before 3.7 update. :(

Thanks

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 months ago #162667 by Krikor Boghossian
Replied by Krikor Boghossian on topic website background images disappear on K2 item
Hello,

This is a template issue. You need to address this issue to the template's developer.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Chris Good
  • Chris Good's Avatar Topic Author
  • Offline
  • New Member
More
7 years 2 months ago #162670 by Chris Good
Replied by Chris Good on topic website background images disappear on K2 item
Thanks. Yes, erm...that's me. Do you have any idea where I've gone wrong with it, please?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 months ago #162681 by Krikor Boghossian
Replied by Krikor Boghossian on topic website background images disappear on K2 item
Then, kudos for creating your own template :)
The url of the image produces a 404 error jmp.sh/to0D4WC

Try ..url(/images.. instead of url(images...

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Chris Good
  • Chris Good's Avatar Topic Author
  • Offline
  • New Member
More
7 years 2 months ago #162767 by Chris Good
Replied by Chris Good on topic website background images disappear on K2 item
Ah, well, thank you, I'd happily accept the kudos if it worked.

Thank you for the suggestion, but I'm at a loss about how to implement as the template is designed so that end users can simply upload the background images in template parameters. It all worked fine before Joomla 3.7, but -and this is the reason I've come to JoomlaWorks) now it only fails to work on K2 items...I've ruled out every other issue, it's only on K2 items where ALL background images experience a URL problem.

Is it because the k2 item view is smacking something else in the URL path?

In template parameters, I have this:
<field name="parallaxonebackground" type="media" label="Parallax One Background" directory="/Parallax/Parallax-One" />

in the top of my template index.php I have this style declaration:

if ($this->params->get('parallaxonebackground'))
{

$doc->addStyleDeclaration("
.Parallax-One-Background

{background-image: url(" . $this->params->get('parallaxonebackground') . ");
}");

}


It all works fine, apart from with K2 Items...so I'm hoping someone more familiar with K2 can help me troubleshoot, as there's something going on there.

Krikor, I tried what you mentioned about /images instead of just images, but with the way I'm doing things, I couldn't see how to tackle that part?

Any help or ideas would be much appreciated.

Please Log in or Create an account to join the conversation.

  • Chris Good
  • Chris Good's Avatar Topic Author
  • Offline
  • New Member
More
7 years 2 months ago #162769 by Chris Good
Replied by Chris Good on topic website background images disappear on K2 item
The difference between the image url that works and the one that shows the 404 is that the one showing the 404 (when on a K2 item page) is inserting the k2 category menu item alias in, before the first /images/...so, it is looking in the wrong place as it has an incorrect path? If this could be the problem, what is the fix for this...and why does it only happen on K2 item? Or am I on a completely wrong track?

One that works - taken from Google Inspect Console.
div.Parallax-Two-Background {
background-image: url(images/ServicesImages/startup.jpg);

One that doesn't work - taken from Google Inspect Console.

GET www.iamchris.co.uk/demo/quickstarts/Helix/LockeandQuay/services/images/ServicesImages/startup.jpg


Any wisdom or suggestions, anyone, please? I'm desperate to sort this.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 months ago #162771 by Krikor Boghossian
Replied by Krikor Boghossian on topic website background images disappear on K2 item
You are actually on the wrong track.
You need to use absolute paths (for that folder) not relative ones since when you are outside the homepage that CSS syntax will make the browser look for image in a folder relative to the current URL.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Chris Good
  • Chris Good's Avatar Topic Author
  • Offline
  • New Member
More
7 years 2 months ago #162783 by Chris Good
Replied by Chris Good on topic website background images disappear on K2 item
Awww, dammit...but thank you so much for your time.

I still don't understand why this set up worked before Joomla 3.7, but the point is that it doesn't work now...and what you've said makes sense, so I"ll have to abandon that ol' template styles method and go absolute, I guess. Perhaps I'll make a parallax module, as that would offer more freedom to the user and not have those issues.

Thank you for your time, you've been very helpful, as always!

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 months ago #162809 by Krikor Boghossian
Replied by Krikor Boghossian on topic website background images disappear on K2 item
Thank you Chris :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum