- Suppose you are building an application for the Yahoo! Application Platform (YAP), and want a tabbed navigation in the small view. This code provides a simplified example of how to construct such navigation.
1) The small view will first load the default content (see below), which will callback to this code to fetch the output defined in the else clause of this code.
2) That content will then use a yml:include tag to call back to itself with the parameter "item=1".
3) The script will then execute the if statement and return the default body content for the app.
1) Copy/paste this code into the index file at the root of your app. For example, if the base url for your app is http://example.com/index.php, put this code in index.php. Be sure to remove/comment-out any code already in index.php that may interfere.
2) Put the following code in the default small view code box in the YAP dashboard: <yml:include>loading...</yml:include>. Note that because the "params" attribute is omitted from the yml:include tag, the tag will call back to the app's base url by default.
3) Preview your app's small view in the YAP dashboard. You should see "loading...", followed by the appearance of your "tabs" ("item 1 | item 2 | item 3") above the text "loading ...", followed by the replacement of the loading text with "this is item 1 content"
- Because this is just sample code, security and validation measures have been omitted to reduce complexity. Please add these before using this code in a live app.
- Software License Agreement (BSD License) Copyright (c) 2009, Yahoo! Inc. All rights reserved.
- Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Yahoo! Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Yahoo! Inc.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.