How do you add extra buttons?

  • Seems like some of the German boards are a long long way ahead of the English boards in terms of extra content like shoutbox's, statistic plugins, servearly-customised styles, ect ect.


    Fortunatly, css is the same in everylanguage, and making my board look nice is easy.
    What i can't do however is add extra buttons to the top bar (where Forum/Members/Help/Legal Notice is)


    All i want to do is add three bars - Shop/IRC/Mail to my bar, and have them linked to other websites i run.


    Does anyone here know how to do this?


    Thank you in advance!


    ~ John

  • Hello!
    Nice to hear you like our board!


    For now i can only offer you two links to german threads about your question. Many have asked that before and i assure you, that it's not that difficult. It's just, that there seems to be no english thread about this topic yet, as far as i know … :huh:
    We surely will release some "How to"-documentation, after the final version is released, at this time there is no such available, unfortunately. Maybe your German is good enough for those threads to figure out how to start? And maybe someone can give you an explanation in English, for i'm just one of the the designers … ;)


    Wie neuer Menüpunkt anlegen?
    Eigene Seiten / Menüpunkte erstellen

    "Viribus Unitis"


    Harald Székely
    Designer

  • Hey guys.


    Well i figured it out after TWO DAYS solid =P


    my German wasn't bad, it's just the guy didn't explain it very well >_<


    If anyone in English want's to know how, just post here.
    Because it is *such* a long process and would involve teaching a little bit of SQL to people trying to do it, i don't really feel up for doing it unless some one out there actually wants to hear it >__<

  • Hey guys.
    If anyone in English want's to know how, just post here.
    Because it is *such* a long process and would involve teaching a little bit of SQL to people trying to do it, i don't really feel up for doing it unless some one out there actually wants to hear it >__<


    Well John, it looks like you have very first student - me :D


    I'm waiting for the explanations.


    Thanks in advance :)

  • Haha, nice one :]
    Okay mate, well... i hope you're ready for this -____-;


    (I better just say right now, there is one bug i have with the new buttons which i'll explain at the end, but it's nothing majour... even if you know how to make buttons, it would help everyone if you could read this anyway and tell us how to fix it.)


    Okay!


    First thing we need to do is set up an entry in the database about our new button.
    All the infomation about our button, such as where the image can be found, who has permissions to see the button, what order the button appears, ect is saved into your mysql database.


    Because i'm very security contious, i never use phpmyadmin or any 3rd party program. If you have mysql installed, that's all you need.
    Also, i am assuming everyone is running some variation of unix and not a Microsoft server.
    If you are using MS, the steps involved won't be very diffrent, but the installation directorys may be...


    Okay, first, go to the directory mysql is in (generally /var/db/mysql/)
    Now we're going to log in to our mysql server and get to grips with SQL.


    To log in type:
    mysql -h localhost --password


    Don't actually type your password where it says password. If you type that and hit enter it will ask you for a password.
    This needs to be your SQL root password.
    Obviously, i'm assuming here your SQL server is locally accessable. if it's not, replace the hostname/IP with 'localhost'


    Right, now you're all logged in, you need to open up your forum's database.
    First, let's list the databases you have using:

    SQL
    show databases;


    This will hopefully show you a box like this:



    Now you know the name of your forum's database, we're going to switch to that database so mysql knows to only bother with that one.


    SQL
    use your_forum;


    remember, it's very very important to type the ; at the end of every line.
    if you don't, mysql will give you another line untill you press ; again


    cool cool, so now your in your database, we want to have a look at what's inside the table:


    SQL
    SELECT * FROM wcf1_header_menu_item;


    If you're using ssh to do this, you need to make the window reeeeally wide to get it all in properly.
    You should see something like this:



    Obviously, IRC, Mail and Shop won't be there because those are the ones i've added, but you get the picture.


    Right, now, you're going to want add a new line in. The query below is what i used for my IRC button. Edit as appripriate:


    SQL
    INSERT INTO wcf1_header_menu_item (packageID,menuItem,menuItemLink,menuItemIcon,showOrder) VALUES (38, 'wcf.header.menu.IRC', 'index.php?page=IRC', 'icon/irc.png', 5);


    If you read through that line, you'll see it's quite obvious what we're doing. ^


    Next step, just run the SELECT * FROM wcf1_header_menu_item; command again to see if it's made the changes properly.


    You should see where it says permissions it will say NULL.
    We're going to update our SQL entry now to set that from NULL to something else.
    If you want all members to see your new button (ie, non-registered ones) type


    SQL
    UPDATE wcf1_header_menu_item SET permissions='' WHERE menuItemID=5;


    What the above command does is set the permissions value to '' (in otherwords, nothing) for the menuItemID of 5 (if this is the first button you've made, and you haven't installed any mods)


    If you want this button only accessible by registered users (for example, my mail button and my members list button), type:


    SQL
    UPDATE wcf1_header_menu_item SET permissions='user.membersList.canView' WHERE menuItemID=5;


    There's some weird bug in the WYSIWYG editor i'm typing into right now, so i'm going to post this and carry on underneath.
    Please don't make a post untill i've made a second post and i (or a mod maybe) can merge them.

  • Right!


    So your SQL is all done.
    Hopfully you changed all the above data to be relevent stuff for you (for example the location of the icon (icon/irc.png) and everything.


    Next step is to get the forum to look for that data in the database.


    So! let's hop over to our forum's folder ( usually /www/ :P )


    First thing we're going to do is make the forum aware of what we just did.


    To do this go into /wcf/language and open up 38_1_wcf.header.menu.php in your fav text editor. (wordpad on windows, ee or vi or vim or nano ect on *nix)


    Hopefully it should look like this:



    We want to stick another line in after 'Members'; telling the board about our new button.
    for example, i had:
    $this->items[$this->languageID]['wcf.header.menu.IRC'] = 'IRC';


    Pretty simple eh?
    where it says = 'IRC' what you type in there will be the text written onto the button.


    okay, so we're about 1/2 way through >____<


    next, go back two directorys and then forwards into lib/page/
    in page/ there should be a file called IndexPage.class.php
    you want to make a copy of this, and call it something else, such as IRCPage.class.php (cp IndexPage.class.php IRCPage.class.php in *nix)
    Now, remember to name it what you said in the ['wcf.header.menu.xxx'] bit of the last file we opened.
    More importantly, you MUST stick the word 'Page' after it.
    So, i had ['wcf.header.menu.IRC'] - so i'm naming this copied file IRCPage.class.php (does that make sense?)


    .....took me a whole day to figure that problem out >___>


    Righto, next, open up you're new file in your text editor again.


    First thing to do, find the line that says:

    Code
    class IndexPage extends AbstractPage {
    public $templateName = 'index';


    First of all, change 'class IndexPage' to 'class whateverPage' (whatever you just called this copied file. I called it IRCPage)


    Now, in a moment we're going to make a third file, and it's going to be called whatever.tpl
    the whatever bit is dependant on the text $templateName = 'whatever';
    So, yeah, basically change the word 'index' to something else. I did IRC.


    Righto - almost there :D ~phew~


    Save and exit whatever.class.php and go back two directorys again.


    Now go into the templates folder.


    open up your text editor again (we're going to make a new file) and type the following into it:




    Okay, obviously, there are a few things to change here.
    First - Title Of Page needs to be changed to the title of the page.
    Right now for example you will probibly see "How do you add extra buttons" at the top of your web browser's title =P


    Second, where it says 'whatever' you need to change that to whatever you want to put on your new buttons page.
    If you want a link, just stick a redirect in or something - but personally i think embedded things like an IRC chat client or a proxy or webmail page is better than a re-direction to the page.


    I can't help you with that. If you know some HTML then you should have no problems.


    Right! almost almost there!


    Save this file whatever.tpl
    The whatever should be equal to what you wrote in the whateverPage.class.php file instead of public $templateName = 'index';


    nice?
    nice.


    Now. only 1.5 more things to do =P


    First thing, find a subtible image to stick into your button.
    Remember - unless you have a seriously hacked up style your menu bar will be 24px high (and you'll need a 24px high button. Any more or less than 24px high will make everything look wrong.


    0.5th thing:
    Go back a directory into your top level directory for your forum.
    Now, delete everything in the folder cache.


    If your on *nix, just do:
    rm -rf cache
    mkdir cache
    chmod 777 cache


    Now come back out of cache (if your in it) and go into wcf/
    There should be another folder called cache (that took me ANOTHER day to find and have te courage to delete >_<)
    wipe everything in it, or do the above three things again =]


    And that's it!
    Browse to your forum and be amazed at your new button!


    This has to be without a doubt the LONGEST way i've ever had to make a button, however it's the only way to do it.
    WoltLab should *really* make a simple / automated way of doing this..


    Okay, now do you remember i said i had a bug in my meathod?
    Well you're about to find out what it is...


    When you click on your new button, instead of it being highlighted after you click on it, the index (aka Forum) button is highlighted.
    I have changed EVERYTHING trying to fix that, but i just don't know how.
    In the whateverPage.class.php there's two lines which say:
    selfLink
    and some babble after it, includind 'index.php?=Index' (i think...)


    i have tried changing that to 'index.php?=IRC' (in my example) for both lines, however it seems to make no diffrence at all.


    Maybe there's a third cache i don't know about? :P



    Before i finish, i just want to thank a bloke called HaTcHeT who helped me out with this.
    He doesn't have wbb3, and he's not a member of this forum - but he's a good bloke and if you ever bump into him buy him a drink, haha!


    Good luck to anyone who tries this!!!!


  • One simple comment: don't;)


    "DO NOT EDIT THIS FILE" means exactly that you mustn't edit this file. It is generated from database and will be overwritten from time to time.


    You just have to insert your item into wcfX_header_menu_item, make a languagevar and delete the files in wbb/cache/ and wcf/cache/

  • The style gets updated whenever you change something style-related on the Admin Control Panel.


    But if your style is as good as it's going to get, there's nothing wrong with customizing your style directly.
    Plus, you can make your forum look like whatever you like if you style it directly ^___^
    For example, i've changed the blue banner to say something diffrent when it pops up for first-time vistors.
    I've changed all the icons,
    I've changed the "double click to mark forum as read" icons to look diffrent, say something diffrent on mouse over and do something diffrent on double click.
    I've changed the text in the search bar,
    I've removed most of the traces that it's a wbb3 board (which significantly improves the security of the site - if you buy the licence to do so of course)
    I've changed all the help file to give help that's specific to my site members.


    And the best part is, i know nothing about html, css, or any of that stuff.
    Just *nix and grep to find text strings =P

  • And the best part is, i know nothing about html, css, or any of that stuff.
    Just *nix and grep to find text strings =P


    you changed the languagevariables for the help directly in the files?
    you know, next the next time when 1 languagevar a bit change and the languagevariables will be cheched again your changes are gone?
    you have to edito the languagevariables in the acp under display » languages

    MfG Markus Zhang (aka RouL)

  • The cache is also refreshed every time a package is installed.


    ...bugger.


    I'll have to make some sort of script to reload everything after an update.


    If that's the case Cyrus mate, then i definatly don't advise this method to anyone else!
    Having said that, i freakin' love my customized forum, and i'm very pleased with the end result.
    ...if only i could keep it that way =P

  • ahh, i understand how you want me to do it now =P


    Two problems however:


    First, when i try uploading my edited languagefiles (and when i try uploading original langfiles) i get the following error:


    Code
    The following error has occured while importing the language file: PHP warning in file /www/forum/wcf/lib/util/XML.class.php (31): simplexml_load_file() [function.simplexml-load-file]: /www/forum/wcf/language2/38_1_wbb.acp.board.php:97: parser error : Start tag expected, '<' not found


    Basically, i copied everything in language to language2, and i'm importing from language2


    Second problem:
    I have no idea how you want me to put all my .css changes into the style control panel.
    Style control panel is great for editing your existing style, but as my style is quite hacked up i can't put in all the code into the style forms.


    There should be an upload style kinda thing...
    EDIT: found the upload style thing (...) but unfortunatly it won't save it because it's not a valid style file. >_<

  • 1. You can only import XML langauge files. You cannot import the generated php files. You would need to copy and paste the content in the ACP.


    2. If you change the existing css-files you need to save them, as they can be overridden by updates. You can also put all changed css declarations in the "extra css box" that can be found in the style editor. I know with some styles it can be a lot.

  • Hm. I'm trying to make a new button without editing the files directly.


    I've changed the SQL and i've added the extra lines into 38_1_wcf.header.menu.php following the above description.


    I'm stuck however in creating and editing the language variable.


    What should i name the language variable? What values should i put in which box?

  • Oh no, that can't be true what I am reading here ... just stumbled over this thread. I would like to add 2 more menue buttons, but I don't even know what you are talking about ... :whistling:

    KEEP MEDIOCRITY AT BAY !

  • What would be good is if we had a Button Package that we could use.
    Who has a board that don't want to add buttons? ?(
    Something to think about.