2014-10-09, 06:18 PM
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.
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:
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:
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.
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.