Adding an option to "page manager" (admin panel)
#1
Recently have been using this awesome plugin http://mods.mybb.com/view/page-manager and it has done me wonders. But, I want to add another field to the "Add New Page". Here is how it appears
http://i.gyazo.com/770b0490b6170a0a87949fd981edd0a9.png

However, right inbetween Name and URI Parameter I want to add another field. No problem. Looking into the code I can see where I need to insert it.

		$form_container->output_row($lang->pagemanager_edit_form_name.' <em>*</em>',$lang->pagemanager_edit_form_name_description,$form->generate_text_box('name',$form_array['name'],array('id'=>'name')),'name');

RIGHT HERE!!!!

		$form_container->output_row($lang->pagemanager_edit_form_url.' <em>*</em>',$lang->pagemanager_edit_form_url_description,$form->generate_text_box('url',$form_array['url'],array('id'=>'url')),'url');

However, this appears a bit different than usual. It "generates" the items rather than putting them in individually. I'm guessing this is done to just speed up processes faster. So, I create my own right in there, which is thus:

$form_container->output_row($lang->gamemanager_edit_form_cid.' <em>*</em>',$lang->gamemanager_edit_form_cid_description);		

Pretty straightforward, it creates a new row and I can input in echo's. However, I need to input PHP into this. I'm trying to add an option field which grabs data from a table and displays it as the results. Here is the code I am trying to put into it:

		 		       
        $query = "SELECT * from  `".TABLE_PREFIX."console`";
        $rows = $db->query($query);
echo "<select name = 'console'>";
		  while ($record = $db->fetch_array($rows)) 
        {
					  echo "<option value = '{$record['id']}'";
            if ($CategoryId == $record['name'])
                echo "selected = 'selected'";
            echo ">{$record['name']}</option>";
		}
		echo "</select>";

Again, a simple code but I can not seem to implement it into my new row. It just simply won't allow any PHP statement I try to put into it. I've spent 2 hours now and I am pretty confused. If I put this code below the row code (in it's own space), it'll show up and work perfectly on the form but not in the right place (http://i.gyazo.com/b60dea670b2765071d3dce392ae846b6.png). Which is why I am trying to put it into the row code.
Reply
#2
If you want to see the usage of those classes take a look at your admin/inc/class_form.php file.
Reply
#3
Thank you! I was looking all over for it.
Reply
#4
I also am in the process of writing an advanced guide for plugins so some of the ACP I will be covering because of how complex it can be.
Reply
#5
(2014-10-10, 12:43 PM)dragonexpert Wrote: I also am in the process of writing an advanced guide for plugins so some of the ACP I will be covering because of how complex it can be.

It is very complex. Still solving bits of the problem but it's taken me well over 5 hours lol. I've experimented with a lot of PHP but never really seen it like this.
Reply
#6
(2014-10-10, 12:43 PM)dragonexpert Wrote: I also am in the process of writing an advanced guide for plugins so some of the ACP I will be covering because of how complex it can be.

Finally! I mean the ACP is pretty simple to code for if you have an idea of what you're doing, but if you're taking shots in the dark... Toungue

Glad to hear some documentation for the ACP is in the works. I think it will definitely be useful for many plugin developers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)