NetPublish API


<< Known NetPublish hosts an ...
Back to Portfolio FAQ index
NP Dynamic Libraries and ... >>

NP Manual: pages 29-51 (v7 client also installs a PDF version of the NP manual)

NP uses JavaScript as it's language. This is used both in client-side NP Assistant (NPT files) and server-side for NP files. Besides, NP templates, NP library files of JavaScript can also be used (many of the built-in templates sets use these), just like '.js' files. Confusingly these library files use the same '.np' suffix as the template pages - making it difficult to set up code colouring in code editors that allow for this (though some like BBEdit offer more control at file level). It is not documented, but NP can in fact use '.js' code files (if cocrrectly referenced in the nP code) allowing, for instance, NP to use otherwise client-side-only constants and variable presets.

NP code is written according to JavaScript language rules. In template pages the <% %> and <%= %> tags are used to enclose sections of NP code. In NPT (NP Assistant) code [[ ]] and [[= ]] code tags are used. Thus NPT source often includes both these types of tag. Note that when using the <%= %> or [[= ]] style of tag, do not end the contained code with a terminating semi-colon - as is otherwise normal for a line of JavaScript code - or the code will error. This can be confusing at first:
good -
<%=getSomeValue(myVar)%> or <%= getSomeValue(myVar) %>
bad -
<%=getSomeValue(myVar);%> or <%= getSomeValue(myVar); %>.

Note that both types of tag (with/without the '=') can either have a space after them or not. Indeed, opening <% and closing %> can be on lines pre/succeeding actual NP code, e.g.
<%
// code here
%>

NetPublish's Object Structure

Global Functions

Function convertHtml(html)
Function dateDaysOld(from,to)
Function encodeEscapeURI(s)
Function htmlEncode(s)
Function isDate()
Function JSEscapeForDoubleQuotes(s, level)
Function JSEscapeForSingleQuotes(s, level)
Function library(filename)
Function LocalizeFieldValue(FieldValue)
Function processArray(array,html)
Function processRecordSet(message,html)

RecordSet Object

Object RecordSet
Property totalItems
Property offset
Property record
Function getUrl(offset)
Function hasMore()
Function isEmpty()
Function itemNext()
Function itemPrevious()
Function itemAt(offset)

record Object

Object record
Property itemID
Property thumbnailHeight
Property thumbnailWidth
Function get(fieldname,[offset],[escapestyle])
Function getCollectionPostForm(command,template,[name])
Function getCollectionLink(command,template,[name])
Function getDetailLink(template)
Function getType(name)
Function getTypeAll([type])
Function original
Function preview
Function thumbnail

FieldType Object

Object FieldType
Property custom
Property length
Property multivalued
Property name
Property preDefinedList
Property type
Function getPreDefinedList()

CatalogSet Object

Object CatalogSet
Function get(alias,[catalogOffset])
Function getAliases()
Function getCatalogCount(alias)
Function getMasterKeywordsAll()

Catalog Object

Object Catalog
Property dateCreated
Property dateModified
Property diskPreview
Property diskPreviewMaxSize
Property diskPreviewPath
Property diskPreviewQuality
Property fullPath
Property thumbnailQuality
Property thumbnailSize
Property totalItems
Property totalKeywords
Function getMapping(name)
Function getMappingAll()
Function getMasterKeywordsAll()
Function getType(name)
Function getTypeAll([type])

CollectionSet Object

Object CollectionSet
Function get([alias],[namedSet])
Function addNamedSet(name,[alias])
Function getNamedSetAll([alias])
Function removeNamedSet(name,[alias])

Collection Object

Object Collection
Function add(itemID)
Function getItemIDAll()
Function getRecord(itemID)
Function remove(itemID,[removeAll])

Request Object

Object Request
Function getCookie(name)
Function getHeader(name)
Function getHeaderAll()
Function getParameter(parameter)
Function getParameterAll()
Function post
Function getQueryString()
Function getRequestURL()

Response Object

Object Response
Function getContentType()
Function getStatusCode()
Function logMessage(priority,message)
Function setContentType(type)
Function setCookie(name,value,[expires],[domain],[secure])
Function setHeader(name,value,[append])
Function setRedirect(url)
Function setStatusCode(code)
Function showErrorHTML(filename,message)
Function write(string)

Page Object

Object Page
Function getCurrent()
Function getList(total)
Function getNext(text)
Function getPrevious(text)
Function getSpecified(page,text)
Function getTotal()
Function isFirst()
Function isLast()
Property itemsPerPage
Function setRowsCols(rows,cols)

Path Object

Object Path
Function getOS(path)
Function getParts(path)

Units Object

Object Units
Function convertDate(value,format)
Function convertLength(value,to,dpi)
Function convertMoney(value,currency,[comma],[decimal],[negativeParens])
Function convertSize(value,to,[comma],[decimal])

Mozilla JavaScript Objects

Object Array
Object Date
Object File [not implemented]
Object Math
Object RegExp
Object String

NetPublish Commands

add
archive
base
find
original
preview
quickfind
remove
show
thumbnail

NetPublish Command Parameters

all
ascending
aspect
catalog
defaultjoin
download
field
filename
format
height
itemid
join
macbinary
name
offset
op
session
site
sorton
template
value
width

Keywords (to assist indexing/searching):



Question: NetPublish API [FAQ00372.htm]
Last Update:- 27 November 2006


<< Known NetPublish hosts an ...
Back to Portfolio FAQ index
NP Dynamic Libraries and ... >>

Quick Search of PortfolioFAQ (word, words or phase): or try the Advanced Search

User-to-User Forums  |  Report error/typo/broken link  |  Request new topic  |  Ask a question

Site and articles © Mark Anderson 2001-2007 - Visit my home page


This FAQ is created and maintained using
Friday logo
Friday - The Automatic FAQ Maker