<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">
    <channel>
        <title>How_to_Add_Custom_Sections_to_View_Tab[ Search for &quot;&quot;]</title>
        <description></description>
        <link>http://xataface.com/wiki/index.php?-action=single_record_search&amp;-table=wiki&amp;page_id=%3D52&amp;-cursor=0&amp;-skip=0&amp;-limit=30&amp;-mode=list&amp;--subsearch=</link>
        <lastBuildDate>Thu, 23 May 2013 08:02:10 +0100</lastBuildDate>
        <generator>FeedCreator 1.7.2</generator>
        <item>
            <title>How_to_Add_Custom_Sections_to_View_Tab</title>
            <link>http://www.xataface.com/wiki/How_to_Add_Custom_Sections_to_View_Tab</link>
            <description>&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;/th&gt;&lt;th&gt;Value&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page name&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;How_to_Add_Custom_Sections_to_View_Tab&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page id&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;52&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page title&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;How_to_Add_Custom_Sections_to_View_Tab&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Content&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;
&lt;h2 id=&quot;toc0&quot;&gt;How to Add Custom Sections to the View tab&lt;/h2&gt;
&lt;table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;&lt;tr&gt;&lt;td&gt;
&lt;div id=&quot;toc&quot;&gt;&lt;strong&gt;Table of Contents&lt;/strong&gt;
	&lt;div style=&quot;margin-left: 0em;&quot;&gt;&lt;a href=&quot;#toc0&quot;&gt;How to Add Custom Sections to the View tab&lt;/a&gt;&lt;/div&gt;
	&lt;div style=&quot;margin-left: 0em;&quot;&gt;&lt;a href=&quot;#toc1&quot;&gt;Example 1: A &amp;quot;Hello World&amp;quot; Section&lt;/a&gt;&lt;/div&gt;
	&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#toc2&quot;&gt;Customizing the Section Label&lt;/a&gt;&lt;/div&gt;
	&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#toc3&quot;&gt;Customizing the Section Order&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;The &lt;em&gt;View&lt;/em&gt; tab is intended to give the user a detailed view of the contents of a record.  By default it shows the values of each non-empty field grouped into their appropriate field groups.  It also shows the most recent 5 related records from each relationship in the record.  You can also add your own sections by implementing the section__xxx&lt;a href=&quot;/wiki/index.php?-action=new&amp;-table=wiki&amp;page_name=section__xxx&quot;&gt;?&lt;/a&gt; method of the delegate class.&lt;/p&gt;


&lt;h2 id=&quot;toc1&quot;&gt;Example 1: A &amp;quot;Hello World&amp;quot; Section&lt;/h2&gt;
&lt;p&gt;We'll start by adding a simple section that simply displays &amp;quot;Hello World&amp;quot; to the user.  In the delegate class for your table, add the following method: 
&lt;pre&gt;&lt;code&gt;function section__hello(&amp;amp;$record){
    return array(
        'content' =&amp;gt; 'Hello World!!!',
        'class' =&amp;gt; 'main'
    );
}&lt;/code&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;Now if you reload our application and click on the &amp;quot;View&amp;quot; tab for any of the records in the database, you'll notice a section labelled &lt;em&gt;hello&lt;/em&gt; with the text &lt;em&gt;Hello World!!!&lt;/em&gt; in it.&lt;/p&gt;

&lt;p&gt;Let's dissect the above code so that we can better understand what is going on here.&lt;/p&gt;

&lt;ol&gt;
    &lt;li&gt; The function &lt;em&gt;section__hello()&lt;/em&gt; defines a section named &lt;em&gt;hello&lt;/em&gt;.  If you wanted to define a section named &lt;em&gt;foo&lt;/em&gt; you would call the function &lt;em&gt;section__foo()&lt;/em&gt;&lt;/li&gt;
    &lt;li&gt; This function returns an array with the keys &lt;em&gt;content&lt;/em&gt;, and &lt;em&gt;class&lt;/em&gt;.&lt;/li&gt;
    &lt;li&gt; The &lt;em&gt;content&lt;/em&gt; key points to the actual HTML content of the section.  In this case it is simply the text &lt;em&gt;Hello World!!!&lt;/em&gt;.&lt;/li&gt;
    &lt;li&gt; The &lt;em&gt;class&lt;/em&gt; key defines where the section should be displayed.  It accepts values of &lt;em&gt;left&lt;/em&gt; and &lt;em&gt;main&lt;/em&gt; only.  If it is set to &lt;em&gt;left&lt;/em&gt;, then the section will be displayed in the left column.  A value of &lt;em&gt;main&lt;/em&gt; indicates that it should be displayed in the main column.&lt;/li&gt;
&lt;/ol&gt;


&lt;h3 id=&quot;toc2&quot;&gt;Customizing the Section Label&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;hello&lt;/em&gt; is a boring label, so let's add our own custom label by adding the &lt;em&gt;label&lt;/em&gt; key to the array returned by our method: 
&lt;pre&gt;&lt;code&gt;function section__hello(&amp;amp;$record){
    return array(
        'content' =&amp;gt; 'Hello World!!!',
        'class' =&amp;gt; 'main',
        'label' =&amp;gt; 'Message of the Day'
    );
}&lt;/code&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;Now if you load the view tab of your application, you'll notice that the section has a heading &amp;quot;Message of the Day&amp;quot;.&lt;/p&gt;


&lt;h3 id=&quot;toc3&quot;&gt;Customizing the Section Order&lt;/h3&gt;
&lt;p&gt;A section can also specify an &lt;em&gt;order&lt;/em&gt; attribute to define the order in which this section should appear.  It defaults to 0 which may cause the section to appear at the top of the view tab.  You can push it to the bottom of the view tab by assiging a higher number to the &lt;em&gt;order&lt;/em&gt; attribute: 
&lt;pre&gt;&lt;code&gt;&amp;lt;code&amp;gt;
function section__hello(&amp;amp;$record){
    return array(
        'content' =&amp;gt; 'Hello World!!!',
        'class' =&amp;gt; 'main',
        'label' =&amp;gt; 'Message of the Day',
        'order' =&amp;gt; 10
    );
}&lt;/code&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;Now if you reload the view tab you'll notice that the section has moved to the bottom of the page.&lt;/p&gt;

&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Language&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;en&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</description>
            <author>How_to_Add_Custom_Sections_to_View_Tab</author>
        </item>
    </channel>
</rss>
