• OzzModz is no longer taking registrations. All registrations are being redirected to Snog's Site
    All addons and support is available there now.

XML File Settings Help

MarkFL

New member
Hello All,

I am working on a requested feature for one of my add-ons. This product enables the admins to set certain forums where only the first post and the user's posts of a thread is visible, except to certain exempt usergroups. A user has requested that each forum on the site be separately configurable as to whether the add-on is set to work there, which usergroups can view all posts, which usergroups will have their posts always viewable, and whether all of the OP's posts are all viewable regardless of usergroup.

I have decided that a table would be the most efficient way to configure the forums, and this is what I have so far:

View attachment 1031

This is the code in the XML file that displays the above table:

HTML:
			<setting varname="markfl_sfpo_configure" displayorder="25">
				<datatype>free</datatype>
				<optioncode><![CDATA[" . "<table style=\"font-size: 10px; border: 1px solid #000000; border-collapse: collapse; width: 100%\"><tr class=\"smallfont\"><th style=\"border: 1px solid #000000\">Forum</th><th style=\"border: 1px solid #000000\">On?</th><th style=\"border: 1px solid #000000\">View All</th><th style=\"border: 1px solid #000000\">Show All</th><th style=\"border: 1px solid #000000\">OP Show All</th></tr>"
				. eval('$options = "";
foreach($vbulletin->forumcache AS $forumid => $forum)
{
	if ($forum[parentid] > 0)
	{
		$options .= "<tr><td class=\"smallfont\" style=\\"border: 1px solid #000000\\">$forum[title]</td><td class=\"smallfont\" style=\\"border: 1px solid #000000\\"><input type=\"checkbox\"></td><td class=\"smallfont\" style=\\"border: 1px solid #000000\\"><input type=\"text\" size=\"10\"></td><td class=\"smallfont\" style=\\"border: 1px solid #000000\\"><input type=\"text\" size=\"10\"></td><td class=\"smallfont\" style=\\"border: 1px solid #000000\\"><input type=\"checkbox\"></td></tr>";
	}
}
return "$options";') . "</table>]]></optioncode>
			</setting>

Now, what I am trying to figure out is how to take the data input into the table, the input elements (checkboxes and text), and turn it into an array of options data that can then be accessed in the plugins for conditional statements.

Does anyone know of a good reference for learning how to do this? Until now I have just been modifying the code of others with regards to settings variables who have marked their code as reusable, but the time has come for me to actually know what I'm doing, and a link to some good reference material or tutorials on this would be greatly appreciated. I haven't been able to find much online about this. :D
 
This is something I am in the middle of researching myself. Since I am coding for VB5, I'm trying to stay with the latest coding styles and using the current techniques to get things done. The method I'm finding most common is using javascript to build the array string and submission to the php script via ajax. This method will work in VB4 as well. Search google "jquery submit ajax mysql" yields some pretty good results and I have been successful writing to the database using standard html form tags so far. Not sure if this info will help or not. Good luck.
 
This issue has kind of gotten pushed to the back burner for me, although I have not forgotten it. So many cool things to learn and so few hours in a day. :D
 
Back
Top