FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Fudla! Plugin Core Code Changes (Requirements for FUD 3.0.2 <-> Joomla integration)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Fudla! Plugin Core Code Changes [message #165030 is a reply to message #165029] Sun, 17 April 2011 18:23 Go to previous messageGo to previous message
Dayo is currently offline  Dayo   Bahrain
Messages: 101
Registered: April 2011
Karma:
Senior Member
Taking this further, imagine these two pieces of documentation for the hooks

DOCUMENTATION 1 (Current Proposal)

PRE_TEMPLATE HOOK
This hook action is called just before the output html is put together and is a prerequisite if you wish to use the POST_TEMPLATE Hook to modify output later.

To run it, initialise it in your plugin as follows "plugin_add_hook('PRE_TEMPLATE',  'plugin_x_capture_output');"
Then, define the function with your code as follows...
function plugin_x_capture_output($t) {
	//YOUR CODE GOES HERE IF REQUIRED
	ob_start();
	return $t;
}

If you simply want to run some code before the output html is put together but do not wish to use the POST_TEMPLATE Hook to modify output later, define the function as follows ....
function plugin_x_capture_output($t) {
	//YOUR CODE GOES HERE
	return $t;
}
P.S: Try not to change the value of "$t", as we need it intact to use later on in the process.

POST_TEMPLATE HOOK
This hook action is called just before the output html is sent to the browser and requires the PRE_TEMPLATE Hook.

To run it, initialise it in your plugin as follows "plugin_add_hook('POST_TEMPLATE', 'plugin_x_process_output');"

Then, define the function with your code as follows...
function plugin_x_process_output() {
	$template_output = ob_get_contents();
	ob_end_clean();
    $template_output = YOUR CODE TO MODIFY OUTPUT
	echo $template_output;
}



Compare that to
DOCUMENTATION 2 (Revised Proposal)

PRE_TEMPLATE HOOK
This hook action is called just before the output html is put together and is a prerequisite if you wish to use the POST_TEMPLATE Hook to modify output later.

To run it, initialise it in your plugin as follows "plugin_add_hook('PRE_TEMPLATE',  'plugin_x_capture_output');"
Then, define the function with your code as follows...
function plugin_x_capture_output() {
	//YOUR CODE GOES HERE IF REQUIRED
	return null;
}

POST_TEMPLATE HOOK
This hook action is called just before the output html is sent to the browser and requires the PRE_TEMPLATE Hook.

To run it, initialise it in your plugin as follows "plugin_add_hook('POST_TEMPLATE', 'plugin_x_process_output');"
Then, define the function with your code as follows...
function plugin_x_process_output($input_html) {
    $output_html = YOUR CODE TO MODIFY $input_html
	return $output_html;
}


Look to me like one of them is a bit more simple and straightforward although I suppose it is not the end of the world. I just prefer high usability levels particularly if the cost is low.

[Updated on: Mon, 18 April 2011 00:49]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Tips for higher iPhone/Andriod/Pre compatibility
Next Topic: Help Needed - fud_user_reg class
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 19:11:59 GMT 2024

Total time taken to generate the page: 0.06406 seconds