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.

Adding links to footer

SheilaSheila ✭✭
edited July 2012 in Vanilla 2.0 - 2.8

Hi!

I'm trying to add some top menu links like Discussions, Activity, Sign out etc. to footer (div #Foot) also.

I guess the solution is mentioned here, http://vanillawiki.homebrewforums.net/index.php/Using_Smarty_with_Vanilla. Could somebody walk me thru with how to use the asset foot? I can't much handle any other method than copypaste when it comes to coding...

«1

Comments

  • UnderDogUnderDog MVP
    edited July 2012

    What you're looking for is these types of smarty 'tags' :

    {dashboard_link}
          {discussions_link}
          {activity_link}
          {inbox_link}
          {profile_link}
          {custom_menu}
          {signinout_link}

    so you can use them in your footer:

    < div id="Foot" >{dashboard_link}
          {discussions_link}
          {activity_link}
          {inbox_link}
          {profile_link}
          {custom_menu}
          {signinout_link}< /div >

    Unfortunately, that part of asset name = 'Foot' is for items that want to be generated in the footer, like debugging information (a stage you've luckily passed already). So figure out which types of links you want in your footer, let it know in this thread and you can either use a smarty 'tag' or just simple plain HTML, which is easier.

    There was an error rendering this rich post.

  • SheilaSheila ✭✭

    Thank you! I think that one or two examples are enough, and then i'm hopefully able to figure out the rest. Going to add all other links than dashboard and activity link.

  • SheilaSheila ✭✭

    Hi!

    Would loooove some help with this. All I'm able to get is 'unexpected string on line this and that' with my experiments... :)

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

    @Sheila

    Can you post up what you have added to the default.master?

    Is it .tpl or .php?

  • SheilaSheila ✭✭

    Hi!

    It's default.master.php which I'm trying to edit and there's the part

    echo "<div class='footLink'>Powered by $VanillaAnchor</div>"; 
    

    within I'm trying to add links and back to top -javascript with absolutely no success yet.

  • Post the lines that caused you the error.

    you either left out a semi-colon or munged up your quotes.

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

  • SheilaSheila ✭✭

    Tried to add this

    <a title="Back to top" href="javascript:window.scrollTo(0,0);">Back to top</a></div>
    

    within the div and with getting the menu links to footer haven't gotten even that far.

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

    @Sheila

    I just tried this and it works (after a fashion...)

    add

    if ($this->Menu) {
                            $this->Menu->AddLink('TEST', T('TEST'), 'http://www.bbc.co.uk');
                            }
                            echo $this->Menu->ToString();

    After

    <pre>$this->RenderAsset('Foot');<\pre>
    
  • 422422 Developer MVP
    edited July 2012

    Deleted I cannot post code here it does my head in ( emailed you instead -s- )

    There was an error rendering this rich post.

  • SheilaSheila ✭✭
    edited July 2012

    whu606 said:
    add

       if ($this->Menu) {
     $this->Menu->AddLink('TEST', T('TEST'), 'http://www.bbc.co.uk');
     }
     echo $this->Menu->ToString();
    

    Thanks again @whu606 ! Almost there. It added menu links of custom pages, plugin link 'Mark all Read' (which I'd like not to have in footer) and sign out so the result is Mark all Read / Faq / Contact / Sign Out.

    What I'm trying to get to the footer is Discussions / Activity / Inbox / Profile / Faq / Contact / Sign out / Back to top.

    BUT I think that this

    $this->Menu->AddLink('TEST', T('TEST'), 'http://www.bbc.co.uk'); 
    

    might be a good solution, if I only would get that to work solo, since I don't necessarily need Profile and Sign Out links that are unique, and could use that in order to add other links hardcoded.

    422 said:
    Deleted I cannot post code here it does my head in ( emailed you instead -s- )

    :) Appreciated! Will look in to that. And understand totally. It would have taken about two years of your life to post that code with Markdown.

  • peregrineperegrine MVP
    edited July 2012
      $this->RenderAsset('Foot');
                if ($this->Menu) {
                   $Session = Gdn::Session();
                  $Authenticator = Gdn::Authenticator();
                  $this->Menu->ClearGroups();
    
                     $this->Menu->AddLink('A', T('Back'), '#');
    
                    $this->Menu->AddLink('A', T('Sign Out'), $Authenticator->SignOutUrl(), FALSE, array('class' => 'SignOut'));
    
                     $this->Menu->AddLink('A', T('Contact'), '/contact');
                     $this->Menu->AddLink('A', T('Faq'), '/faq');
                    $this->Menu->AddLink('A', $Name, '/profile/{UserID}/{Username}', array('Garden.SignIn.Allow'), array('class' => ''));
                    $this->Menu->AddLink('A', T('Inbox'), '/messages/all');
                    $this->Menu->AddLink('A', T('Discussions'), '/discussions');
                    $this->Menu->AddLink('A', T('All Activity'), '/activity');
    
    
                 echo $this->Menu->ToString();
                }
    

    ?>

    you will need to change the third parameter for contact and faq obviously.

    If they are all in the same group A - the order of adding links seems to be a prepending.

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

  • SheilaSheila ✭✭
    edited July 2012

    Thanks! Everything else is there, except with Profile link I get:

    Fatal error: Call to a member function SignOutUrl() on a non-object in ... /test/themes/default/views/default.master.php on line 105

    Not to mention, I now have a very inpractical, but thankfully cute dropdown list in my footer, haha. Thanks to Categories2Menu -plugin. Will be very interesting to override everything it does with custom css rules. Will let you know, when or if I find a best solution to that.

    To be honest, I love Vanilla 2. But adding few links to a footer really should not be this big issue.

    Is it worth of trying to use just basic include
    <?php include('inc_links.php'); ?>
    and call somewhat more hardcoded links from outside file?

  • $Session = Gdn::Session();
    $Authenticator = Gdn::Authenticator();

    do you have this in there.

    I often re-edit my messages to the bitter end.

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

  • $Session = Gdn::Session();
    $Authenticator = Gdn::Authenticator();

    do you have this in there.

    I often re-edit my messages to the bitter end.

    To be honest, I love Vanilla 2. But adding few links to a footer really should not be this big issue.>

    that's why they recommend the .tpl instead of the .php for the

    default.master

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

  • SheilaSheila ✭✭
    edited July 2012

    peregrine said:
    that's why they recommend the .tpl instead of the .php for the

    Then why even the default theme (correct me If I'm wrong) comes with default.master.php and not with .tpl? Confusing :D

    I'll restart my experiments tomorrow.

  • peregrineperegrine MVP
    edited July 2012

    not in vanilla 2.1 - I was corrected by Todd.

    The Smarty theme template is easy to add a link and just about impossible to do anything else with inside the vanilla paradigm without a "Smarty Advanced user certification". And there may only be one or two people worlwide with that cert. :)

    I should also place credit, where credit is due. I learned most of the above from @mcu_hq's Traditional Chocolate theme (the guy is a wizard with vanilla methods).

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

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

    @Sheila

    It is much easier with the tpl.

    I tried both while I was replying to you.

    I've just started working with 2.1 - if you are going to make changes to your forum, it might be best to make them in 2.1, rather than end up doing it twice.

  • whu606 said:
    I've just started working with 2.1 - if you are going to make changes to your forum, it might be best to make them in 2.1, rather than end up doing it twice.

    Ahum... I agree a bit, but, it's making changes to your forum's theme and not to your forum itself.
    You shouldn't make changes to your forum itself, (that goes without saying), that's what plugins and applications are for.

    Sheila said:
    To be honest, I love Vanilla 2. But adding few links to a footer really should not be this big issue.

    Sheila, you are absolutely right. You just happen to mix up 2 types of the template : the .php way and the .tpl way. As peregrine said, just stick with the .tpl way for now (and restart the experiment, as you already said).
    The .php way you will quite easily miss a ; ' ` etc. With the .tpl way you will most likely not find any strubblings for a while...

    There was an error rendering this rich post.

  • SheilaSheila ✭✭
    edited July 2012

    whu606 said:
    @Sheila
    I've just started working with 2.1 - if you are going to make changes to your forum, it might be best to make them in 2.1, rather than end up doing it twice.

    Too late! :D
    Minus the footer, contact form and few other small css tweaks, my new theme is ready. And not like I started it from scratch, it's based on @422 's excellent Air.

    If extremely stable 2.1 comes out next monday, in that case I might have done things in vain. But most likely it will take some more time? Not to mention the plugins.

    With Invision I was actively involved since alpha releases of 2.xxx, I don't have time nor hunger to be that much of a tester anymore. Naturally I contribute bug reports if needed, but am more of a finished release kinda girl now adays and prefer waiting thru few version numbers before upgrading. And have to think my users too, they've had their fair share of parse errors and wsods during those years, thanks to me.


    Sheila, you are absolutely right. You just happen to mix up 2 types of the template : the .php way and the .tpl way.

    @UnderDog So the smarty tags are only for .tpl -files, I guess? I'm not totally stranger to .php since all cms, blog and forum softwares I've worked and played with have been based to that. (Minus few years with Movable Type which was in perl). Guess I still see some things too much of a IPB way, since addons there were often practically instructions to modify the core: go to the file y, find a line x and remove that. Then go to the file z, and starting from line v copypaste this code. And that way I made my modifications successfully. And with local folder containing all the files I've tampered with, it wasn't that hard to keep up with upgrades, even with some duplicate work involved.

    So there's definitely still things here to get used to, and not in a bad way at all! Still amazed that same kind of results can be achieved with just uploading and activating a addon. But then again, restrictions might come up when there isn't a addon.

    Did I just hijack my own thread? Well, back to the footer-thingie. Hope that is with .tpl files one of the things easier in 2.1.

    I so much prefer Vanilla's lightness and non table approach compared to legacy forums but there's excessive scrolling and usage of back-button involved with 'out of the box'-version. Breadcrumbs, top and bottom paging and footer links make the layout more cluttered but they improve usability significantly.

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

    @Underdog

    Yes, I meant changes to the theme.

    In my case, my current theme has a.php default.master, and 2.1 seems to prefer to use.tpl, so I need to make changes based on that.

Sign In or Register to comment.