Create page within Admin CP

Bill.D

Active member
Hey all, I am a Xenforo Dev N00b So I apologize if this has already been asked somewhere, but I can't seem to find it.

We currently have a Java script that runs on our forum that check a database upon request. We have made a separate php page for adding entries into that database. It would seem to me that we should be able to create a page within the Admin CP with the entry options for that DB.

Here is what I have done:

Using the Development tab I created a new Add-On. Then Under the Admin Navigation I created a new link under Tools (Currently not linked to anything).

The Question:

How do I created a Xenforo Admin CP page so the Entry options fit into the system like all of the other options pages?

Thanks,
-Bill
 
Hey all, I am a Xenforo Dev N00b So I apologize if this has already been asked somewhere, but I can't seem to find it.

We currently have a Java script that runs on our forum that check a database upon request. We have made a separate php page for adding entries into that database. It would seem to me that we should be able to create a page within the Admin CP with the entry options for that DB.

Here is what I have done:

Using the Development tab I created a new Add-On. Then Under the Admin Navigation I created a new link under Tools (Currently not linked to anything).

The Question:

How do I created a Xenforo Admin CP page so the Entry options fit into the system like all of the other options pages?

Thanks,
-Bill
You need 3 things to define an admin page:
  1. Route class (see, /library/XF/Route/*), set up the route in the development tab and have it go to your custom class.
  2. A controller (see /library/XF/ControllerAdmin/*) for your specific page. This is how you will define your template's data, which template to use, and any necessary actions.
  3. An admin template to use it for
You can find a template that already suits your need to copy/paste to easily get a working template of your own, and then you can modify it to suit your needs.
 
0.o ok.. this may be over my head.. I will experiment! Thank You :)
Basically, it is this:
  • The route for your add-on (that you associate within the ACP) will set up which controller to use and which action you are attempting to do. If necessary, you can define a function to build links for your specific route. These classes have a very basic use, and not much code.
  • The controller is where your logic is going to work. So if you have an 'index' page, for your route, you are going to define a function called "actionIndex()" which will be used to build your page. At the bare minimum, you are going to just return a view for it to work, more in depth is to write calls to your database to fetch information in it. I'd take a look at /library/XF/ControllerAdmin/Index.php for a solid example.
 
I didn't see an "index.php" in that folder, I check a new and old installation of ours and could not find it.
Maybe Home.php? I'm at work, so I'm not 100% of the file name. Looking in any ControllerAdmin should be able to give you ideas of how its supposed to be set up.
 
Hey Lawrence,

Thanks for the page.. I think I will wait till after the weekend so you can make those more in depth instructions. I was still a little lost sadly.

Right now we already have a crude php page that allows us to list, update, and delete the entries to this database that the java script uses. From what I saw in your directions, would we be abandoning that interface portion and use the options page to construct the interface and then have those drop in block interface objects make calls to a php file that does the work? Is that correct? and if so, how would you have a select menu populate it self with items from the DB?

Thanks for all of the support.. you guys are awesome :-)
-Bill
 
Hey Lawrence,

Thanks for the page.. I think I will wait till after the weekend so you can make those more in depth instructions. I was still a little lost sadly.

Right now we already have a crude php page that allows us to list, update, and delete the entries to this database that the java script uses. From what I saw in your directions, would we be abandoning that interface portion and use the options page to construct the interface and then have those drop in block interface objects make calls to a php file that does the work? Is that correct? and if so, how would you have a select menu populate it self with items from the DB?

Thanks for all of the support.. you guys are awesome :)
-Bill
If you have a list of items, its best to use an actual page. If its a list, look at how add-ons are displayed, that's most likely the "list" look you want. Deleting would be 'present' on the list portion (see uninstalling an add-on / resetting a phrase). Editing would be say:

your-prefix/ittle.id/edit

Which would display a form. You would then have to write the backend to handle these. Is this what you are looking for?
 
What I'm going to cover is adding options to Home->Options, and as well how to add your own settings page to Users->XXXXX which will contain option settings from the home->options->XXXXX, as well as additional options not found on the Home->Options page. That should cover all of it. What I am going to create is a tutorial that when completed will allow you to display the highest posting member for the week, or month, the most likes received in a week/month, on your forum sidebar, and the highest post to like ratio for the week/month.
 
Top Bottom