- This topic has 7 replies, 2 voices, and was last updated 5 years, 1 month ago by Tom.
-
AuthorPosts
-
March 17, 2019 at 5:03 am #841256Hans
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.
March 17, 2019 at 8:30 am #841477TomLead DeveloperLead DeveloperHi 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 🙂
March 17, 2019 at 1:16 pm #841640HansIt 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.
March 17, 2019 at 4:37 pm #841728TomLead DeveloperLead DeveloperHmm, 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?
March 18, 2019 at 11:44 am #842470HansNo, 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.
March 18, 2019 at 5:54 pm #842775TomLead DeveloperLead DeveloperHmm, 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?
March 18, 2019 at 10:40 pm #842873HansYes, 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.
March 19, 2019 at 8:46 am #843483TomLead DeveloperLead DeveloperSounds good.
-
AuthorPosts
- You must be logged in to reply to this topic.