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

HowTo: Add a dynamic footer to XenForo 1.0

Add title and links to the latest five resources and community threads to the bottom of XF

  1. LPH

    LPH Well-Known Member

    lph submitted a new resource:

    HowTo: Add a dynamic footer to XenForo - Add title and links to the latest five resources and community threads to the bottom of XF

    Read more about this resource...
    boooooo and RobParker like this.
  2. RobParker

    RobParker Well-Known Member

    That's pretty cool and would be good to use for example in Russ's Core footer.

    Can I ask why this isn't packaged as a normal addon (i.e. an XML file that we can install)? Is there a technical reason or is it just how you've done it?
  3. LPH

    LPH Well-Known Member

    Because I didn't know how ;)

    If someone can tell me how then I can try ...
    RobParker likes this.
  4. Code Monkey

    Code Monkey Well-Known Member

    I'm pretty sure when you have debug on you can export the addon and it will create the xml file for you. Then just put the files in proper directories, zip it up.
  5. boooooo

    boooooo Member

    hi got Error any help on thees :cry:

    An exception occurredInvalid model 'XenResource_Model_Resource' specified in C:\xampp\htdocs\x\library\XenForo\Model.php on line 192

    ::create() in TuxFooter/Listener/Footer.php at line 26
    call_user_func_array() in XenForo/CodeEvent.php at line 54
    ::fire() in XenForo/Template/Abstract.php at line 285
    ->callTemplateHook() in XenForo/Template/Abstract.php(265) : eval()'d code at line 873
    eval() in XenForo/Template/Abstract.php at line 265
    XenForo_Template_Abstract->_renderInternal() in XenForo/Template/Abstract.php at line 191
    XenForo_Template_Abstract->render() in XenForo/Template/Public.php at line 110
    XenForo_Template_Public->render() in XenForo/ViewRenderer/HtmlPublic.php at line 135
    XenForo_ViewRenderer_HtmlPublic->renderContainer() in XenForo/FrontController.php at line 568
    XenForo_FrontController->renderView() in XenForo/FrontController.php at line 156
    XenForo_FrontController->run() in C:/xampp/htdocs/x/index.php at line 13
  6. LPH

    LPH Well-Known Member

    Did you modify the file location for your XenForo installation?

    Check the Footer.php file you created and make sure the locations are correct.
    boooooo likes this.
  7. boooooo

    boooooo Member

    Yes i am sure ... see

    25-6-2013 12-18-16 AM.jpg
  8. LPH

    LPH Well-Known Member

    Sorry, I was at work and answering on their network. The image on the right cuts off exactly at the place to change the forum location. The original code shows http://community.tuxreportsnetwork.com .... I cannot see if you changed it to the proper file locations.
    boooooo likes this.
  9. boooooo

    boooooo Member

    No Problem Thanks you... anyway (y)
  10. LPH

    LPH Well-Known Member

    Did you make the change for the path to your forum?
    boooooo likes this.
  11. boooooo

    boooooo Member

    oh got it I think ... the problem i don't have resource manager install... :cry:

    do i need it ? :whistle:
  12. LPH

    LPH Well-Known Member

    Yes, for the complete code to work then you must own the resource manager. You are welcome to strip out that portion of the code.


    class TuxFooter_Listener_Footer {

       public static function 
    includeTuxFooter($hookName, &$contents, array $hookParamsXenForo_template_Abstract $template) {

    $hookName == 'ad_below_bottom_breadcrumb') {


           <div class="pageWidth">

           <div class="forum_posts_leftside">

           <h3>Put A Meaningful Headline Here</h3>


    /* Add in some code to your liking */


               </div><!-- Close forum_posts_leftside -->

               <div class="forum_posts">

                 <h3>The following posts are from our community</h3>


    /* Script to pull the latest posts from the XF Forum */

    $db XenForo_Application::getDb();

                 if ( !
    $db ) {

    'This script did not connect to the database' mysql_error() );

    $thread_qry "
                       SELECT * FROM `xf_thread`
                    ORDER BY `last_post_date` DESC
                    LIMIT 5

    $threads XenForo_Application::get('db')->fetchAll($thread_qry);

                 foreach (   
    $threads AS $thread ) {

                   echo (
    "<div class='entry-meta'><a href='http://COMMUNITY.DOMAIN.COM/" XenForo_Link::buildPublicLink('threads'$thread) . "' >" XenForo_Helper_String::wholeWordTrim($thread['title'], 48) . "</a> <span style='float:right; margin-right:60px'>Viewed: " $thread['view_count']
    "</span><br /></div>"); // Echo the title with a link.



               </div><!-- Close forum_posts -->

             </div><!-- Forum Footer -->
    .= ob_get_contents();


    boooooo likes this.
  13. boooooo

    boooooo Member

    cool its working now :D

    Thanks you (y)
    LPH likes this.

Share This Page