简体   繁体   English

像stackoverflow一样在umbraco 4.11中进行标记

[英]tagging in umbraco 4.11 just like stackoverflow

im using snipper tag system and following below article: 即时通讯使用snipper标签系统和以下文章:

http://daniel.streefkerkonline.com/tag/umbraco/ http://daniel.streefkerkonline.com/tag/umbraco/

i can install and use snipper tag system successfully. 我可以成功安装和使用狙击手标签系统。 but when i browse the page..tags appear as text and not hyper link... 但是当我浏览页面时..tags显示为文本而不是超链接...

Am i'm missing something. 我在想什么吗? IS it some javascript file or im missing some step to include tags? 是一些javascript文件,还是缺少标记的步骤?

Any ideas? 有任何想法吗? here is my page: http://www.leezardpharma.com/pharmacy/our-products/weight-loss-medicine/gastro1.aspx 这是我的页面: http : //www.leezardpharma.com/pharmacy/our-products/weight-loss-medicine/gastro1.aspx

here relevant tags are coming becuase of snipper ..but they arent clickable. 在这里,相关的标签是由于抢夺者而来的..但它们没有可点击的。

If you need to create tags as link with option to display the products which are tagged then you can create new page called ../search.aspx?tag=tagname and then search for the products which are in that TAG, code is as below: 如果您需要创建标签作为带有选项的链接来显示被标签的产品,则可以创建一个名为../search.aspx?tag=tagname的新页面,然后搜索该标签中的产品,代码如下:

@inherits umbraco.MacroEngines.DynamicNodeContext
@using System.Text
@using umbraco.MacroEngines
@using umbraco.cms.businesslogic.Tags

@{   
    string searchFor = Request["tags"];

    if(string.IsNullOrEmpty(searchFor))
    {
        @* No tags were specified *@ 
        <p>Please specify a tag to search for</p>
        return;
    }

    // this is to search from the tags added and then get all the nodes
    var matchingNodes = Tag.GetNodesWithTags(searchFor).ToList();

    string tagsText = searchFor.Split(',').Count() > 1 ? "tags" : "tag";

    if (matchingNodes.Count < 1)
    {
       @* No results were found for the specified tags *@ 
       <p>No tagged items were found that matched the @tagsText: @searchFor</p>
       return;        
    }

     @* Some results were found for the specified tags *@ 
     <p><strong>@matchingNodes.Count</strong> products were found that matched the @tagsText: "@searchFor"</p>

      <ul>

      // go through the code and create URL for that product
      @foreach (var node in matchingNodes)
      {
        dynamic dn = new DynamicNode(node.Id);

        <li><a href="@dn.Url">@dn.Name</a></li>
      }
      </ul>
}

you can refer to this article as I have checked it click here and half way down you will see this code 您可以参考本文,因为我已经对其进行了检查, 请单击此处然后在一半的位置,您将看到此代码

Let me know any more explanation need. 让我知道更多的解释需要。 I have commented this so that you can get briefing of the code. 我对此进行了评论,以便您可以简要了解代码。

You sure you're doing this? 您确定要这样做吗?

<ul>
  @foreach (var node in matchingNodes)
  {
    dynamic dn = new DynamicNode(node.Id);

    <li><a href="@dn.Url">@dn.Name</a></li>
  }
</ul>

Something doesn't look right here, where you're displaying your tags: 在此处显示标签的地方看起来不正确: 在此处输入图片说明

Where are those two links coming from? 这两个链接来自哪里?

There's no javascript or anything fancy needed. 没有javascript或任何花哨的东西。 This is all done in razor on the server-side. 这些都是在服务器端以剃刀完成的。

I wrote the sniper tagging control. 我写了狙击标记控件。

If you want friendly URLs for the tags, Create a rewrite rule to map /tags/([\\w]*) rewrite to tagsearch.aspx?tag=$1 Then implement tagsearch.aspx to take that tag parameter and return any pages containing it as explained above. 如果您想要标记的友好URL,请创建一个重写规则以将/ tags /([[w] *)重写映射到tagsearch.aspx?tag = $ 1,然后实现tagsearch.aspx以获取该标记参数并返回包含该标记参数的所有页面。如上所述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM