Code: Select all
$this->helper->url('someclass');
Code: Select all
$this->helper->route('routingname', array('name' => 'class_function');
Code: Select all
$this->helper->url('someclass');
Code: Select all
$this->helper->route('routingname', array('name' => 'class_function');
Thanks for pointing this out.neufke wrote:@nick: maybe important to mention that allhas been replaced byCode: Select all
$this->helper->url('someclass');
Therefore all pre-3.1.0b4 examples aren't working anymore...Code: Select all
$this->helper->route('routingname', array('name' => 'class_function');
Code: Select all
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/feedback');
$user->add_lang('posting');
page_header($user->lang['FB_TITLE']);
$template->assign_block_vars('navlinks',array(
'FORUM_NAME' => $user->lang['FB_FEEDBACK'],
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}feedback.$phpEx"),
));
if(!$auth->acl_get('u_fb_access'))
{
trigger_error($user->lang['FB_CANNOTACCESS']);
}
$mode = request_var('mode', '');
switch($mode)
{
case 'feedback':
show_feedback(0);
break;
case 'myfeedback':
show_feedback(1);
break;
case 'add':
add_feedback();
break;
case 'edit':
edit_feedback();
break;
case 'delete':
delete_feedback();
break;
case 'best';
best_feedback();
break;
case 'worst';
worst_feedback();
break;
default:
index();
}
$template->set_filenames(array(
'body' => 'feedback_body.html'
));
page_footer();
exit();
Code: Select all
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/feedback');
$user->add_lang('posting');
Code: Select all
include($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
Code: Select all
$mode = request_var('mode', '');
switch($mode)
{
case 'feedback':
show_feedback(0);
break;
case 'myfeedback':
show_feedback(1);
break;
[ ... ]
default:
index();
}
$template->set_filenames(array(
'body' => 'feedback_body.html'
));
page_footer();
exit();
Code: Select all
<?php
namespace vendor\feedback\controller;
class controller
{
protected $auth;
protected $helper;
protected $template;
protected $user;
public function __construct(\phpbb\auth\auth $auth, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\user $user)
{
$this->auth = $auth;
$this->helper = $helper;
$this->template = $template;
$this->user = $user;
}
public function display($mode)
{
$this->user->add_lang_ext('vendor/feedback', 'feedback');
if (!$this->auth->acl_get('u_fb_access'))
{
trigger_error($this->user->lang('FB_CANNOTACCESS'));
}
switch($mode)
{
case 'feedback':
show_feedback(0);
break;
case 'myfeedback':
show_feedback(1);
break;
case 'add':
add_feedback();
break;
case 'edit':
edit_feedback();
break;
case 'delete':
delete_feedback();
break;
case 'best';
best_feedback();
break;
case 'worst';
worst_feedback();
break;
default:
index();
}
$this->template->assign_block_vars('navlinks', array(
'U_VIEW_FORUM' => $this->helper->route('vendor_feedback_controller'),
'FORUM_NAME' => $this->user->lang('FB_FEEDBACK'),
));
return $this->helper->render('feedback_body.html', $this->user->lang('FB_TITLE'));
}
}
Thanks a lot for your code, it will be of GREAT helpVSE wrote:Although this is not neccessarily exactly what it needs to be to work, a quick conversion of your old controller to the new look would be something like this [...]
Code: Select all
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
Code: Select all
$pm_parser = new parse_message();
$pm_parser->message = sprintf($lang['FB_NEWFEEDBACKMSG'], $vote_text, $user->data['username']);
$pm_parser->parse(true, true, true, false, false, true, true);
$pm_data = array(
'from_user_id' => $user->data['user_id'],
'from_user_ip' => $user->ip,
'from_username' => $user->data['username'],
'enable_sig' => false,
'enable_bbcode' => false,
'enable_smilies' => false,
'enable_urls' => false,
'icon_id' => 0,
'bbcode_bitfield' => $pm_parser->bbcode_bitfield,
'bbcode_uid' => $pm_parser->bbcode_uid,
'message' => $pm_parser->message,
'address_list' => array('u' => array($to_id => 'to')),
);
submit_pm('post', $lang['FB_NEWFEEDBACK'], $pm_data, false);
Code: Select all
$sql = "SELECT column
FROM tablename
ORDER BY column";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
//do stuff
}
Code: Select all
No route found for "GET /home"
Code: Select all
No route found for "GET /newspage"
Not visiting the right url. It's http://localhost/phpBB3/app.php/newssopi wrote:Again I tried to access the page via:
http://localhost/phpBB3/app.php/newspage
And got the same errormessage as before:What am I doing wrong? It has to be something very stupidCode: Select all
No route found for "GET /newspage"