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.

Problem adding code to default.master.php

Hi, I want to install a javascript code for a sliding panel. It works ok but I have this problem. When adding the code at the end of the default.master.php file, a lot of icons are dissappearing in the COMMENT REPLY section, as in this picture below

This is the script I wanted to install: http://www.dynamicdrive.com/dynamicindex17/ajaxsidepanel.htm

So, can you advice me what to do so that i don't have this issue anymore and have this script installed?

Thank you

«1

Comments

  • x00x00 MVP
    edited June 2014

    first there is no need to add jquery it is already added, doing so can cause conflicts.

    Secondly it is not very Vanilla to hard code your script and styles in the master, it is better to queue them properly.

    Create a file called class.cheilethemehooks.php in you theme and put

    <?php if (!defined('APPLICATION')) exit();
    class CheileThemeHooks extends Gdn_Plugin{
        public function Base_Render_Before($Sender){
            $Sender->AddCssFile('ddajaxsidepanel.css');
            $Sender->AddJsFile('ddajaxsidepanel.js');
       }
    }
    

    make sure you put the style and js in the folders design and js respectively (in your theme)

    Lastly can't guarantee hat a third party script or css won't cause conflict anyway.

    grep is your friend.

  • I made some corrections please refresh

    grep is your friend.

  • I'll try and I'll let you know if it worked. Thanks

  • In which director of the THEME, should I place the class.cheilethemehooks.php file?

  • x00x00 MVP
    edited June 2014

    just in the theme folder itself.

    Remember to remove you code from default mater.

    grep is your friend.

  • I created the file, copied the css and js files . And nothing happens. How do I activate it?

  • check to see the source of the page, to see if the file are being added.

    grep is your friend.

  • i realised that after placing the code, the same error happends. Those buttons are missing

  • I checked the source of the default.master.php and it seems that the CheileThemeHooks isn't there. And when I deleted class.cheilethemehooks.php from the there theme directory, then the error dissappeard. I mean all those button appeared again.

  • by the way this whole facility is reinventing the wheel

    simply add

    <div class="Popin" rel="/relative/vanilla/url"></div>

    wherever you need it. it shoudl work. By relative vanilla url, if your forum is in a directory don't put the directory.

    If you want an external page, put the entire url, but make sure this page only sends a fragment.

    grep is your friend.

  • You can also do <div class="Popin" rel="/module/modulename"></div> for vanilla modules.

    grep is your friend.

  • Do i have to undo the previous steps before addind these last to lines? I didn't understand what relative link do I have o put there. Is it the link to class.cheilethemehooks.php ?

  • yes I mean not using that third party system at all. You can just remove the them hook file.

    What is the page you want to load dynamically?

    grep is your friend.

  • Sorry i may have misunderstood, do you wan that slide out window, when they click?

    grep is your friend.

  • it's the main page of the forum http://www.cheilenereinfo.ro/

    As the forum has touristic information, my plan was to add some links to some maps or information.

  • if you just want a popup you can use

    some link

    If you want a fancy slide out, then there are hundred of jquery pluigns, better than this one for sure. Search around.

    grep is your friend.

  • Yes, that's right. I wanted a sliding panel. The user click the link and then, the sliding window comes out from a side and then the user can click to close it

  • @cheilenereinfo said:
    it's the main page of the forum http://www.cheilenereinfo.ro/

    As the forum has touristic information, my plan was to add some links to some maps or information.

    why do you need dynamic loading for that? I suggest on public information site, not making things too complicated, because you might no know what problem your users may have.

    grep is your friend.

  • Can you recommend a script that you know it works without creating any conflicts? And for any other jqueris plugins, should I use the method you showed me?

  • x00x00 MVP
    edited June 2014

    @cheilenereinfo said:
    Can you recommend a script that you know it works without creating any conflicts? And for any other jqueris plugins, should I use the method you showed me?

    Generally speaking the method I showed you is the correct way.

    I would search around, I don't use many of these sort of thing becuase personally find them a bit irritating, and can make a site a bit patchwork. I also tend to hand roll dynamic content, becuase I'm experience at programing an can control it precisely.

    If i use a third partly library, which I do, i will make it fit in the with the site style.

    grep is your friend.

Sign In or Register to comment.