2

先生们,

我在同一页面上有一个很好的 SINGLE 和 Latest 的工作实现。我的真实网址运行良好。问题是,默认情况下,在您单击列出的新闻之一(由列表插件显示)之前,single 不会显示任何内容。我希望单个插件显示登陆的最新消息。

有任何想法吗?

4

4 回答 4

1

第一个解决方案

tt_news 手册中描述了请求行为的解决方案:

默认新闻 ID

如果没有请求其他记录的 SINGLE 视图,则将以下行插入到要在 SINGLE 视图中显示最新新闻项目的页面的 ext-template 的设置字段中:

# hide the "no news id" message
plugin.tt_news._LOCAL_LANG.default.noNewsIdMsg =  
# set the tt_news singlePid to the current page
plugin.tt_news.singlePid = 977

# fill the content of the main-column to a tmp.object
tmp.pagecontent < page.10.subparts.contentarea

# clear the content of the main column
page.10.subparts.contentarea >

# build a new object for this column as content-object-array
page.10.subparts.contentarea = COA
page.10.subparts.contentarea {
  10 = CONTENT
  10.table = tt_news
  10.select {
# insert the pids of all pages from where you want to fetch news.
# the recursive-field has no influence on this selection
    pidInList = 1078,1079,1080,1081,1082,1083,1084
    orderBy = datetime desc
    max = 1
  }
# insert the object “10.” only if there is no SINGLE news selected
# ATTENTION, OUTDATED IN MANUAL, USE GP:... instead of GPvar:... !!!
  #10.stdWrap.if.isFalse.data = GPvar:tx_ttnews|tt_news
  10.stdWrap.if.isFalse.data = GP:tx_ttnews|tt_news
# re-insert the normal pagecontent to the page
  20 < tmp.pagecontent
}

此示例中的页面包含 2 列。新闻列表位于左栏中。主列(page.10.subparts.contentarea)包含一个单一的新闻内容元素。


第二个解决方案——我最喜欢的

我个人最喜欢解决这个问题的方法更巧妙一些。它利用 noNewsIdMsg(在上述解决方案中简单地清空)并使用其 stdWrap 版本准确显示通常何时出现“无新闻 ID”消息的最新记录。

# use the "no news id" message position for the latest news record
plugin.tt_news.singlePid = 977
plugin.tt_news.noNewsIdMsg_stdWrap.cObject = COA
plugin.tt_news.noNewsIdMsg_stdWrap.cObject {
  10 = CONTENT
  10.table = tt_news
  10.select {
    # insert the pids of all pages from where you want to fetch news.
    # the recursive-field has no influence on this selection
    pidInList = 1078,1079,1080,1081,1082,1083,1084
    orderBy = datetime desc
    max = 1
  }
}

请注意,在这两种解决方案中,用于插入默认记录的模板子部分不是###TEMPLATE_SINGLE###,而是###TEMPLATE_SINGLE_RECORDINSERT###。

于 2015-08-10T13:41:18.243 回答
0

为什么不使用“单个/最新”视图显示单个视图(如果已提交)和最新的(如果没有请求单个视图)。在此插件中,将最新的新闻限制设置为“1”。

下面添加另一个最新(或列表),新闻限制设置为 3(或根据需要)

于 2013-02-19T17:46:21.953 回答
0

安全单一新闻扩展

添加了一个新的 tt_news 代码:SAFE_SINGLE,它确保即使未指定任何新闻文章也会显示单个新闻文章。如果选择了一篇新闻文章,它将简单地显示它。如果没有选择,它将显示配置类别的最新新闻文章。

也许它可以帮助你。

于 2013-02-18T04:35:49.163 回答
0

一种解决方案是更改该特定新闻插件中最新视图的文本限制,如下所示:

plugin.tt_news.displayLatest.subheader_stdWrap.crop = 10000 | ... | 1

并且还提供了一个单独的模板文件,没有

<!--###LINK_ITEM###-->

最新视图部分中的标记。

于 2013-02-18T04:23:25.360 回答