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

Insert basic page info instead of main content?

Discussion in 'Styling and Customization Questions' started by Neil E., Dec 24, 2012.

  1. Neil E.

    Neil E. Active Member

    I'd like to add some really simple page information triggered by new buttons on the NavBar.
    The buttons are easy thanks to Jake. http://xenforo.com/community/threads/how-to-add-a-new-tab-in-the-navbar.7781/

    I want all the main content (including the top and bottom breadboxes) to be replaced with some sort of table (or object filled with text). The QuickSearch box would remain. Suggestions? I certainly don't want to tackle anything like Xenporta or Wordpress etc. I'm thinking along the lines of a new template that replaces the normal main content. Some form of hard coding would be OK.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. Neil E.

    Neil E. Active Member

    OK, I looked at the other topic, but I don't get it.

    Create new file on the server, no problem.
    library/Callback/PageNode.php

    new template for 'mycontainer', should be possible

    new template for 'mycontent', should be possible

    handle the callback, no clue here, looks like maybe I have to create a new page to have somewhere to put the callback, and the new page has to exist in the node tree (was looking for something simpler)

    Any other methods? Leaving the breadcrumbs in place would be OK.
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The callback is defined when adding or editing a page node in the Admin CP. You can hide the page from the node tree if you want. That's another option when adding / editing a page node.
     
  5. Neil E.

    Neil E. Active Member

    I'm having trouble with the URL portion of the Create New Page. The html file is here: http://www.odsc.on.ca/.xenforo/welcome_XF.html
    If I use this for the URL portion I get a "please use valid characters" error message. Is this something to do with a node number required at the end of the location?
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  7. Neil E.

    Neil E. Active Member

    Very useful, thanks Jake. I want to learn more about callbacks.
    Is there a list somewhere of the various callback methods and what they do?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  9. Neil E.

    Neil E. Active Member

    I decided that including a file would do what I need. This keeps the page looking the same to users (main content becomes some html).

    library/Callback/WelcomePage.php (new file)

    Create New Page details

    Location of html file
    www.odsc.on.ca/.xenforo/welcomeXF.html

    Location of php file
    www.odsc.on.ca/.xenforo/library/Callback/WelcomePage

    Location of new page (will be the link in added extra NavBar Tab called "Welcome")
    <a data-description="#nodeDescription-" href="index.php?pages/welcomeXF/">Welcome Page</a>

    Error when I try to open the new page
    Any idea what I'm doing wrong?
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Use a full server path.

    Visit admin.php?tools/phpinfo and search the page for "DOCUMENT_ROOT". That will reveal the full server path.
     
  11. Neil E.

    Neil E. Active Member

    Well I was unable to find "phpinfo" in admin.php?tools/, but I did eventually get the server path correct. The callback is functioning as desired.

    I would like to know how to get the name of the new page inserted into the breadcrumb.
     
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The first breadcrumb will always be Home, but only if you have a home URL defined:

    Admin CP -> Home -> Options -> Basic Board Information -> Home Page URL

    The second breadcrumb will always be the name of the selected navigation tab. If you want to change the tab of the page node (create new or assign to existing) then you can use this addon:

    http://xenforo.com/community/resources/nodes-as-tabs.9/
     
  13. Neil E.

    Neil E. Active Member

    Thank you Jake.
     

Share This Page