partial.js logo
Latest version
v1.3.1 (RC2)

FrameworkViews


For more informations about views click on How do views work?. Views support simple conditions and custom helpers.

Properties


@{body} {String}@{config.customKey} {Object}@{description} {String}@{get.customKey} {String}@{global.customKey} {Object}@{head} {String}@{keywords} {String}@{meta} {String}@{model.customKey} {Object}@{post.customKey} {String}@{repository.customKey} {Object}@{session.customKey} {Object}@{settings} {String}@{title} {String}@{user.customKey} {Object}
@{body};
return String;

This tag is available in a layout. Into this tag are render all views.

@{config.customKey};
return Object;

Get value from configuration.

@{description};
return String;

Render description value. Description is set via @{meta('title', 'description')} method.

@{get.customKey};
return String;

Get value from GET data.

@{global.customKey};
return Object;

Get value fromframework global object.

@{head};
return String;

Render all head values.

@{keywords};
return String;

Render keywords value. Keywords is set via @{meta('title', 'description', 'keywords')} method.

@{meta};
return String;

Render all meta tags.

@{model.customKey};
return Object;

Get value from model.

@{post.customKey};
return String;

Get value from POST data.

@{repository.customKey};
return Object;

Get value from repository object.

@{session.customKey};
return Object;

Get value from controller.session object.

@{settings};
return String;

Render all settings values.

@{title};
return String;

Render title value. Title is set via @{meta('title')} method.

@{user.customKey};
return Object;

Get value from controller.user object.

Methods


@{canonical(url)}@{checkbox(name, [label])}@{checked(checked, [charBeg], [charEnd])}@{contentToggle(visible, name)}@{content(name)}@{css(filename)}@{currentContent(path)}@{currentCSS(path)}@{currentImage(path)}@{currentJS(path)}@{currentTemplate(path)}@{currentUpload(path)}@{currentVideo(path)}@{currentView(path)}@{disabled(disabled, [charBeg], [charEnd])}@{dns(filename1, [filename2], [filename..n])}@{download(filename, innerHTML, [downloadName], [className])}@{etag(value)}@{favicon(filename)}@{header(key, value)}@{head(value)}@{hidden(name, [attr])}@{image(filename, [width], [height], [alt], [className])}@{json(obj, [id])}@{js(filename)}@{layout(name)}@{meta(title, [description], [keywords], [imageURL])}@{modified(value)}@{next(url)}@{options(arr, selectedValue, [propertyText], [propertyValue])}@{prefetch(filename1, [filename2], [filename..n])}@{prerender(url)}@{prev(url)}@{radio(name, value, [label])}@{readonly(readonly, [charBeg], [charEnd])}@{resource([name], key, [default])}@{routeCSS(name)}@{routeImage(name)}@{routeJS(name)}@{routeStatic(name)}@{routeUpload(name)}@{routeVideo(name)}@{selected(selected, [charBeg], [charEnd])}@{settings([param1], [param1], [param..n])}@{sitemap(name, [url], [index])}@{templateToggle(visible, name, arr, [nameEmpty], [repository])}@{template(name, arr, [nameEmpty], [repository])}@{textarea(name, [attr])}@{text(name, [attr])}@{viewToggle(visible, name, [model])}@{view(name, [model])}
@{canonical(url)};

Add canonical tag into the HTML head. This result is rendered via @{head} tag.
Output: <link rel="canonical" ...

@{checkbox(name, [label])};
auto model binding

Render checkbox <input type="checkbox" ...

@{checkbox('Terms', { label: 'I agree', class: 'terms' })}
@{checkbox('Terms', 'I agree')}

@{checked(checked, [charBeg], [charEnd])};

Render checked attribute: checked="checked"

@{contentToggle(visible, name)};

Render static content from config['directory-contents'].

@{content(name)};

Render static content from config['directory-contents'].

@{css(filename)};
return String;

Insert CSS file into the webpage. Function return LINK tag by the config['static-url-css'].

@{currentContent(path)};

Set additional path. This path will add into the default path.

@{currentCSS(path)};

Set additional path. This path will add into the default path.

@{currentImage(path)};

Set additional path. This path will add into the default path.

@{currentJS(path)};

Set additional path. This path will add into the default path.

@{currentTemplate(path)};

Set additional path. This path will add into the default path.

@{currentUpload(path)};

Set additional path. This path will add into the default path.

@{currentVideo(path)};

Set additional path. This path will add into the default path.

@{currentView(path)};

Set additional path. This path will add into the default path.

@{disabled(disabled, [charBeg], [charEnd])};

Render disabled attribute: disabled="disabled"

@{dns(filename1, [filename2], [filename..n])};

Add dns prefetch tag into the HTML head. This result is rendered via @{head} tag.
Output: <link rel="dns-prefetch" ...

@{download(filename, innerHTML, [downloadName], [className])};
return String;

Create an A TAG. URL address routes into the config['static-url-upload'] (by the currentUpload).

@{etag(value)};

Set ETag value - this function create response header.

@{favicon(filename)};
return String;

Insert favicon into the webpage. Function return LINK tag by the config['static-url'].

Set custom response header.

Add value into the HTML head. This result is rendered via @{head} - without arguments.

@{hidden(name, [attr])};
auto model binding

Render hidden box <input type="hidden" ...

@{hidden('Custom')}

@{image(filename, [width], [height], [alt], [className])};
return String;

Create IMG tag. URL address routes into the config['static-url-image'] (by the currentImage).

@{json(obj, [id])};

Serialize object into the JSON. If is set id attribute then is generate: <script type="application/json" ...

@{js(filename)};
return String;

Insert JS file into the webpage. Function return SCRIPT tag by the config['static-url-js'].

@{layout(name)};

Change layout of view.

@{meta(title, [description], [keywords], [imageURL])};
return String;

Create META tags.

@{modified(value)};

Set Last-Modified value - this function create response header.

Add next (NEXT PAGE) tag into the HTML head. This result is rendered via @{head} tag.
Output: <link rel="next" ...

@{options(arr, selectedValue, [propertyText], [propertyValue])};

Render option tags from array.

<select>
@{options([{ name: 'All', value: 0 }, { name: 'One', value: 1 }], 1)}
</select>

@{prefetch(filename1, [filename2], [filename..n])};

Add prefetch tag into the HTML head. This result is rendered via @{head} tag.
Output: <link rel="prefetch" ...

@{prerender(url)};

Add prerender tag into the HTML head. This result is rendered via @{head} tag.
Output: <link rel="prerender" ...

Add prev (PREVIOUS PAGE) tag into the HTML head. This result is rendered via @{head} tag.
Output: <link rel="prev" ...

@{radio(name, value, [label])};
auto model binding

Render radio <input type="radio" ...

@{radio('Sex', 'man', { label: 'Man', class: 'sex' })}
@{radio('Sex', 'woman', 'Woman')}

@{readonly(readonly, [charBeg], [charEnd])};

Render readonly attribute: readonly="readonly"

@{resource([name], key, [default])};
return String;

Read value from resource file.

@{routeCSS(name)};
return String;

Route URL to CSS directory by the config['static-url-css'].

@{routeImage(name)};
return String;

Route URL to Image directory by the config['static-url-image'].

@{routeJS(name)};
return String;

Route URL to JavaScript directory by the config['static-url-js'].

@{routeStatic(name)};
return String;

Route URL to static directory by the config['static-url'].

@{routeUpload(name)};
return String;

Route URL to Upload directory by the config['static-url-upload'].

@{routeVideo(name)};
return String;

Route URL to Video directory by the config['static-url-video'].

@{selected(selected, [charBeg], [charEnd])};

Render selected attribute: selected="selected"

@{settings([param1], [param1], [param..n])};

Add Create custom values.

@{sitemap(name, [url], [index])};

Add link to sitemap collection.

@{templateToggle(visible, name, arr, [nameEmpty], [repository])};

Render template from config['directory-templates'].

@{template(name, arr, [nameEmpty], [repository])};

Render template from config['directory-templates'].

@{textarea(name, [attr])};
auto model binding

Render textarea <textarea ...

@{textarea('Description', { class: 'form', placeholder: 'Your name', required: true })}

@{text(name, [attr])};
auto model binding

Render text box <input type="text" ...

@{text('Name', { class: 'form', maxlength: 30, placeholder: 'Your name', required: true })}

@{viewToggle(visible, name, [model])};

Render view into current view.

@{view(name, [model])};

Render view into current view.