using a page as a menu item

Topics: Themes
Feb 21, 2011 at 1:43 PM
I think it's fairly common for Blogs to have a few static pages in their main menu. I wanted an 'About' page in my main menu.
In this excerpt from site.master I have added an ‘About’ page. I created a page called about using the Administration pages 
add new page. Then added a link to it in site.master. It displays like the other menu items and works as desired. In this 
context what are Resources.labels? Should I create one for the about page? If so where/how? 
                <li><a class="home" href="<%=Utils.AbsoluteWebRoot %>" rel="home"><%=Resources.labels.home %></a></li>
                <li><a href="<%=Utils.AbsoluteWebRoot %>archive.aspx"><%=Resources.labels.archive %></a></li>
                <li><a href="<%=Utils.AbsoluteWebRoot %>contact.aspx"><%=Resources.labels.contact %></a></li>
                <li><a href="<%=Utils.AbsoluteWebRoot %>search.aspx"><%=Resources.labels.search %></a></li>      
                <li><a href="<%=Utils.AbsoluteWebRoot %>page/About.aspx">About</a></li>      
In the Administration pages add new page dialogue there is an option to ‘select parent’ and a check box ‘is front page’ 
It might make a useful addition to blogengine to also have a check box something like ‘is menu item’ or have menu as a 
parent item in the select parent dialouge. That way there would be a possibility that a page could be a menu item without 
editing site.master in each theme. Allowing the site theme to be changed and keeping the menu intact through theme changes.
Feb 22, 2011 at 4:13 AM
Edited Oct 24, 2011 at 7:21 PM

I made a custom solution to this check this post out:

PageLinkMenu gives the user full control over their pages. It adds 4 new elements to the page xml file. Page Name, Link Name, Link Menu, and Page Sort.

http://www.kbdavis07.bloggersonline.com/post/2010/11/13/Welcome-to-BlogEngineNET-2-0.aspx

 

It is also a fork pending being added to BE .

 

http://blogengine.codeplex.com/SourceControl/network/Forks/kbdavis07/PageLinkMenu2point0#

 

You can view it live here: http://www.kbdavis07.bloggersonline.com

 

All of the pages on there are pages and using the PageLinkMenu.  

 

No hard coding any links in the master page.

 

Your question: 

what are Resources.labels? 

The labels are for international support in languages. Easier to just translate the resources than going through each
page and etc.

___________________________________________________________________________________________________________________________________________________

 

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="site.master.cs" Inherits="StandardSite" %>
<%@ Import Namespace="BlogEngine.Core" %>

<!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" xml:lang="en" lang="en">
<head runat="server" profile="http://gmpg.org/xfn/11">
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="shortcut icon" href="~/pics/blogengine.ico" type="image/x-icon"/>
</head>
<body>

<div id="header">
<p><a href="<%=Utils.AbsoluteWebRoot %>"><%=BlogSettings.Instance.Name %></a></p>
<span><%=BlogSettings.Instance.Description %></span>
</div>

<div id="menu">

<div class="login">
<span runat="server" id="aUser"></span><a runat="server" id="aLogin" />
</div>

<ul>
<li><a href="<%=Utils.AbsoluteWebRoot %>" rel="home"><%=Resources.labels.home %></a></li>
<li><a href="<%=Utils.AbsoluteWebRoot %>archive.aspx"><%=Resources.labels.archive %></a></li>
<li><a href="<%=Utils.AbsoluteWebRoot %>contact.aspx"><%=Resources.labels.contact %></a></li>
<li><blog:LinkMenu ID="LinkMenu1" runat="Server" Filter="Header" /></li>
<li><a href="<%=Utils.FeedUrl %>" class="feed"><img src="<%=Utils.AbsoluteWebRoot %>pics/rssButton.png" alt="Feed" />
<%=
Resources.labels.subscribe %></a></li>
<li><a href="javascript:void(BlogEngine.filterByAPML())" class="apmlfilter"><%=Resources.labels.filterByApml %></a></li>
</ul>
</div>

<form runat="Server" class="body">

<div id="content">
<blog:SearchOnSearch runat="server" MaxResults="3" Headline="You searched for"
Text="Here are some results for the search term on this website" />
<asp:ContentPlaceHolder ID="cphBody" runat="server" />

<p id="footer">
Powered by <a href="http://www.dotnetblogengine.net">BlogEngine.NET</a> <%=BlogSettings.Instance.Version() %><br />
Theme by <a href="http://madskristensen.net">Mads Kristensen</a>
</p>
</div>

<div id="sidepanel">
<blog:WidgetZone runat="server" ZoneName="be_WIDGET_ZONE" />
</div>

</form>

</body>
</html>

Java Blog

Apr 21, 2011 at 3:35 PM
Edited Apr 21, 2011 at 8:39 PM

Hi,

Just as the person from the original post I would like to add items to the menu.

I just started with BE (have 2.0 installed) after struggling with WP, but I am uncertain as to what to do with the code you show here.
Could you please explain what steps somebody needs to take to make this work the way you show here?

I do have MS Visual Studio 2010 so if I need to do anything with the code you show here any steps to take would be appreciated.

Thanks in advance, looking forward to your answer,

Boudewijn Lutgerink.

Coordinator
Apr 21, 2011 at 10:11 PM

With 2.0, you can add anywhere in your theme:

<blog:PageMenu ID="PageMenu1" runat="Server" />

BE will generate nested unordered list that you can use as a menu. Details are here, but now it is in the core and no need to download anything.

Apr 22, 2011 at 7:16 AM
Edited Apr 22, 2011 at 12:01 PM

Thanks very much for a quick reply. That is much appreciated.
I tested it but this is not quite what I want. I really want a menu to appear as shown by kbdavis07.
Hence my question to him how to implement the code he shows.
I tested this code but I am missing something. The extra options do not appear when I add a new page.

Also I get a web.config error

BL

 

Apr 22, 2011 at 7:38 PM

When you download from the source you got to rebuild it before you upload to server.

 

In Visual Web Dev  do Build --> Rebuild Core

 

That makes a new .dll files for you.

 

Now upload to server.

Apr 24, 2011 at 4:52 AM
Edited Apr 24, 2011 at 9:09 AM

Opened the project. Trying to rebuild it as you adviced. What I got are 9 errors and 5 warnings.

This not going to be as easy as suggested, I'm afraid.

I saw on StackExchange that you have a web deployable version ready. Could I have that as well please?
FYI, I am not very good in C# or any other .Net language, I want to set up quite a few sites asap and I do not have time or desire to go deep into the technique.

Maybe at a later stage I will, but I now have other priorities. So if you could send me the deployable version I would greatly appreciate that.

TIA.

BL

Apr 24, 2011 at 5:52 PM

 

Web source is here:

http://www.kbdavis07.bloggersonline.com/d/PageLinkMenu2.0Web.zip

 

Just unzip and upload to server thats it!

 

Tested it again no errors.

 

If you have any more questions please ask.

Apr 24, 2011 at 9:09 PM

You're my hero. It works like a charm. The only adjustment I needed to make was to use the asp.net 4 web.config, but that was a no-brainer.

Thanks VERY much from the Netherlands, happy easter Holidays.

 

BL

Apr 24, 2011 at 9:30 PM

Glad I could help :)

Apr 24, 2011 at 9:32 PM

What is your website where this is being used?  I will like to look at it if you don't mind :)

Apr 24, 2011 at 10:01 PM

Will send you some links later. I am now gonna hit the sack. (close to mid night in Holland).

FYI, I am gonna use BE for Affiliate marketing sites and I needed a way to handle related keywords and subjects.

Now I can give it a go. Your solution is THE most elegant I came across.

I can use this on many sites. Talk about that later.

With the ease of use of BE, I wonder why so many people still use WordPress.

Again, thank you VERY much for your fast response and co-operation.

BL

From: kbdavis07 [email removed]
Sent: zondag 24 april 2011 23:32
To: b.lutgerink@betuwe.net
Subject: Re: using a page as a menu item [blogengine:246913]

From: kbdavis07

What is your website where this is being used? I will like to look at it if you don't mind :)