forum link on top menu

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 năm cách đây
I wanna have a link to forums on Top menu. How can I create it?
Any response is appreciated in advance. Sorry to be a newbie!
8 năm cách đây
open views/catalog/topmenu.cshtml

add the following


@if (Model.ForumEnabled)
        {
            <li><a href="@Url.RouteUrl("Boards")">@T("Forum.Forums")</a></li>
        }


after the:

@foreach (var topic in Model.Topics)
    {
        <li><a href="@Url.RouteUrl("Topic", new { SeName = topic.SeName })">@topic.Name</a></li>
    }


should look like that


<ul class="top-menu">
    @Html.Widget("header_menu_before")
    @{
        var rootCategories = Model.Categories.Where(x => x.IncludeInTopMenu).ToList();
    }
    @foreach (var category in rootCategories)
    {
        @RenderCategoryLine(category, 0, false)
    }
    @foreach (var topic in Model.Topics)
    {
        <li><a href="@Url.RouteUrl("Topic", new { SeName = topic.SeName })">@topic.Name</a></li>
    }
@if (Model.ForumEnabled)
        {
            <li><a href="@Url.RouteUrl("Boards")">@T("Forum.Forums")</a></li>
        }
    @if (rootCategories.Count == 0 && Model.Topics.Count == 0)
    {
        //no categories or topis to display? in this case let's diplay some default menu items (should we?)
        <li><a href="@Url.RouteUrl("HomePage")">@T("HomePage")</a></li>
        if (Model.RecentlyAddedAffiliatesEnabled)
        {
            <li><a href="@Url.RouteUrl("RecentlyAddedAffiliates")">@T("Affiliates.NewAffiliates")</a>
            </li>
        }
        <li><a href="@Url.RouteUrl("AffiliateSearch")">@T("Search")</a></li>
        <li><a href="@Url.RouteUrl("CustomerInfo")">@T("Account.MyAccount")</a></li>
        if (Model.BlogEnabled)
        {
            <li><a href="@Url.RouteUrl("Blog")">@T("Blog")</a></li>
        }
        if (Model.ForumEnabled)
        {
            <li><a href="@Url.RouteUrl("Boards")">@T("Forum.Forums")</a></li>
        }
        <li><a href="@Url.RouteUrl("ContactUs")">@T("ContactUs")</a></li>
    }
    @Html.Widget("header_menu_after")
</ul>

8 năm cách đây
Go to Admin panel

Configuration -> Settings -> Forum Settings

Set the Forums enabled setting to true

On Menu binding there is one check that if category and topic is showing on menu then it will not show forum so if you want to show even that then you have to add below code in below file.

But on Views\Catalog\TopMenu.cshtml

Add below code just above the @Html.Widget("mob_header_menu_after") line


@if (Model.ForumEnabled)
        {
        <li><a href="@Url.RouteUrl("Boards")">@T("Forum.Forums")</a></li>
        }
7 năm cách đây
How would this apply to Contact Us?

I'm having trouble understanding how I can input the Forum and Contact Us forum in the corresponding Topics (Pages)
7 năm cách đây
JoeyAK wrote:
How would this apply to Contact Us?

I'm having trouble understanding how I can input the Forum and Contact Us forum in the corresponding Topics (Pages)


Could you please explain in detail what exactly are you trying to accomplish in regard to forums and contact us page?
7 năm cách đây
I'd like to do the same as OP but for Contact Us page
7 năm cách đây
JoeyAK wrote:
I'd like to do the same as OP but for Contact Us page



Go to: Nop.Web/Views/Catalog/TopMenu.cshtml


Add this:

<a href="@Url.RouteUrl("ContactUs")">@T("ContactUs")</a>



You may find this helpful: http://www.strivingprogrammers.com/How-to-keep-the-homepage-menu-tabs-same-even-after-adding-categories
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.