[Resolved] Background image is depending on page content

Home Forums Support [Resolved] Background image is depending on page content

Home Forums Support Background image is depending on page content

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #841256
    Hans

    All information to show on a specific page is available in datatables and can be shwon via a PHP program – except the background image which is defined in the header. Is there a way to push away the obstacle.

    A location.reload or a location.replace might be a solution but I don’t see a possibliliy to generate an event without intervention of the user. I thougt the body onload() might be a solution but how to implement this in GP? Do you have another idea which is probably more conviniant or is it simply not possible. I saw a program which used some technique but it was not based on WP.

    GeneratePress 2.2.2
    #841477
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I’m not sure I fully understand.

    Are you trying to change the body background image? If so, what conditions are you wanting to use? If the page has specific words? Or if it’s using a custom field?

    Let me know 🙂

    #841640
    Hans

    It is somehow tricky. I use Elements making rotating backgrounds and it works very well. On some static pages I use an individuell background what is easy.

    But there are also pages where users enter information where I need a specific background, But the data is not yet available when the header is generated and I do not want an interaction off the user e.g.submit. Thus I made an experiment to use the event of an iframe in combination with $_SESSION variables and location.reload(). It works in most cases but it takes to long time to build up the backround. This is not efficient. Also trials with ajax did not succeed as this come too late also.

    I need a solution to automatcally generate an event which can be used to trigger the reload or a location.replace() which can build the img clause in the header. The idea with the body onload was to generate the event early as possible and read the needed variable with getElementByID.

    I know this is complicated but as a not so experienced developer this could be a way to come to an solution.

    #841728
    Tom
    Lead Developer
    Lead Developer

    Hmm, I’m not sure I have a solution for you, unfortunately.

    How is the image generated? Could it be added as a query string to the URL on submit?

    #842470
    Hans

    No, unfortunately the variable is calculated after the submit. With #page I can display the image, but it’s not very nice as all other pages have a full size image background. Sometimes the systems looses a trigger besause of asynchronity.

    I very desperate but I do not see a solution without a second submit which I really want to avoid.

    #842775
    Tom
    Lead Developer
    Lead Developer

    Hmm, so the URL you want to use as a background is generated once the user hits submit, and you need it to remember that URL once the page reloads.

    Have you thought about using AJAX for the submit so there’s no reload?

    #842873
    Hans

    Yes, I think a combination of Js (keyboard control, submit) and AJAX could resolve the problem. I start working on that way.

    Thanks for your advices. Probably I come back later.

    #843483
    Tom
    Lead Developer
    Lead Developer
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.