TYPO3自定义菜单元素

时间:2016-10-12 11:01:24

标签: typo3 typoscript fluid typo3-7.6.x

我试图在Page TSConfig中使用它来创建一个自定义菜单元素:

TCEFORM.tt_content {
    menu_type.addItems.101 = My Menu
}

这在安装程序中:

temp.my_menu = HMENU
temp.my_menu {
  special = list
  special.value.field = pages 
  1 = TMENU
  1 {
    wrap = <ul> | </ul>
    NO = 1
    NO.wrapItemAndSub = <li>|</li>
  }
}
tt_content.menu.20.101 < temp.my_menu

但我得'哎呀,发生错误!'菜单应该在哪里。 如果我在模板中删除Fluid包含但随后所有其他内容元素都会出错,它将呈现正常。

有没有办法在流体样式的内容的同时有一个typoscript菜单元素?

或者,如果我真的需要,如何添加自定义流体菜单模板?

2 个答案:

答案 0 :(得分:0)

您需要将复制操作的行向下移动到底部,否则不会复制配置,因为它还没有复制。

异常发生,因为菜单没有渲染定义(因为你从未复制过配置)。

要查看真实错误而不是异常,请切换到安装工具中的开发预设或将以下行添加到TS设置中:

"   at Microsoft.ServiceFabric.Services.Communication.FabricTransport.Common.NativeServiceCommunication.CreateServiceCommunicationClient(Guid& iid, IntPtr transportSettingsPtr, IntPtr connectionAddress, IFabricCommunicationMessageHandler notificationHandler, IFabricServiceConnectionEventHandler connectionEventHandler)\r\n   at Microsoft.ServiceFabric.Services.Communication.FabricTransport.Client.NativeServiceCommunicationClient.CreateNativeClient(FabricTransportSettings transportSettings, String connectionAddress, NativeClientConnectionEventHandler eventHandler, IServiceRemotingCallbackClient contract)\r\n   at Microsoft.ServiceFabric.Services.Communication.FabricTransport.Client.NativeServiceCommunicationClient.<>c__DisplayClass2.<.ctor>b__0()\r\n   at System.Fabric.Interop.Utility.<>c__DisplayClass13.<WrapNativeSyncInvoke>b__12()\r\n   at System.Fabric.Interop.Utility.WrapNativeSyncInvoke[TResult](Func`1 func, String functionTag, String functionArgs)\r\n   at System.Fabric.Interop.Utility.RunInMTA(Action action)\r\n   at Microsoft.ServiceFabric.Services.Communication.FabricTransport.Client.FabricTransportServiceRemotingClientFactoryImpl.CreateClientAsync(String endpoint, CancellationToken cancellationToken)\r\n   at Microsoft.ServiceFabric.Services.Communication.Client.CommunicationClientFactoryBase`1.<CreateClientWithRetriesAsync>d__16.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.ServiceFabric.Services.Communication.Client.CommunicationClientFactoryBase`1.<GetClientAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.ServiceFabric.Services.Communication.Client.CommunicationClientFactoryBase`1.<GetClientAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.ServiceFabric.Services.Remoting.FabricTransport.Client.FabricTransportServiceRemotingClientFactory.<Microsoft.ServiceFabric.Services.Communication.Client.ICommunicationClientFactory<Microsoft.ServiceFabric.Services.Remoting.Client.IServiceRemotingClient>.GetClientAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient`1.<GetCommunicationClient>d__22.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient`1.<InvokeWithRetryAsync>d__7`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.ServiceFabric.Services.Remoting.Client.ServiceRemotingPartitionClient.<InvokeAsync>d__8.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.<InvokeAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.<ContinueWithResult>d__7`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at VotingService.VotingService.<ProcessRequestAsync>d__4.MoveNext() in C:\\Users\\mlani\\Develop\\ServiceFabricVoting\\VotingService\\VotingService.cs:line 148"

答案 1 :(得分:0)

我注意到了这一点:

TCEFORM.tt_content {
    menu_type.addItems.101 = My Menu
}

据我所知应该是这样的:

TCEFORM.tt_content.menu_type {
   types {
      menu{
         addItems {
            101 = My Menu
         }
      }
   }
}

我不得不调整&#39;特殊菜单(错字3 7.6),这工作: Add special menu and add class="active" in TYPO3