xref: /web-php/urlhowto.php (revision bf863a18)
1<?php
2$_SERVER['BASE_PAGE'] = 'urlhowto.php';
3include_once __DIR__ . '/include/prepend.inc';
4
5$SIDEBAR_DATA = '
6<h3>URL examples</h3>
7<p>
8 We have many kind of URL shortcuts. Here are some
9 examples you can try out:
10</p>
11<ul class="simple">
12 <li><a href="' . $MYSITE . 'echo">/echo</a></li>
13 <li><a href="' . $MYSITE . 'it/echo">/it/echo</a></li>
14 <li><a href="' . $MYSITE . 'imap">/imap</a></li>
15 <li><a href="' . $MYSITE . 'downloads">/downloads</a></li>
16 <li><a href="' . $MYSITE . 'searchterm">/searchterm</a></li>
17</ul>
18
19<h3>My PHP.net</h3>
20<p>
21 URL shortcut behaviour is greatly influenced by
22 your <a href="/my.php">language preferences</a>
23 detected and set.
24</p>
25';
26
27site_header("URL Howto", ["current" => "help"]);
28function a($href): void {
29    global $MYSITE;
30    echo '<a href="' . $MYSITE . $href . '">' . $MYSITE . $href . '</a>';
31}
32
33?>
34
35<h1>Navigation tips&tricks</h1>
36
37<p>
38 When using the PHP.net website, there is even no need to get to
39 a search box to access the content you would like to see quickly.
40 You can use short PHP.net URLs to access pages directly.
41</p>
42
43<p>
44 Note, that these shortcuts are expected to work on all mirror
45 sites, not just at the main site. If you find that some of these
46 shortcuts are not working on your mirror site, please report them
47 as a "PHP.net Website Problem" at
48 <a href="http://bugs.php.net/">http://bugs.php.net/</a>.
49</p>
50
51<p>
52 There are currently three types of URLs you can use this way.
53</p>
54
55<h2>Page shortcuts</h2>
56
57<p>
58 If you write in a PHP.net URL (e.g. <kbd><?php echo $MYSITE; ?>get-involved</kbd>,
59 first this URL is matched against the PHP.net pages. If there is
60 a page named <em>get-involved.php</em>, then you'll get that page
61 immediately. This type of shortcut makes easy to type in a link
62 in an IRC conversation or mailing list message. If the script
63 finds no page with this name, it tries to find a manual page.
64</p>
65
66<h2>Manual shortcuts</h2>
67
68<p>
69 If your URL can't be matched with a page name, a manual page
70 is searched for your query. This is the case for the
71 <kbd><?php echo $MYSITE; ?>preg_match</kbd> URL. The following pages
72 are searched for in the manual:</p>
73<ul>
74 <li>Chapter pages (e.g. <?php a("installation") ?>)</li>
75 <li>Reference pages (e.g. <?php a("imap") ?>)</li>
76 <li>Function pages (e.g. <?php a("join") ?>)</li>
77 <li>Class pages (e.g. <?php a("dir") ?>)</li>
78 <li>Feature pages (e.g. <?php a("commandline") ?>)</li>
79 <li>Control structure pages (e.g. <?php a("while") ?>)</li>
80 <li>Other language pages (e.g. <?php a("oop") ?>)</li>
81</ul>
82<p>
83 Since there are several manual pages that could potentially match the query
84 (extension, class, function name..) you are encouraged to use their prefix/suffix:
85</p>
86<ul>
87 <li>Extension <abbr title="Table of Contents">TOC</abbr>:
88  <kbd><?php echo $MYSITE ?><var>book.extname</var></kbd>
89  (e.g. <?php a("book.dom")?>).
90 </li>
91 <li>Extension intro pages:
92  <kbd><?php echo $MYSITE ?><var>intro.extname</var></kbd>
93  (e.g. <?php a("intro.array") ?>).
94 </li>
95 <li>Extension setup <abbr title="Table of Contents">TOC</abbr>:
96  <kbd><?php echo $MYSITE ?><var>extname.setup</var></kbd>
97  (e.g. <?php a("intl.setup") ?>).
98 </li>
99 <li>Extension install chapter:
100  <kbd><?php echo $MYSITE ?><var>extname.installation</var></kbd>
101  (e.g. <?php a("apc.installation") ?>).
102 </li>
103 <li>Extension configuration:
104  <kbd><?php echo $MYSITE ?><var>extname.configuration</var></kbd>
105  (e.g. <?php a("session.configuration") ?>).
106 </li>
107 <li>Extension resources:
108  <kbd><?php echo $MYSITE ?><var>extname.resources</var></kbd>
109  (e.g. <?php a("mysql.resources") ?>).
110 </li>
111 <li>Extension constants:
112  <kbd><?php echo $MYSITE ?><var>extname.constants</var></kbd>
113  (e.g. <?php a("image.constants") ?>).
114 </li>
115 <li>Class synopsis:
116  <kbd><?php echo $MYSITE ?><var>class.classname</var></kbd>
117  (e.g. <?php a("class.xmlreader") ?>).
118 </li>
119 <li>Class method:
120  <kbd><?php echo $MYSITE ?><var>classname.methodname</var></kbd>
121  (e.g. <?php a("pdo.query") ?>).
122 </li>
123 <li>Functions:
124  <kbd><?php echo $MYSITE ?><var>function.functionname</var></kbd>
125  (e.g. <?php a("function.strpos") ?>).
126 </li>
127</ul>
128
129<p>
130 This kind of URL will bring up the manual page in
131 <a href="/my.php">your preferred language</a>. You can
132 always override this setting by explicitly providing
133 the language you want to get to. You can embed the language
134 in the URL before the manual search term.
135 <kbd><?php echo $MYSITE; ?>fr/sort</kbd> will bring up
136 the French manual page for sort() for example.
137</p>
138
139<h2>Search shortcuts</h2>
140
141<p>
142 At last, if there is no PHP page, and there is no manual
143 page matching your query, a search is issued on the site with
144 the query you typed into the URL. An example of this kind
145 of URL is <kbd><?php echo $MYSITE; ?><var>search_for_this</var></kbd>.
146 The exact behaviour of this search is affected by
147 <a href="/my.php">your own My PHP.net settings</a>.
148</p>
149
150<h2>PHP Developer shortcuts</h2>
151<ul>
152 <li>Changelog information: <a href="http://php.net/changelog">http://php.net/changelog</a>
153  (e.g. latest PHP changelog. php5news = latest PHP 5 NEWS, phptrunknews = latest PHP trunk NEWS)
154 </li>
155 <li>Bugs: <a href="http://php.net/42">http://php.net/42</a>
156  (any numeric value redirects to said bug # at bugs.php.net)
157 </li>
158</ul>
159
160<h2>Even smarter tricks</h2>
161
162<p>
163 We also have shortcut aliases to access some resources more quickly,
164 and with a nice URL. Aliases are translated to their relevant shortcuts
165 before the first step (PHP page search) mentioned above. Some examples
166 of shortcut aliases: <?php a("whatisphp") ?>,
167 <?php a("php4news") ?>. The latter is an external page
168 alias, as it points to a file on the Git server, containing information
169 about changes in PHP. There are also some convenient aliases(e.g.
170 <?php a("de/phpversion") ?> which displays the German
171 manual page for the phpversion() function.
172</p>
173
174
175<?php site_footer(); ?>
176