0

我目前正在使用 ASP 的网站上工作,我认为这是一个“自定义”CMS。

我在一个名为 Rcp.Master 的文件中有这个导航 -

<div id="nav">
    <Rcp:TopNavItem runat="server" Filter="default.aspx" HRef="" Alt="Home" Src="home.gif" Width="57" />
    <Rcp:TopNavItem ID="TopNavItem1" runat="server" Filter="about-us/*" HRef="about-us/" Alt="About Us" Src="about.gif" Width="79" />
    <Rcp:TopNavItem ID="TopNavItem2" runat="server" Filter="our-investments/*" HRef="our-investments/" Alt="Our Investments" Src="investments.gif" Width="123" />
    <Rcp:TopNavItem ID="TopNavItem3" runat="server" Filter="team/*" HRef="team/" Alt="Our Team" Src="team.gif" Width="78" />
    <Rcp:TopNavItem ID="TopNavItem4" runat="server" Filter="work/*" HRef="work/" Alt="Work with us" Src="work.gif" Width="108" />
    <Rcp:TopNavItem ID="TopNavItem5" runat="server" Filter="news/*" HRef="news/" Alt="News" Src="news.gif" Width="56" />
    <Rcp:TopNavItem ID="TopNavItem6" runat="server" Filter="comment/*" HRef="comment/" Alt="Comment" Src="comment.gif" Width="83" />
    <Rcp:TopNavItem ID="TopNavItem7" runat="server" Filter="contact-us.aspx" HRef="contact-us.aspx" Alt="Contact Us" Src="contact.gif" Width="68" />
</div>

目前它显示它使用图像而不是实际文本进行导航。我想使用“实际文本”,所以它更像是这样 -

<div id="nav">>
  <ul>
    <li><a href="../index.html">Home</a></li>
    <li><a href="../about-us/index.html">About us</a></li>
    <li><a href="../our-investments/index.html">Our investments</a></li>
    <li><a href="../team/index.html">The team</a></li>
    <li><a href="../work/index.html">Work with us</a></li>
    <li><a href="../news/index.html">News</a></li>
    <li><a href="../comment/index.html">Comment</a></li>
    <li><a href="../contact-us.aspx.html">Contact Us</a></li>
  </ul>
</div>

如何以及在哪里可以仅用文本替换 src="" ?

任何帮助将不胜感激...

斯图

这是'整个' rcp.master -

        <%@ Master Language="C#" Inherits="Clear.Rcp.Www.RcpMaster, Clear.Rcp.Www" %>
        <%@ Register Src="~/Controls/TopNavItem.ascx" TagPrefix="Rcp" TagName="TopNavItem" %>

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>R</title>
        <link href="<%=Root%>/css/rcp.css"  rel="stylesheet" type="text/css" media="screen" />
        <script src="<%=Root%>/js/jquery-1.4.2.min.js" language="JavaScript" type="text/javascript"></script>
        <script src="<%=Root%>/js/jquery.imghover-1.1rc.js" language="JavaScript"     type="text/javascript"></script>
        <script src="<%=Root%>/js/rcp.js" language="JavaScript" type="text/javascript"></script>

        <asp:ContentPlaceHolder runat="server" ID="PageHeader" />
    </head>

    <body><%=Root%>
    <div id="header">
    <div id="logo"><a href="/"><img src="<%=Root%>/i/logo.gif" alt="" /></a></div>
    <div id="nav">
        <Rcp:TopNavItem runat="server" Filter="default.aspx" HRef="" Alt="Home" Src="home.gif" Width="57" />
        <Rcp:TopNavItem ID="TopNavItem1" runat="server" Filter="about-us/*" HRef="about-us/" Alt="About Us" Src="about.gif" Width="79" />
        <Rcp:TopNavItem ID="TopNavItem2" runat="server" Filter="our-investments/*" HRef="our-investments/" Alt="Our Investments" Src="investments.gif" Width="123" />
        <Rcp:TopNavItem ID="TopNavItem3" runat="server" Filter="team/*" HRef="team/" Alt="Our Team" Src="team.gif" Width="78" />
        <Rcp:TopNavItem ID="TopNavItem4" runat="server" Filter="work/*" HRef="work/" Alt="Work with us" Src="work.gif" Width="108" />
        <Rcp:TopNavItem ID="TopNavItem5" runat="server" Filter="news/*" HRef="news/" Alt="News" Src="news.gif" Width="56" />
        <Rcp:TopNavItem ID="TopNavItem6" runat="server" Filter="comment/*" HRef="comment/" Alt="Comment" Src="comment.gif" Width="83" />
<Rcp:TopNavItem ID="TopNavItem7" runat="server" Filter="contact-us.aspx" HRef="contact-us.aspx" Alt="Contact Us" Src="contact.gif" Width="68" />

</div>
</div>
    <asp:ContentPlaceHolder ID="PageContent" runat="server" />
    <div id="footer">&copy; <a href="<%=Root%>/terms.aspx">Terms of use and disclaimer</a>
    </div>
    <script type="text/javascript">

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-18033471-1']);
        _gaq.push(['_trackPageview']);

        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();

    </script>
    </body>
    </html>

尼尔,回答你的问题——

<%@ Control Language="C#" Inherits="Propeller.Web.NavItem, Propeller.Web" %>
<%if (!ShowOnState)
  {
    %><a href="<%=Root %>/<%=HRef %>"><img src="<%=Root%>/i/nav/<%=Src %>" alt="<%=Alt %>" class="hover" /></a><%
}
  else
  {      
%><a href="<%=Root %>/<%=HRef %>"><img src="<%=Root%>/i/nav/on/<%=Src %>" alt="<%=Alt %>" /></a><%
  }%>

至于是否需要。这个网站是相当克雷。硬编码加上 CMS 的使用...心理

4

4 回答 4

0

如果您将项目更改为:

<Rcp:TopNavItem runat="server" Filter="default.aspx" HRef="" Alt="Home" Width="57">Text here</Rcp:TopNavItem>

如果没有,文件顶部是否有一些设置 rcp 名称空间的内容,可能会提供有关它是什么系统的线索,以便您可以使用谷歌搜索它?

于 2013-12-18T08:46:27.507 回答
0

在 .master 文件中,将任何 src="pageName.gif" 替换为 src="pageName"。

在 TopNav 文件中替换那里的内容

<%@ Control Language="C#" Inherits="Propeller.Web.NavItem, Propeller.Web" %>
  <%if (!ShowOnState)
    {
      %><a class="hover" href="<%=Root %>/<%=HRef %>"><%=Src %></a><%
    }
  else
    {      
      %><a href="<%=Root %>/<%=HRef %>"><%=Src %></a><%
    }%>
于 2013-12-18T09:23:56.353 回答
0
<%@ Control Language="C#" Inherits="Propeller.Web.NavItem, Propeller.Web" %>
<%if (!ShowOnState)
  {
    %><a href="<%=Root %>/<%=HRef %>"><%=Alt %></a><%
}
  else
  {      
%><a href="<%=Root %>/<%=HRef %>"><%=Alt %></a><%
  }%>

可能有点hacky。但这应该有望做到。

于 2013-12-18T09:20:40.503 回答
0

TopNavItem您可以尝试从您自己的服务器控件中继承。然后重写该OnPreRender方法并修改Controls集合。

public class CustomNavItem : TopNavItem {
    protected override void OnPreRender(EventArgs e) {
        base.OnPreRender(e);

        // find ImageCtrl by examining Controls in debug session
        Controls.Remove(ImageCtrl);

        HyperLink link = new HyperLink();
        link.NavigateUrl = this.Href;
        link.ToolTip = this.Alt;

        Controls.Add(link);
    }
}
于 2013-12-18T09:21:12.673 回答