gpt4 book ai didi

macros - 加载宏引擎脚本时出错(文件 : LawyerProfileView. cshtml)

转载 作者:行者123 更新时间:2023-12-05 00:26:57 35 4
gpt4 key购买 nike

在现场工作时,我接到了一些宏,突然开始播放。宏现在工作正常,突然出现这个错误,任何人都可以帮助这里是代码。

@using umbraco.MacroEngines
@inherits umbraco.MacroEngines.DynamicNodeContext
@functions{

public void SetPageTitle(string title)
{
var page = HttpContext.Current.Handler as Page;
if (page != null){
page.Title = title;
}
}

public DynamicNode Homepage
{
get {
var homepage = Model;
while(homepage.NodeTypeAlias != "Homepage"){
homepage = homepage.Parent;
}

return homepage;
}
}

public HtmlString GetSocialMediaLink(string network, string url, string name)
{
var socialMediaRepo = Library.NodeById(-1).DescendantsOrSelf("SocialMediaNetworkRepository").First();
var socialNetworks = new List<DynamicNode>();
if (socialMediaRepo != null)
{
foreach (var child in socialMediaRepo.Children)
{
if(child.NodeTypeAlias.ToLower().Equals(network.ToLower())){
var icon = child.HasValue("CssClass") ? String.Format("<i class=\"{0}\"></i>", child.CssClass) : String.Format("<img src=\"/imagegen.ashx?altimage=/images/assets/clear.gif&image={0}\" alt=\"{1}\"/>", child.Icon, child.Name);
return new HtmlString(String.Format("<a target=\"_blank\" rel=\"no-follow\" href=\"{0}\" title=\"{3} on {1}\">{2}</a>", url, child.Name, icon, name) );
}
socialNetworks.Add(child);
}
}
return new HtmlString("");
}

}
@{
if (String.IsNullOrEmpty(Request["name"])){
return;
}
var profileId = Request["name"].Replace("-", " ").Replace("/", "");

var lawyersRepository = Library.NodeById(1316);
var isIntranet = Homepage.Name.IndexOf("intranet", StringComparison.OrdinalIgnoreCase) > -1;
var nodes = isIntranet ? lawyersRepository.Children.Where("Name.ToLower() = \"" + profileId.ToLower() + "\"") : lawyersRepository.Children.Where("!ProfileIsPrivate && Name.ToLower() = \"" + profileId.ToLower() + "\"");
if(!nodes.Any()){
return;
}
var node = nodes.First();
if (node == null || node.NodeTypeAlias != "LawyerRepositoryItem"){
return;
}

if (node.ProfileIsPrivate && !isIntranet){
return;
}

PageData["PageTitle"] = Model.Name + " - " + node.Name;

SetPageTitle(Model.Name + " - " + node.Name);
var hasContactInfo = (!String.IsNullOrEmpty(node.TelephoneNumber) || !String.IsNullOrEmpty(node.EmailAddress) || !String.IsNullOrEmpty(node.OfficeLocation));
<div class="profile">
<div class="row">
<div class="span4 profile-content">
<h1>@node.Name</h1>
<h3>@node.JobTitle</h3>
@Html.Raw(node.Biography.ToString())
</div>
<div class="span2">
<div class="profile-picture">
@{
if (!node.HasValue("ProfilePictureSquare")){
<img src="/imagegen.ashx?altimage=/images/assets/clear.gif&image=@Library.MediaById(node.ProfilePicture).umbracoFile" alt="@node.Name" />
}
else{
<img src="/imagegen.ashx?altimage=/images/assets/clear.gif&image=@Library.MediaById(node.ProfilePictureSquare).umbracoFile" alt="@node.Name" />
}
}

</div>
<div class="profile-quote">
<!--Tesimonial-->
@RenderPage("~/macroScripts/Widgets/Widget_RandomTestimonial.cshtml", @node.Id.ToString())
</div>
</div>
@if (hasContactInfo)
{
<div class="contact-information">
<div class="pull-left contact-details">
<h4>@Dictionary.ContactInformationHeading</h4>
<dl class="">
@{
if (node.HasValue("TelephoneNumber"))
{
<dd><strong>@Dictionary.Label_TelephoneShort:</strong> @node.TelephoneNumber</dd>
}
if (node.HasValue("EmailAddress"))
{
<dd><strong>@Dictionary.Label_EmailShort:</strong> <a href="mailto:@node.EmailAddress?subject=@Dictionary.DefaultEmailSubjectLine">@node.EmailAddress</a></dd>
}
if (node.HasValue("OfficeLocation"))
{
var officeNode = Library.NodeById(node.OfficeLocation);
<dd><strong>@Dictionary.Label_Office:</strong> <a href="@officeNode.NiceUrl" title="@officeNode.Name">@officeNode.Name</a></dd>
}
}
</dl>
</div>
<div class="pull-left contact-vcard">
<h4>
<a href="/vcard.ashx?contact=@node.Id" title="@Dictionary.DownloadVCard"><i class="t-icon-vcard"></i> <span>@Dictionary.DownloadVCard</span></a></h4>
</div>
</div>
}
@{
var hasSocialMediaUrls = node.HasValue("FacebookUrl") || node.HasValue("TwitterUrl") || node.HasValue("LinkedInUrl") || node.HasValue("YouTubeUrl") || node.HasValue("BlogUrl");
if (hasSocialMediaUrls)
{
<div class="profile-social-links social-links">

<ul class="unstyled">
<li><strong>@Dictionary.Connect</strong></li>
@if (node.HasValue("FacebookUrl"))
{
<li>@GetSocialMediaLink("facebook", node.FacebookUrl, node.Name)</li>
}
@if (node.HasValue("TwitterUrl"))
{
<li>@GetSocialMediaLink("twitter", node.TwitterUrl, node.Name)</li>
}
@if (node.HasValue("LinkedInUrl"))
{
<li>@GetSocialMediaLink("linkedin", node.LinkedInUrl, node.Name)</li>
}
@if (node.HasValue("YouTubeUrl"))
{
<li>@GetSocialMediaLink("youtube", node.YouTubeUrl, node.Name)</li>
}
@if (node.HasValue("BlogUrl"))
{
<li>@GetSocialMediaLink("blogger", node.BlogUrl, node.Name)</li>
}
</ul>

</div>
}
}
</div>
<div class="gold-bar">
<a href="@Dictionary.SubmitTestimonialLink@Dictionary.SubmitTestimonialLinkParameters.Replace("{Name}", node.Name)">@Dictionary.SubmitTestimonialText</a>
</div>
</div>
}

我尝试从备份文件加载,但问题仍然存在。

最佳答案

您需要找出出现此错误的原因。

如果您在宏中运行并且处于 WebForms 模式,则可以在 url 中添加 ?umbDebugShowTrace=true(或 ?umbDebug=true)。 (首先检查 web.config 中的 umbracoDebugMode appsetting 是否为真)。

如果这不起作用,请检查 App_Data/Logs/文件夹中是否有任何日志文件。您应该在那里看到完整的错误。如果您有旧版本,请同时检查 umbracoLog 数据库表。

关于macros - 加载宏引擎脚本时出错(文件 : LawyerProfileView. cshtml),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21490376/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com