|
 |
Due to the volume of spam happening on our forums, posting is now restricted to verified members only. If you're not verified, drop us a note with your username.
|
|
 Home > FlexCMS Support Forum > User Help > Code Snippets > Tips for accessing system data and functions

FlexCMS Support Forum


Tips for accessing system data and functions Started June 11, 2004 @ 12:43pm by DCSun
 |
Post Message |
DCSun Administrator

Posts: 625 |
|
|
Tips for accessing system data and functions | June 11, 2004 @ 12:43pm | If you want to utilize the query string to pass information between custom pages, simply add the variables $Arguments3 through $Arguments9 to your scripts, and they will contain the query string data at those locations (1 being 'pages' and 2 being the link of the page the code is running from). So when you write a script into a page called testscript, and run it from an address like http://www.flexcms.com/index.php/pages/testscript/abc/123, $Arguments3 will contain 'abc' and $Arguments4 will contain '123'.
In addition, you can use the following code to access the form post variables:

Code
ReadFormArguments(); Global $FormArguments; |
|
That will load the form contents into an array. You can access them in the form of $FormArguments['field_name']. So if your form had a field called LastName, the data from it would be stored in $FormArguments['LastName'].
The following variables are also available to assist in linking to areas of the site without compromising the ability to change the address or script name, or re-use the code on other sites:
- $BaseURL will be the base url of the site, like http://www.flexcms.com
- $ImagesURL will be the images folder, like http://www.flexcms.com/images
- $TemplateImagesURL will contain the folder the images for the current template are stored in, which can be useful if you plan to use a different image for each template, perhaps the logo. It will contain something like http://www.flexcms.com/templates/techno-blue if you were using the Techno (Blue) template.
- $IndexURL will be the main page of the site, like http://www.flexcms.com/index.php/index.html
- $MainURL will be the base url together with the script name, which is most useful for links. Simply link to $MainURL.'/pages/pagename.html'. The main url variable will contain something like http://www.flexcms.com/index.php
Finally, you can also determine whether the user is logged in ($LoggedIn will be 'y' if they are, 'n' otherwise), their permissions level ($UserLevel will contain a number from 1 to 100, corresponding to their access level), and their username ($CookieUsername will contain their username). $CookieUsername will be empty and $UserLevel will be zero if the user is a guest.
These can be very useful when writing code that integrates with the site functions. No need to write login, registration, lost password, and other basic functions anymore!

 FlexCMS v3.2 Has Been Released! |
|
|
|
Last Edit: June 12, 2004 @ 3:51am by DCSun | |
|
|
|
|


|
|
 | MEMBERS 
|

|
|