1
brentw
notification functionality for non-templated modules
  • 2006/1/17 19:33

  • brentw

  • Just popping in

  • Posts: 18

  • Since: 2005/5/25


Hello all.

I have a few modules that have been modified to work w/in XOOPS but only take advantage of the security features. However, I'd like to add notifications funcationality to them. I've made the appropriate changes in the "xoops_version.php" file, but I cannot get the notification HTML to print out at the bottom of my index.php page.

From what I can tell, I have to create a template that includes the
"db:system_notifiation_select.html"
file and then set use this template from w/in my php file
(e.g. $xoopsOption['template_main'] = <my_template_file>.

Is there anyway to include the "db:system_notifiation_select.html" directly from php?

This was most likely a terrible description of my problem.

Thanks!

Brent Weatherly

2
Dave_L
Re: notification functionality for non-templated modules
  • 2006/1/17 19:54

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Try this:

global $xoopsTpl;

$notification_html $xoopsTpl->fetch('db:system_notification_select.html');

echo 
$notification_html;

3
brentw
Re: notification functionality for non-templated modules
  • 2006/1/17 20:10

  • brentw

  • Just popping in

  • Posts: 18

  • Since: 2005/5/25


Ooooh...this is close.

The notification info shows up as long as I place this code AFTER the "include footer.php" code. But then it doesn't output in the correct format. If I place this code before the footer, I see nothing.

Thanks!

4
Dave_L
Re: notification functionality for non-templated modules
  • 2006/1/17 20:25

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Hmmm ...

You could try my trick for quick-and-dirty templating:

.php file:

...
$xoopsOption['template_main'] = 'modname_filename.html';

include 
XOOPS_ROOT_PATH.'/header.php';

// Quick & dirty way of using Smarty templates for all output: collect all output into a buffer,
// then assign the buffer to a template variable.
ob_start();

... do 
output here ...

$output_buffer ob_get_contents();
ob_end_clean();
$xoopsTpl->assign('output_buffer'$output_buffer);

include 
XOOPS_ROOT_PATH.'/footer.php';
...


.html file (template):

<{$output_buffer}>
<{include 
file="db:system_notification_select.html"}>

(Nothing else is needed in the template.)

xoops_version.php:

...
$modversion['templates'][1]['file'] = 'modname_filename.html';
$modversion['templates'][1]['description'] = 'Blah blah blah';
...

5
brentw
Re: notification functionality for non-templated modules
  • 2006/1/17 20:44

  • brentw

  • Just popping in

  • Posts: 18

  • Since: 2005/5/25


You da man. That works brilliantly. That's the "real" way to wrap code in Xoops!

6
Dave_L
Re: notification functionality for non-templated modules
  • 2006/1/17 20:53

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Remember, it's just a Q&D shortcut that shouldn't be used for a "real" module. Marco and his QA team wouldn't like to see this in a published module.

Login

Who's Online

213 user(s) are online (139 user(s) are browsing Support Forums)


Members: 0


Guests: 213


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits