Markup

From Nephtali Documentation

Jump to: navigation, search

Nephtali uses standard XML comments to define pipes, the dynamic regions of pages.

Contents

Benefits of using XML comments

By using XML comments, Nephtali provides several advantages:

  • People familiar with XML can easily work with the markup used in Nephtali web applications.
  • Designers can easily see and control the rendering of the page as a whole, including each of the many possible states of the dynamic regions (pipes.)
  • Presentation is cleanly separated from the other aspects of the application.
  • The framework is easily accommodated by IDE's such as Dreamweaver.

Pipes: Dynamic regions of the page

Pipes are the comment-delimited regions of the web page that contain dynamic output. The markup on the page that is controlled by a pipe is surrounded by the comments <!--pipe:name_of_pipe-->, as can be seen in the example below. Each of the various states of the dynamic region (e.g., error, invalid input, empty, etc.) are represented by views.

Views: Possible states of the pipe

Views are the comment-delimited regions within a pipe that provide the various possible views of state. For instance, if a database request fails, the application will show the error view of the page, signified by the comments <!--view:error-->, as can be seen in the example below. Of note, the error view is the one required view of any pipe, as it's always best to prepare for the worst. You have complete freedom to add any number of other possible views needed to properly render the possible states within the pipe. That said, there are general conventions for views typically found within pipes:

default
This is what is shown when the pipe loads as expected.
The data region is where you insert {placeholders} for the data you want to insert onto the page. The data region repeats for each record of data.
feedback
The view shown if some of the data received in the page request was found to be invalid (e.g., Get, Post, Cookie, or File data.)
empty
This is what is shown when the pipe typically displays data, and there were no records available for a particular request.
error (required)
This is used when there has been a problem and Nephtali cannot render that pipe as expected.


Here's an example of typical markup

Note that each pipe, view, and data comment in this example has a corresponding nested and matching comment that closes it.

		<div id="content_secondary">
				<!--pipe:announcements-->
				<!--view:default-->
				<h2>Recent blog entries</h2>
				<ul>
					<!--data-->
					<li>
						<h4><a href="{link}">{title}</a></h4>
						<p>{description}</p>
					</li>
					<!--data-->
				</ul>
				<!--view:default-->
				<!--view:empty-->
				<h2>Recent blog entries</h2>
				<ul>
					<!--data-->
					<li>
						<h4>There are no blog entries at this time</h4>
						<p>We apparently have no business running a blog.</p>
					</li>
					<!--data-->
				</ul>
				<!--view:empty-->
				<!--view:error-->
				<h2>Recent blog entries (Error)</h2>
				<ul>
					<li>
						<h4>We experienced an error while processing this request.</h4>
						<p>Please try to view this page later</p>
					</li>
				</ul>
				<!--view:error-->
				<!--pipe:announcements-->
		</div>
Personal tools