1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.


Discussion in 'XenForo Development Discussions' started by cedivad, Oct 7, 2010.

  1. cedivad

    cedivad Active Member

    It looks like that i can't use that in ./library/XenForo/FrontController.php
    Is this a bug or it is loaded after? Can i load it manually to use it in that class?

    Thank you.
  2. dmnkhhn

    dmnkhhn Active Member

    Does that help: #5 ?

    Maybe it would be a lot easier if you post what you want to achieve. Modifying the FrontController.php is not the best way to do things.
    That's the reason why you create your own controller that extends the XenForo_Controller*_Abstract.
    cedivad likes this.
  3. cedivad

    cedivad Active Member

    Thank you. However and unfortunately, by using
    $hashInfo $this->_getDb()->fetchRow('
    i get
    Fatal error: Call to undefined method XenForo_Router::_getDb() in /Applications/MAMP/htdocs/xf/library/XenForo/Router.php on line 128

    I'm using the do-it-yourself way by calling an own istance of mysql, slower but will work.
    include(dirname(__FILE__) . '/../config.php');
    $link mysql_connect ($config['db']['host'], $config['db']['username'], $config['db']['password']);

    I have to edit the front controller, i'm tring to edit the thread urls from http://xenforo.com/community/threads/xenforo_application-get-db.5471/ to "http://xenforo.com/community/fR2Ga" and i'm almost done ;) - i know it may seem useless for you but i want it :D
    I don't know how to use the plugin system and editing the files seems the better way to go as of now that there are no docs and i've to edit only a cupple of files ;)
  4. dmnkhhn

    dmnkhhn Active Member

    I have not idea what you are doing but as long as it works. ;)
    cedivad likes this.
  5. cedivad

    cedivad Active Member

    Lol, ok :D
    Gonna add you some likes for the help ;)
  6. dmnkhhn

    dmnkhhn Active Member

    Over the next weeks we will get more information about how XenForo works and I am confident that we will learn how to do such things properly. :)

    The reason why the code I suggested is not working is that $this refers (in your case) to the XenForo_Router and a router doesn't have such a method.
  7. cedivad

    cedivad Active Member

    And what should we refer to?
    Because i'm actually having the same problem with XenForo_Input.

    Thank you ;)
  8. cedivad

    cedivad Active Member

    Searching for the _getDb definition, i find this:
        protected function _getDb()
            if (
    $this->_db === null)
    $this->_db XenForo_Application::get('db');

    Than i suppose that if XenForo_Application::get('db') don't work in the Router or Input classes calling the getDb function is useless.
  9. dmnkhhn

    dmnkhhn Active Member

    That's why you should use your own controller and a model because only the model (AFAIK) has access to the database by using
    There are several models, the XenForo_Model seems to be the basic one with basic methods (like fetchCol()) but there are specific ones like the XenForo_Model_Post with the getPostsByIds()-method. :)

    You will find all available models in /upload/library/XenForo/Model/ - each file is a specific model.
    cedivad likes this.
  10. ragtek

    ragtek Guest

    Why would you want to access the db in the input class?
  11. cedivad

    cedivad Active Member

    It's quite hard to explain.

    However i just init make_the_code_bad_i_only_care_to_make_it_work

Share This Page