Working with HTML blocks

You often have problems using repetitive layout. 

To do this, you can use HTML blocks - parts of a certain markup that can be inserted by the name code.

How to use HTML blocks: 

  1. Creating a block in the HTML blocks section (/htmlblocks). 
  2. Specifying the HTML field. 
  3. If the block is dynamic (something to output in a loop or have changing parameters), then specify the stored procedure for generating markup (get). 
  4. We use the block by code in places where markup is generated

Easy to use (for static elements)

select dbo.as_htmlBlockLang(@code, @langID)

The block code and language are passed to the function. As a result, we get a static layout. 

Use with changing markup

The HTML block Markup is built using a stored procedure.

declare @res nvarchar(max)
exec [dbo].[as_block]
	@code ='test1',
	@itemID =12,
	@parameters = default,   -- ExtendedDictionaryParameter (langID, username and etc)
	@res =@res OUTPUT

select @res

We can pass a certain itemID to the procedure, as well as specify any additional parameters in @parameters. The output markup will be generated via the block's stored procedure and returned to @res

 

Falcon Space is a functional web development platform on a narrow stack MS SQL/Bootstrap. Falcon Space Gettting started
{sp-shortDemostandLinks}