我目前在一个使用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="仅替换为文本?
任何帮助都将不胜感激。。。
Stu
这是整个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">© <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>
Neil,回答你的问题-
<%@ 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的使用。。。心理
如果将项目更改为:会发生什么
<Rcp:TopNavItem runat="server" Filter="default.aspx" HRef="" Alt="Home" Width="57">Text here</Rcp:TopNavItem>
如果没有,文件顶部是否有一个设置rcp命名空间的部分,可以提供它是什么系统的线索,以便您可以在谷歌上搜索它?
<%@ Control Language="C#" Inherits="Propeller.Web.NavItem, Propeller.Web" %>
<%if (!ShowOnState)
{
%><a href="<%=Root %>/<%=HRef %>"><%=Alt %></a><%
}
else
{
%><a href="<%=Root %>/<%=HRef %>"><%=Alt %></a><%
}%>
可能有点暴躁。但这应该有望实现。
您可以尝试在自己的服务器控件中从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);
}
}
在.master文件delete中,用src="pageName"替换任何src="pageName.gif"。
在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><%
}%>