Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

How to change html in the top menu, serach form, etc...

edited July 2012 in Vanilla 2.0 - 2.8

Hello!
I am the newbie to Vanilla and I have the html markup of the forum and need to create the new Vanilla theme. According to the docs, the solution is to create customs.css and edit the needed views. Great, but this is not enought :)
Also I need to change the html markup of the search form, of the top menu and some other elements.
How can I do it? Thanks!

Comments

  • Options
    whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
    edited July 2012

    @antonlemon

    You can make changes to html layout in the default.master.php file in your customtheme/views folder.

    It's explained here: http://vanillaforums.org/docs/themequickstart in Part 2

  • Options

    @whu606

    Thanks for the reply! In the default.master.php I can see only how to add links ($this->Menu->AddLink).
    After
    echo $this->Menu->ToString();
    is called. But there is no way to change the actual html in the menu...

  • Options
    whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    @antonmelon

    Can you say exactly what you are trying to do?

    In what way would you want to change the html of the menu?

  • Options
    edited July 2012

    @whu606

    Current menu output:

    <ul id="Menu"> <li><a href="/forum/dashboard/settings">Панель управления</a></li> <li class=" Highlight"><a href="/forum/discussions">Все темы</a></li> <li><a href="/forum/activity">Актив</a></li> <li><a href="/forum/messages/all">Входящие</a></li> <li class="UserNotifications"><a href="/forum/profile/gaidarovka">gaidarovka</a></li> <li class="NonTab SignOut"><a href="/forum/entry/signout?TransientKey=ERU5Z0XKCHG4">Выйти</a></li> </ul>

    What I need:

    <ul class="subnav subnav-blue clearfix"> <li class="active"><a href="/forum/dashboard/settings">Панель управления</a></li> <li><a href="/forum/discussions">Все темы</a></li> <li><a href="/forum/activity">Актив</a></li> <li><a href="/forum/messages/all">Входящие</a></li> <li><a href="/forum/profile/gaidarovka">gaidarovka</a></li> <li><a href="/forum/entry/signout?TransientKey=ERU5Z0XKCHG4">Выйти</a></li> </ul>

  • Options
    whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    @antonmelon

    Have you tried editing the

    $this->Menu->

    sections in the default.master file?

    You should be able to replace them with the code you want.

  • Options

    @whu606

    Yes, the only metod I see is the AddLink, and there is no problem to make links. Then ToString() is applied. But ToString() method generates the shown output, and I need to change the ul class and li active class.

  • Options
    whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    @antonmelon

    But if you replace the

    $this->Menu->

    sections with your own code, you won't need the To String call, will you?

    I haven't tried to do this myself, so maybe it is not right.

    If not, I am sure someone else will offer the correct solution.

  • Options
    HalfCatHalfCat ✭✭
    edited July 2012

    whu606 said:
    But if you replace the

    $this->Menu->

    sections with your own code, you won't need the To String call, will you?

    I haven't tried to do this myself, so maybe it is not right.

    If not, I am sure someone else will offer the correct solution.

    No, this is not correct as the links are dynamically generated based on the user's roles etc.
    E.g. the dashboard link should not be shown to normal users and the sign-out link has to contain the transitKey that is different for every user.

    If I'm not mistaken, you want these changes to be able to customize your styling? If that is the case, it would be more appropriate to change the css, rather than changing the "html" as you call it.

  • Options

    are you looking to make submenus? put them in groups.

    http://vanillaforums.org/discussion/comment/162523/#Comment_162523

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    edited July 2012

    @HalfCat, @peregrine

    In case of the top menu I need to change:
    1) the container's ul id to class;
    2) the active class for the li from "Highlight" to "active".

    Yes, theoretically it can be done via CSS, but the work is done - the HTML markup is ready.
    Moreover, if there is no way to add "clearfix" class for the container and other elements, the HTML markup need to be done again according to the Vanilla requirements. And in this case, I need to use another forum :(

  • Options
    peregrineperegrine MVP
    edited July 2012

    Do yourself a favor and download some other themes, if you don't know how to do what you need to do. Obviously other people have done some if not all of the things you want to do.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.