Integration of files from includes

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
wintstar
Registered User
Posts: 280
Joined: Sat Mar 07, 2009 12:39 pm

Integration of files from includes

Post by wintstar » Tue Feb 25, 2014 7:18 am

How do you connect in an extension files for example from / includes?

include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

Am I doing this as before, I get the following error message:
Parse error: syntax error, unexpected 'include' (T_INCLUDE), expecting function (T_FUNCTION)

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25196
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Integration of files from includes

Post by Paul » Tue Feb 25, 2014 9:44 am

what is just in front of these lines, the error is not in this line it looks like.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
wintstar
Registered User
Posts: 280
Joined: Sat Mar 07, 2009 12:39 pm

Re: Integration of files from includes

Post by wintstar » Tue Feb 25, 2014 10:01 am

Code: Select all

namespace wintstar\startpage\controller;




interface main_interface
{
/**
*/

/**
* @ignore
*/

include($phpbb_root_path . 'includes/functions_display.php' . $phpEx); 


// Mark notifications read
if (($mark_notification = $request->variable('mark_notification', 0)))
{
	$phpbb_notifications = $phpbb_container->get('notification_manager');

	$notification = $phpbb_notifications->load_notifications(array(
		'notification_id'	=> $mark_notification
	));

	if (isset($notification['notifications'][$mark_notification]))
	{
		$notification = $notification['notifications'][$mark_notification];

		$notification->mark_read();

		if (($redirect = $request->variable('redirect', '')))
		{
			redirect(append_sid($phpbb_root_path . $redirect));
		}

		redirect($notification->get_url());
	}
}

display_forums('', $config['load_moderators']);

$order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend';
// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
	$sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
		FROM ' . GROUPS_TABLE . '
		WHERE group_legend > 0
		ORDER BY ' . $order_legend . ' ASC';
}
else
{
	$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend
		FROM ' . GROUPS_TABLE . ' g
		LEFT JOIN ' . USER_GROUP_TABLE . ' ug
			ON (
				g.group_id = ug.group_id
				AND ug.user_id = ' . $user->data['user_id'] . '
				AND ug.user_pending = 0
			)
		WHERE g.group_legend > 0
			AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
		ORDER BY g.' . $order_legend . ' ASC';
}
$result = $db->sql_query($sql);

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25196
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Integration of files from includes

Post by Paul » Tue Feb 25, 2014 10:16 am

I suggest you read this: http://nl1.php.net/interface it seems you dont understand the basics of OOP.

You are defining(I guess) a function in a interface, however in a interface you only declare a function. Besides that, the code isn't even in a function. The actual code needs to be in a method in a class, that implements the interface. There is no code in the interface, only method declarations.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
wintstar
Registered User
Posts: 280
Joined: Sat Mar 07, 2009 12:39 pm

Re: Integration of files from includes

Post by wintstar » Wed Feb 26, 2014 2:44 pm

Thanks Paul :)

Post Reply

Return to “Extension Writers Discussion”