NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: terryd on September 01, 2015, 01:08:00 AM

Title: Advice Display changing Background Images
Post by: terryd on September 01, 2015, 01:08:00 AM
In one of my apps in the IndexPage XHTML I have a routine with the XHTML in capture1.jpg
The contents of BodyContent.txt are very simple. It displays a background image when I'm logged out or when the user is logged in but a procedure isn't open.
What I would like to do is to have (let's say) 10 images in a folder
I can store the location and names in a sequentially numbered table.
Every time a new session is started I would like to access the name of the next image in the table and display that image as the background, at the same time marking the record as the last image accessed. When the next user logs in I could check the table access the next record, display the image as background, hopefully ad infinitum. At the end of the table go back to no 1
My question:
Is it possible to do this within the XHTML or am I looking at javascript?
At the moment this is just an experiment to see how far I can go but it would definitely be a plus in one of my mobile apps.
Any suggestions, pointers etc. would be appreciated.

[attachment deleted by admin]
Title: Re: Advice Display changing Background Images
Post by: Bruce on September 01, 2015, 03:07:11 AM
perhaps use a session value for the image "src" in the bodycontent.txt file?

<img src="<!-- Net:s:backgroundImage -->">

Haven't tried it though...

Cheers
Bruce

Title: Re: Advice Display changing Background Images
Post by: terryd on September 01, 2015, 10:00:51 AM
Thanks Bruce. I'll give it a whirl
Title: Re: Advice Display changing Background Images
Post by: terryd on September 02, 2015, 02:06:21 AM
Hi Bruce
That works perfectly.
For anyone else who is interested in the principle.
In the IndexPage I created a LocalData BackgroundImage S(100)
In the body Routine
I have a DO GetImageToDisplay
In the routine
I have a table and basically loop through the records using my specific logic for selecting the record image that I want to display
At the end of the Routine
I set BackgroundImage to the loaded image location
and p_web.SSV('BackgroundImage',BackgroundImage)
In the XHTML Page I have
<!-- Net:PageHeaderTag -->
<!-- Net:f:client/BodyContent.txt -->
<!-- Net:PageFooterTag -->

In the BodyContent.txt file I have
<div class ="nt-center-justify">
   <img  src="<!-- Net:s:BackgroundImage -->" />
</div>

Now when I access the website I get an image displayed as background. If I go into a procedure and close the procedure I get another image whenever i loop at another procedure looping through my table until I reach the end then resetting to the first record again.

The reason I am doing it is that one of my app will have advertising content. So the advertisers image will be one of the above rotating images.
I increment the number of times each image is displayed in the table so that I can report back to the advertiser that their advert was viewed x number of times over the life of the site.
The expectation of the website is that += 1000 people will access it at least 50 times over a 2 month period accessing on average 4 procedures per login so each advert is  expected to be viewed about 200 000 times divided by the number of adverts in the table.