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

Wanting to add new pages containing PHP from our previous site.

Discussion in 'XenForo Questions and Support' started by Jason@Fifaworld360, Jul 29, 2012.

  1. Jason@Fifaworld360

    Jason@Fifaworld360 New Member

    We have just installed XenForo and now looking to know how we add new pages and have the content of our old site in it. This is so we can alter the contents of our current databases which holds other related information to our project. Also we will need to ensure that only members logged in can have access to certain pages and likewise some other pages only accessible to admins or super-admins.

    I have found out how to add a new page, but it only allows HTML to be added in. How do I have it so we can use PHP and also know which member type is logged in who is wanting access to the page.

    Can anyone give us a little help on where we could start.
  2. Chris D

    Chris D XenForo Developer Staff Member

  3. Jason@Fifaworld360

    Jason@Fifaworld360 New Member

    Thank you, I have had look at the video, and wow this is really starting to excite me a lot. That first stage seems fairly simple so far. What we previously had was a CMS to alter various user entered details. All of this was stored in a different database. This video shows how we can access and display content from the XenForo database. How do I get info from another database shown in a new page ? and allow us to edit this using our already written code, altered slightly so it fits in with the Xen layout.
  4. Chris D

    Chris D XenForo Developer Staff Member

    It's going to be tricky to say exactly how, but it's definitely a PHP Callback that will help you - probably in the latter stages of that video.

    That will enable you to call a PHP file.

    This isn't what you want to do, but here's a tutorial someone wrote on making a specific post show up in a page. That uses a PHP Callback:


    What you would do is, in that PHP file, load your database, run the queries and return the content.
  5. Jason@Fifaworld360

    Jason@Fifaworld360 New Member

    I am starting to get a little lost now. Not sure if I am explaining it right what we are wanting to do.

    We have a MySQL database table called 'results' for games that members play on their consoles, once played they enter their results via their pc on to the site and this is updated on the separate databases. We have the PHP that does this, but now sure where I use this. I tried to follow the video in the first reply and thought yes this is what we need, but most of the options selected in the video do not show up in our Xen.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Code example of second database connection:



    		$db2 = new Zend_Db_Adapter_Pdo_Mysql(array(
    			'host'     => 'localhost',
    			'username' => 'dbuser',
    			'password' => 'dbpass',
    			'dbname'   => 'dbname'
    		$records = $db2->fetchAll("
    			SELECT *
    			FROM tablename
    Now $records is an array with all of the records from tablename in the second database.
  7. ragtek

    ragtek Guest

    I wouldn't use the xenforo pages for this!
    You would need to deal with too many unnecesary things...

    Create a own controller,route,model,datawriter,etc...
    It's IMO the best & cleanest way
  8. Jason@Fifaworld360

    Jason@Fifaworld360 New Member

    This sounds like where we could go with this. Are there any tutorials for this ?
  9. ragtek

    ragtek Guest

  10. Jason@Fifaworld360

    Jason@Fifaworld360 New Member

    I have checked again these links and see that it is for pages that need creating from scratch, but our pages are already in use on our old site, and wanting to embed the code from these pages in top the new XenForo pages so the results can be managed within the same platform without having to go to a different site (sub-domain)

Share This Page