FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
Webdev Globals
Webdev Globals
Débuté par Peter Hite, 27 mai 2016 20:44 - 6 réponses
Connectez-vous…
Peter Hite
#1
Posté le 27 mai 2016 - 20:44
I am new to writing Web apps and am having a hard time getting my head around global variables. I would like to be able to use a couple of global variables to hold states, etc. But every time I submit something to the server (a page refresh, new page, etc.), the project initialization code reinitialized the globals. Is there anyway to set a global and keep it throughout a session, or do I just need to pass those values as parameters to all of my different pages? Thanks
Signaler
0
0
Fabrice Harari
#2
Posté le 27 mai 2016 - 21:17
Hi Peter,
it depends of the type of pages you are using: classic, awp or php
Best regards
Signaler
0
0
Peter Hite
#3
Posté le 27 mai 2016 - 21:31
Currently the project site is configured as Dynamic AWP. I have 5 globals defined in project server initialization. That initialization code seems to be recalled each time a page is refreshed,
Signaler
0
0
Allard
#4
Posté le 27 mai 2016 - 21:55
Hi
If you use dunamic webdev then your globals are useble the way you discribe. If you use AWP you have to pass the global to the page as a param.
In the calling of the page
pagedisplay( thepageyou call, paramglobal)
In the page that is called add a procedure
PROCEDURE mypage( var is string )
Then use var to get the value of you global
regards
Allard
Signaler
0
0
Peter Hite
#5
Posté le 27 mai 2016 - 22:37
Hi,
Thank you Allard. I think I'll pass them as suggested. Hopefully I can use a composite variable to pass them all easily. I changed the project to Dynamic Webdev, put a break in the server init code, and it still calls the reinitialization of the globals. Don't know why - will try above and scratch my head another day on this one.
Signaler
0
0
Peter Holemans
#6
Posté le 28 mai 2016 - 10:31
Hi Peter,
You can declare an AWP context to store your global variables in AWP mode (server side if you want).
Check ConfigureAWPContext() and DeclareAWPContext() in the help for that.
In the project init code you get the previous values again stored by these same commands.
Best regards,
Peter Holemans
Signaler
0
0
Peter Hite
#7
Posté le 31 mai 2016 - 15:00
Hi Peter,
That sounds like the ticket. I'll give it a try - Thanks.
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte