110 likes | 233 Views
This session introduces the concepts of libraries, sessions, and cookies in RevServer. Participants will learn about the importance of libraries in code organization and reuse, enabling developers to utilize existing code efficiently. The discussion will cover how to create and load libraries, alongside the role of cookies for user data storage and session management. Demonstrations will provide practical applications of these concepts, with further resources for exploration. This talk is aimed at enhancing your web development skills.
E N D
Talk aims: Introduce concept of libraries, sessions & cookies Demonstrate applications and uses Implement using revServer Provide items for further investigation Libraries, Sessions & Cookies
In computer science, a library is a collection of related subroutines that provide functionality aiding the development of software. In Rev, this can be seen as a collection of handlers that are made available to relevant parts of your stack. What is a Library?
Abstraction! Code organization Code reuse Use other developers code You only need to know what a library does, not how it does it. Why Use Libraries?
Loading a library: include "my_library.irev" Path relative to current script Handlers in library now in message path Creating a library Like a normal revServer script Omit closing “?>” tag Libraries in revServer
Textual data stored on users machine Part of HTTP Accessed via name Limited to a URL Active for a set period Implemented differently in each browser What is a Cookie?
Remembering a user Storing user data Passing data between web pages Login systems Shopping carts Cookies Uses
Library built by John Craig http://www.splash21.on-rev.com/ Creating - setCookie pName, pValue, pExpires, pPath Deleting - deleteCookie pName Accessing - COOKIES[“cookie_name”] Always set/delete before header sent Cookies in revServer
Like cookies – stores data communicated between user and server Data stored on server, not user's machine Data need not be textual More secure – not user editable No limits on data stored Much greater scope Sessions
Library built by John Craig Implemented using cookies and database Accessed via variable SESSION[] updateSessionVars must be called at end of script Session in revServer
“User States - Logins, Accounts, Permissions”, John Craig, Tomorrow 2pm “revServer: jQuery, AJAX”, James Cant, Tomorrow 3pm “revServer: Building a Web Store”, Andre Garzia, Tomorrow 4pm Further Information