diff options
Diffstat (limited to 'phpBB/docs/coding-guidelines.html')
-rw-r--r-- | phpBB/docs/coding-guidelines.html | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 837ae55227..38410fd0cc 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -399,12 +399,12 @@ do_stuff($str); <p class="bad">// Sometimes single quotes are just not right</p> <div class="codebox"><pre> -$post_url = $phpbb_root_path . 'posting.' . $phpEx . '?mode=' . $mode . '&amp;start=' . $start; +$some_string = $board_url . 'someurl.php?mode=' . $mode . '&amp;start=' . $start; </pre></div> <p class="good">// Double quotes are sometimes needed to not overcroud the line with concentinations</p> <div class="codebox"><pre> -$post_url = "{$phpbb_root_path}posting.$phpEx?mode=$mode&amp;start=$start"; +$some_string = "{$board_url}someurl.php?mode=$mode&amp;start=$start"; </pre></div> <p>In SQL Statements mixing single and double quotes is partly allowed (following the guidelines listed here about SQL Formatting), else it should be tryed to only use one method - mostly single quotes.</p> @@ -925,12 +925,18 @@ trigger_error('NO_MODE', E_USER_ERROR); <h4>Url formatting</h4> - <p>All urls pointing to internal files need to be prepended by the <code>$phpbb_root_path</code> variable. Within the administration control panel all urls pointing to internal files need to be prepended by the <code>$phpbb_admin_path</code> variable. This makes sure the path is always correct and users being able to just rename the admin folder and the acp still working as intended (though some links will fail and the code need to be slightly adjusted).</p> + <p>All urls pointing to internal files need to be prepended by the <code>PHPBB_ROOT_PATH</code> constant. Within the administration control panel all urls pointing to internal files need to be prepended by the <code>PHPBB_ADMIN_PATH</code> constant. This makes sure the path is always correct and users being able to just rename the admin folder and the acp still working as intended (though some links will fail and the code need to be slightly adjusted).</p> <p>The <code>append_sid()</code> function from 2.0.x is available too, though does not handle url alterations automatically. Please have a look at the code documentation if you want to get more details on how to use append_sid(). A sample call to append_sid() can look like this:</p> <div class="codebox"><pre> -append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) +append_sid(PHPBB_ROOT_PATH . 'memberlist.' . PHP_EXT, 'mode=group&amp;g=' . $row['group_id']) + </pre></div> + + <p>For shorter writing internal urls are allowed to be written in short notation, not providing the root path and the extension. The append_sid() function will prepend the root path and append the extension automatically (and before calling the hook).</p> + + <div class="codebox"><pre> +append_sid('memberlist', 'mode=group&amp;g=' . $row['group_id']) </pre></div> <h4>General function usage: </h4> |