Jump to content

image disappears on homepage


benbyf
 Share

Recommended Posts

On your homepage you have

style="background-image:url(/site/assets/files/1/)"

instead of

style="background-image:url(/site/assets/files/1/logo.svg)"

which seems to explain the issue... ;)

  • Like 1
Link to comment
Share on other sites

Thanks, not sure theres anything going on much in the templates. The file is being uploaded into the "file" field on the homepage. It seems to work fine on Firefox but anything else I can the url without file name and extension.

Link to comment
Share on other sites

Strange: I'm in Firefox. The Web Developer Tool says the image could not be loaded - likewise in both cases,

be it /site/assets/files/1/ or /site/assets/files/1/logo.svg ! (Even if in the second case it is shown on the page...)

  • Like 1
Link to comment
Share on other sites

Here is what I see in Chrome and Firefox.  As @ottogal says, it shows the error on the home page.

Chrome (Main Page)

post-756-0-33552800-1464274597_thumb.png

Chrome (Any page other than Home)

post-756-0-37132700-1464274659_thumb.png

Firefox (Main Page - Note the Security Warning)

post-756-0-65043400-1464274671_thumb.png

Firefox (Main Page)

post-756-0-28495200-1464274684_thumb.png

  • Like 1
Link to comment
Share on other sites

If your image site_logo is set to multiple files, your code will output the url to the assets folder of the page

"/site/assets/files/1/"

If your image site_logo ist set to allow only 1 file, your code will output

"/site/assets/files/1/logo.svg"

If the outputformatting for the page is off, both cases will output

"/site/assets/files/1/"

So my guess is that on your homepage, somehow output formatting is turned off?

  • Like 3
Link to comment
Share on other sites

this seemed to fixed it, as the field was already set to single item.

$page->of(true);
$logo = $homepage->site_logo;
$page->of(false);

any reason for this, not really needed to use outputformating() before

Link to comment
Share on other sites

The reason you would have to look for is why the homepage has output formatting turned off, because it's not usual at all. Output formatting is always turned on in front-end templates. 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...