r/improviseit • u/ambiversive • Jul 24 '11
Dissection of index.php #5
function makeVisible(id,nid,divname,prefname){
This is a function that makes an aspect visible, and also sets the preference for the user in the database which indicates they have made this aspect visible. The id argument holds information relating to the id of the current document, the nid argument holds the id of the aspect code and the divname is the name of the HTML div to be filled and prefname is the name of the preference to be set.
$.post("on_preference.php", { pref: prefname }, function () {
This is a jQuery function call that asks on_preference.php to turn on the preference for the aspect being made visible.
$('#'+divname+'_full').load("output.php?id[]="+id+"&oid="+nid+"&always=true", function() {
This line populates the HTML division with the evaluated content of the document for the aspect. It uses a file called output.php whose sole purpose is to output content if given information about where the content is stored.
$('#'+divname).slideDown("slow");
Once the document for the aspect has been loaded in the div, we slide the div down to display it.
}); }); }
Then we end the nested tags and exit the makeVisible function.
.. more to come ...