Difference between revisions of "Liquid Template Variables - request"

From Spiffy Stores Knowledge Base

Line 27: Line 27:
 
For example, if we go to <nowiki>http://storedemo.spiffystores.com/products/widget</nowiki>, then the request.url returns:
 
For example, if we go to <nowiki>http://storedemo.spiffystores.com/products/widget</nowiki>, then the request.url returns:
  
<pre>storedemo.spiffystores.com/products/widget</pre>
+
<pre>http://storedemo.spiffystores.com/products/widget</pre>
  
 
== <code>request.remote_ip</code> ==
 
== <code>request.remote_ip</code> ==
  
 
Returns the IP address of the client accessing the page.
 
Returns the IP address of the client accessing the page.

Revision as of 15:53, 17 August 2010

The liquid template variable request has the following attributes:

request.parameter

You can access any request parameter by name.

For example, a URL can include a parameter:

http://storedemo.spiffystores.com/?theme=blue

This theme parameter can be accessed by

request.theme

request.host

Returns the host name portion of the URL request.

For example, if we go to http://storedemo.spiffystores.com, then the request.host returns:

storedemo.spiffystores.com

request.url

Returns the complete URL used for this request.

For example, if we go to http://storedemo.spiffystores.com/products/widget, then the request.url returns:

http://storedemo.spiffystores.com/products/widget

request.remote_ip

Returns the IP address of the client accessing the page.