|
Contents:
URL and Session Variables Understanding how I.C.E. puts together Site pages internally and the variables available to those pages is an important step in making the most of the Content Management System. I.C.E. is Coldfusion-based but through the use of built-in Widgets and data in XML format it can be used to publish pages with .html, .asp, .php, .jsp etc. extensions. At runtime, those pages can then perform additional processing in their respective languages and use scripts built in those languages. Dynamic pages or pages with a .cfm extension are Coldfusion pages and can run and execute Coldfusion code and use external Coldusion components, scripts, custom tags and so on. Internally, Coldfusion uses two files to render your site: index.cfm and page.cfm. Index.cfm essentially processes whatever is in the Index Template Code field for the Channel the page belongs to and page.cfm processes whatever is in the Page Template Code field for the Channel the page belongs to. The idea is that index.cfm handles the content for the a Channel's home page and page.cfm handles the content for an individual Page in a Channel. To use a portal analogy, index.cfm handles the Sports home page with all the latest sports stories and page.cfm handles an individual sports story. Both index.cfm and page.cfm are located in your site's folder.
How I.C.E. uses index.cfm Index.cfm takes 2 parameters: sid (a Site ID) and cid (a Channel ID). If index.cfm is called with just the sid (Site ID) parameter, I.C.E. looks for the Channel you designated as the Home Page and displays it. E.g. http://localhost/ice/sites/demo_site/index.cfm?sid=1 [Demo Site Home Page] If index.cfm is called with sid and cid parameters it displays the template for the Channel specified for cid, if that Channel belongs to that site. E.g. http://localhost/ice/sites/demo_site/index.cfm?cid=2&sid=1 [Demo Site News Channel] If index.cfm is called with no parameters it displays a Coming Soon page.
How I.C.E. uses page.cfm Page.cfm takes 3 parameters: sid (a Site ID), cid (a Channel ID) and pid (a Page ID). If page.cfm is called with just the sid (Site ID) or just the sid and the cid, it displays a Coming Soon page because no Page ID was specified. Page.cfm needs all 3 parameters. If all 3 are available, I.C.E. checks to see if the Page ID specified belongs to the Channel ID specified and the Site ID specified. If that is the case, then the page is displayed using the Page Content Code for the Channel specified. E.g. http://localhost/ice/sites/demo_site/page.cfm?pid=2&cid=1&sid=1 [Just an example]
Global Variables Index.cfm and page.cfm and any code entered or Containers included in the Index Template Code and Page Template Code fields of their respective channels have access to URL variables passed to them and session variables set by I.C.E. As described above, URL variables for index.cfm are url.sid and / or url.cid and for page.cfm they are url.sid, url.cid and url.pid. Always available session vairiables are session.my_site_id or session.my_language_id. These variables may be used with the ICE widgets to retrieve all kinds of content. For example, session.my_site_id and session.my_language_id are set for every user the moment you load a page belonging to the Site and will always exist therefore can use them to retrieve the right content for the site in the right language. The URL variables are also available for index.cfm and page.cfm depending on the URL parameters the pages are called with. What happens when you publish a page? Any variables available to I.C.E. generated dynamic site pages are available at the time you publish and those pages will be processed before publishing. What you'll see in the published page is exactly what you see in the dynamic page. How do you use these variables? Internally, I.C.E. uses the URL variables to retrieve the right HTML code for display or publishing by index.cfm (from Channel's Index Template Code field) and page.cfm (from Channel's Page Template Code field). You place the HTML code for your site in these 2 fields or you include Containers which contain the HTML code. Within that HTML code you can have static content or dynamic content retrieved from the I.C.E. database. Using I.C.E. Widgets, you can retrieve content for a Channel or Page without writing SQL queries. You simply pass the required parameters to the widget. For example, to retrieve content for a page you can use the Page Widget (not to be confused with the page.cfm file in your site folder). You know that pid is one of the parameters required by page.cfm so you can assume it will always be available. The Page Widget takes a parameter Page_ID which is essentially the same data as pid. In your Channels Page Template Code field or in a Container included in that field you can use the Page Widget like this: <!--- Call the Page Widget and pass the Page ID ---> <!--- Display the Title and Body --->
Summary I.C.E. uses URL and user session variables internally, you can use them too, with the aid of I.C.E. Widgets or in SQL Queries, to retrieve the content you need in your site pages. You do this in the Index Template Code or Page Template Code fields of Channels (or in Containers included in these fields), which in turn determine the look-and-feel and the content retrieved by Index.cfm and Page.cfm to put together site pages dynamically. These 2 files are also used to publish site pages. |
DEMO (Beta)
Don't take our word for it. Try Lingxia 273 I.C.E. content managent system now: (Contact us to access the demo with Admin privileges) |
Copyright 2009 - Lingxia 273. All rights reserved