Index: help/example-view-limit-with-view.html
===================================================================
RCS file: help/example-view-limit-with-view.html
diff -N help/example-view-limit-with-view.html
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ help/example-view-limit-with-view.html	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,116 @@
+<!-- $Id:  $ -->
+<p>In this example you will create create two views. The first will view will pull information, the second will be used to filter out the first.  This will demonstrate using Views <em>php and arguments together as well as cloning</em> to extend the functionality of the view.</p>
+
+<p>Before working through this example, create several entries of type page. Of those select a few at random and edit them. Under Publishing options check "Sticky at top of lists" and save.</p>
+
+<h3>Creating the View</h3>
+<p>The first step is to create a view that will pull node ids(nids) of the nodes that we want to <em>exclude</em>.  Go to <a target="_blank" href="/admin/build/views/add">add new view</a>, enter the following properties, and click <strong>Next</strong>:</p>
+
+<dl>
+  <dt>View name</dt>
+  <dd>exclude_list</dd>
+  <dt>View description</dt>
+  <dd>List of node ids that we want to exclude.</dd>
+  <dt>View tag</dt>
+  <dd>page</dd>
+  <dt>View type</dt>
+  <dd>Node</dd>
+</dl>
+
+<h3>Generating a list of page entries</h3>
+<p>We will get views to give us the nids of the pages that have been checked "Sticky at top of lists"</p>
+
+<ol>
+<li>In the third column, locate the <strong>Fields</strong> area. Generally speaking, fields are the pieces of information that you want to display in the view (in this case, node title). Click the <strong>+</strong> icon to add a field.</li>
+<li>Scroll down to <strong>Defaults: Add fields</strong>, below the settings table. A large selection of fields will be available.</li>
+<li>In the <strong>Groups</strong> drop-down menu, select <em>Node</em>. This will limit the list to only the default fields exposed by Node module.</li>
+<li>Scroll down the list, select the <em>Node: Nid</em> field, and click <strong>Add</strong>.</li>
+<li>You will now be presented with settings for the <em>Node: Nid</em> field. Delete the label from the <strong>Label</strong> field, so that each individual node title is not prefixed with the word "Nid." </li>
+<li>When finished, click <strong>Update</strong>. If you scroll down to the <strong>Live Preview</strong> section, you should now see a list of several node ids; however both page entries and other node types will be in the list. Let's fix that.</li>
+<li>In the fourth column, locate the <strong>Filters</strong> area. Filters limit the results displayed in the view, and we can use this to our advantage here by showing node titles only from page entries and not every type of node. Click the <strong>+</strong> icon to add a filter.</li>
+<li>As before, scroll down to the <strong>Defaults: Add filters</strong> section, select <em>Node</em> from the <strong>Groups</strong> select box to limit the list of options to only those exposed by Node module.</li>
+<li>Scroll down and select the <em>Node: Type</em> field and click <strong>Add</strong>. In the settings page that appears, leave <strong>Operator</strong> as <em>Is one of</em> and select <em>Page</em> under <strong>Node type</strong>. Click <strong>Update</strong> when finished.</li>
+<li>Now, by scrolling down to <strong>Live preview</strong>, you'll see that the list only shows page entries.</li>
+<li>Click <em>save</em> to save the view to the database </li>
+</ol>
+
+
+<h3>Cloning the view</h3>
+<p>We will get views to pull the nids and titles of the pages that are not sticky by using our first view (exclude_list) as a base for the view that will pull the final result. It may seem counterintuitive to begin the process by targeting the entries we are trying to exclude but keep in mind that exclude list does not depend on the view that will be filtered. While the view that will be filtered depends on the exclude_list.
+</p>
+
+<p>From the exclude_list edit page or the view list page you can click on the clone link or go to <a target="_blank" href="/admin/build/views/clone/exclude_list">clone the view</a>, enter the following properties, and click <strong>Next</strong>: </p>
+
+<dl>
+  <dt>View name</dt>
+  <dd>include_list</dd>
+  <dt>View description</dt>
+  <dd>List of node ids and titles dynamically filtered by the exclude_list view.</dd>
+  <dt>View tag</dt>
+  <dd>page</dd>
+  <dt>View type</dt>
+  <dd>Node</dd>
+</dl
+
+<h3>Expanding the scope of the view</h3>
+<p>The exclude_list view does a great job of filtering out only the nodes that we <strong>do not </strong>want. We are going to expand the view so that brings the entire set of nids and titles.</p>
+
+<ol>
+<li>In the third column, locate the <strong>Fields</strong> area. Click the <strong>+</strong> icon to add a field.</li>
+<li>Scroll down to <strong>Defaults: Add fields</strong>, below the settings table. A large selection of fields will be available.</li>
+<li>In the <strong>Groups</strong> drop-down menu, select <em>Node</em>. This will limit the list to only the default fields exposed by Node module.</li>
+<li>Scroll down the list, select the <em>Node: Title</em> field, and click <strong>Add</strong>.</li>
+<li>You will now be presented with settings for the <em>Node: Title</em> field. Delete the label from the <strong>Label</strong> field, so that each individual node title is not prefixed with the word "Title." Additionally, check the <em>Link this field to its node</em> box so that visitors who see an interesting title can click directly on it to view the page to which it belongs.</li>
+<li>In the fourth column, locate the <strong>Filters</strong> area. Click the <strong>&#8593; &uarr;</strong> icon to rearrange the filter.</li>
+<li>Scroll down to the <strong>Defaults: Rearrange filters</strong> click <strong>&empty; </strong> icon on the on the same line as Node: Sticky Yes to remove the filter</li>
+<li>Click <strong>Update</strong> when finished.</li>
+<li>Now, by scrolling down to <strong>Live preview</strong>, you'll see the list of all the page entries, including those we are trying to filter.</li>
+<li>Click <em>save</em> to save the view to the database </li>
+</ol>
+
+
+<h3>Adding context with arguments</h3>
+<p>Arguments allow us to interactively filter our views, however views cannot forsee every situation that a user may have to filter. For that views allows us to use php to further modify the action of the view.</p>
+
+<p>
+Before continuing, we are going to discuss the mechanism which we will use to embed one view into another view.
+The views api provides developers various methods of influencening the funcitonality of view. We will use one of the functions provided by the api, to get an array of of the results. We will parse this array to format it in a manner that allow it to be accepted as an argument.
+<pre>
+//Declare a variable that calls the views_get_views_result function. This variable now contains the result of the view.
+$results = views_get_view_result('exclude_list', $display_id = NULL);
+  //Create a condition to ensure we have results and to provide a default argument if we do not. First tell php what to do with our variable if it has results 
+  if(!empty($results)){
+    //Create an empty array that will hold our nids
+    $willbestring= array();
+    //Iterate (go over) the results variable and fill in the array
+    foreach($results as $key => $value) {
+    $string[] = $value->nid;
+    }
+    //Use php'simplode function to create a string that contains the nids seperated by a plus
+    $string = implode("+", $willbestring);
+  }
+  //If there are no results declare the values '5+6'
+  else{
+    $string = "5+6"; //You can put any values or "" to return an empty string
+  }
+
+return $string;
+</pre>
+
+</p>
+
+<p>Let's walk through adding and configuring an argument to our view so that we can use our first view to filter our second view.</p>
+
+<ol>
+<li>In the third column, locate the <strong>Arguments</strong> area. Click the <strong>+</strong> icon to add an argument.</li>
+<li>Because we are basing the view around <em>nodes</em>, this time under <strong>Groups</strong> select <em>Node</em>. Check <em>Node: Nid</em> and click <strong>Add</strong>.</li>
+<li>The <strong>Defaults: Configure Argument User: Uid</strong> settings page has a lot going on, but only a few things that need our attention.</li>
+<li>Under <strong>Action to take if argument is not present</strong>, there are a variety of options, ranging from displaying a 404 or a 403 page to simply displaying all values in the view. In our case, the argument handler (the code that allows views to understand the argument) doesn't exist. Select <em>Provide default argument</em>.</li>
+<li>Assuming JavaScript is enabled in your browser, you should now get another selection for <strong>Default argument type</strong>. Select <em>PHP Code</em>.</li>
+<li>A new text area with the title <strong>PHP argument code</strong>should appear</li>
+<li>Enter the code from the paragraph into the text area</li>
+<li><strong>Validator options</strong> provide a useful way to control what kind of arguments your view will accept. Select <em>Node</em> as the <strong>Validator</strong>. By default, changing this setting will check the incoming argument and ensure it's a valid node ID; if not, the view will be hidden from the page.</li>
+<li>Select <em>"Node IDs separated by , or +"</em> This will instruct the validator to check that the arguments are numeric and seperated by a + or ,. If they aren't it will hide the view.</li>
+<li>Once you have changed the argument's title, default argument, and validator options, click <strong>Update</strong> to save your changes.</li>
+<li>If all went well the view should now filter from exclude_list view</li>
+</ol>
