Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[block_blogArticles_get]
- @code nvarchar(128),
- @itemID nvarchar(256),
- @parameters ExtendedDictionaryParameter readonly, -- langID, username...
- @res nvarchar(max) output
- AS
- BEGIN
- -- извлекаем блок по умолчанию
- declare @s nvarchar(max) = '', @t nvarchar(max)='', @temp nvarchar(max), @langID int, @par nvarchar(max)
- select @langID = isnull(try_cast(Value as int),1) from @parameters where [key] = 'langID'
- SELECT @temp = STUFF(
- ( -- https://placeimg.com/80/80/nature
- SELECT '<article class="bla-item card mb-3">
- <a href="/blog/'+isnull(t1.code, '')+'">
- <img loading="lazy" class="card-img-top" src="'+isnull([dbo].[rs_resourceLink]('articleTitleImage', t1.id, 0), '')+'" alt="">
- </a>
- <div class="card-body">
- <div class="bla-title card-title ">
- <a class="card-link" href="/blog/'+isnull(t1.code, '')+'"><h5>'+isnull(lang.title, isnull(t1.title,''))+'</h5></a><div class="bl-desc card-text"></div>
- </div>
- </div>
- </article>'
- FROM (select * from as_articles art
- where id in (select value from dbo.split(@itemID, ','))) t1
- left join as_lang_articles lang on lang.articleID = t1.id and lang.langID = @langID
- order by ord
- FOR XML PATH(''), TYPE
- ).value('.','nvarchar(max)')
- ,1,0, ''
- )
- if( isnull(@temp, '') !='') begin
- set @t = iif(isnull(@langID,0) != 1,'<div class="as-blogArticles">' +
- '<h3>Почитать</h3>' + isnull(@temp, '') +
- '</div> ','<div class="as-blogArticles">' +
- '<h3>More</h3>' + isnull(@temp, '') +
- '</div>')
- end
- set @res = @t
- END
- --ru 26.09.2021 12:36:39
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement