Jump to content
DevFuse Forums

Tutorial for converting hooks into uportal blocks?


highlander

Recommended Posts

  • Management

It really depends on the hook. For example the Facebook Activity hook is pretty simple and can be easily moved across. Often you'll just need to take the contents of the hooks getOutput function have it print the end code rather then the return for hooks.

 

<?php

print $this->registry->getClass('class_forums')->hooks_facebookActivity();

?>

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
  • Management

Take a look at the calendars own hook files. e.g. In admin/applications_addon/ips/calendar/xml/hooks/index_upcoming_events.xml In the output function, you'd just need to change the code to this.

 

<?php   	 
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'calendar' ) . '/sources/hooks.php', 'app_calendar_classes_hooks', 'calendar' );
       $gateway     = new $classToLoad( ipsRegistry::instance() );

  	 print $gateway->getUpcomingEvents(); 
?>

Link to comment
Share on other sites

  • 2 weeks later...
  • Management

Try this one instead.

 

<?php			
  	 $classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'calendar' ) .'/modules_public/calendar/view.php', 'public_calendar_calendar_view' );
	$cal = new $classToLoad();
	$cal->makeRegistryShortcuts( $this->registry );

	/* Return calendar */
	print "<div id='hook_calendar' class='calendar_wrap'>". $cal->getMiniCalendar( date('n'), date('Y') ) . '</div><br />';
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...