Deployed 506b5bb to 5.4 with MkDocs 1.1.2 and mike 0.5.5
[GitHub/WoltLab/woltlab.github.io.git] / 5.4 / getting-started / index.html
CommitLineData
45ca63d0
TD
1
2<!doctype html>
3<html lang="en" class="no-js">
4 <head>
5
6 <meta charset="utf-8">
7 <meta name="viewport" content="width=device-width,initial-scale=1">
8
9
10
11
12 <link rel="shortcut icon" href="../assets/default.favicon.ico">
fb88dc6e 13 <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.0.5">
45ca63d0
TD
14
15
16
17 <title>Getting Started - WoltLab Suite Documentation</title>
18
19
20
fb88dc6e 21 <link rel="stylesheet" href="../assets/stylesheets/main.77f3fd56.min.css">
45ca63d0
TD
22
23
24 <link rel="stylesheet" href="../assets/stylesheets/palette.7fa14f5b.min.css">
25
26
27
28 <meta name="theme-color" content="#009485">
29
30
31
32
33
34
35
36
37 <link rel="stylesheet" href="../stylesheets/extra.css">
38
39
40
41
42
43 </head>
44
45
46
47
48
49
50
51 <body dir="ltr" data-md-color-scheme="" data-md-color-primary="teal" data-md-color-accent="">
52
53
54
55 <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
56 <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
57 <label class="md-overlay" for="__drawer"></label>
58 <div data-md-component="skip">
59
60
61 <a href="#creating-a-simple-package" class="md-skip">
62 Skip to content
63 </a>
64
65 </div>
66 <div data-md-component="announce">
67
68 <aside class="md-announce">
69 <div class="md-announce__inner md-grid md-typeset">
70
71 <a href="https://www.woltlab.com">Back to <strong>woltlab.com</strong></a>
72
73 </div>
74 </aside>
75
76 </div>
77
78
79
80<header class="md-header" data-md-component="header">
81 <nav class="md-header__inner md-grid" aria-label="Header">
82 <a href=".." title="WoltLab Suite Documentation" class="md-header__button md-logo" aria-label="WoltLab Suite Documentation">
83
84 <img src="../assets/logo.png" alt="logo">
85
86 </a>
87 <label class="md-header__button md-icon" for="__drawer">
88 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
89 </label>
90 <div class="md-header__title" data-md-component="header-title">
91 <div class="md-header__ellipsis">
92 <div class="md-header__topic">
93 <span class="md-ellipsis">
94 WoltLab Suite Documentation
95 </span>
96 </div>
97 <div class="md-header__topic" data-md-component="header-topic">
98 <span class="md-ellipsis">
99
100 Getting Started
101
102 </span>
103 </div>
104 </div>
105 </div>
106 <div class="md-header__options">
107
108 </div>
109
110 <label class="md-header__button md-icon" for="__search">
111 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
112 </label>
113
114<div class="md-search" data-md-component="search" role="dialog">
115 <label class="md-search__overlay" for="__search"></label>
116 <div class="md-search__inner" role="search">
117 <form class="md-search__form" name="search">
118 <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active" required>
119 <label class="md-search__icon md-icon" for="__search">
120 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
121 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
122 </label>
123 <button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
124 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
125 </button>
126 </form>
127 <div class="md-search__output">
128 <div class="md-search__scrollwrap" data-md-scrollfix>
129 <div class="md-search-result" data-md-component="search-result">
130 <div class="md-search-result__meta">
131 Initializing search
132 </div>
133 <ol class="md-search-result__list"></ol>
134 </div>
135 </div>
136 </div>
137 </div>
138</div>
139
140
141 </nav>
142</header>
143
144 <div class="md-container" data-md-component="container">
145
146
147
148
149 <main class="md-main" data-md-component="main">
150 <div class="md-main__inner md-grid">
151
152
153
154 <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
155 <div class="md-sidebar__scrollwrap">
156 <div class="md-sidebar__inner">
157
158
159
160
161
162<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
163 <label class="md-nav__title" for="__drawer">
164 <a href=".." title="WoltLab Suite Documentation" class="md-nav__button md-logo" aria-label="WoltLab Suite Documentation">
165
166 <img src="../assets/logo.png" alt="logo">
167
168 </a>
169 WoltLab Suite Documentation
170 </label>
171
172 <ul class="md-nav__list" data-md-scrollfix>
173
174
175
176
177
178
179
180
181
182
183 <li class="md-nav__item md-nav__item--active">
184
185 <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
186
187
188
189
190 <label class="md-nav__link md-nav__link--active" for="__toc">
191 Getting Started
192 <span class="md-nav__icon md-icon"></span>
193 </label>
194
195 <a href="./" class="md-nav__link md-nav__link--active">
196 Getting Started
197 </a>
198
199
200<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
201
202
203
204
205
206 <label class="md-nav__title" for="__toc">
207 <span class="md-nav__icon md-icon"></span>
208 Table of contents
209 </label>
210 <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
211
212 <li class="md-nav__item">
213 <a href="#setup-and-requirements" class="md-nav__link">
214 Setup and Requirements
215 </a>
216
217</li>
218
219 <li class="md-nav__item">
220 <a href="#the-packagexml-file" class="md-nav__link">
221 The package.xml File
222 </a>
223
224</li>
225
226 <li class="md-nav__item">
227 <a href="#the-php-class" class="md-nav__link">
228 The PHP Class
229 </a>
230
231</li>
232
233 <li class="md-nav__item">
234 <a href="#the-template" class="md-nav__link">
235 The Template
236 </a>
237
238</li>
239
240 <li class="md-nav__item">
241 <a href="#the-page-definition" class="md-nav__link">
242 The Page Definition
243 </a>
244
245</li>
246
247 <li class="md-nav__item">
248 <a href="#building-the-package" class="md-nav__link">
249 Building the Package
250 </a>
251
252</li>
253
254 <li class="md-nav__item">
255 <a href="#installation" class="md-nav__link">
256 Installation
257 </a>
258
259</li>
260
261 <li class="md-nav__item">
262 <a href="#developer-tools" class="md-nav__link">
263 Developer Tools
264 </a>
265
266 <nav class="md-nav" aria-label="Developer Tools">
267 <ul class="md-nav__list">
268
269 <li class="md-nav__item">
270 <a href="#registering-a-project" class="md-nav__link">
271 Registering a Project
272 </a>
273
274</li>
275
276 <li class="md-nav__item">
277 <a href="#synchronizing" class="md-nav__link">
278 Synchronizing
279 </a>
280
281</li>
282
283 </ul>
284 </nav>
285
286</li>
287
288 <li class="md-nav__item">
289 <a href="#appendix" class="md-nav__link">
290 Appendix
291 </a>
292
293 <nav class="md-nav" aria-label="Appendix">
294 <ul class="md-nav__list">
295
296 <li class="md-nav__item">
297 <a href="#template-guessing" class="md-nav__link">
298 Template Guessing
299 </a>
300
301</li>
302
303 </ul>
304 </nav>
305
306</li>
307
308 </ul>
309
310</nav>
311
312 </li>
313
314
315
316
317
318
319
320
321
322
323
324 <li class="md-nav__item md-nav__item--nested">
325
326
327 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2" type="checkbox" id="__nav_2" >
328
329 <label class="md-nav__link" for="__nav_2">
330 PHP API
331 <span class="md-nav__icon md-icon"></span>
332 </label>
333 <nav class="md-nav" aria-label="PHP API" data-md-level="1">
334 <label class="md-nav__title" for="__nav_2">
335 <span class="md-nav__icon md-icon"></span>
336 PHP API
337 </label>
338 <ul class="md-nav__list" data-md-scrollfix>
339
340
341
342
343
344 <li class="md-nav__item">
345 <a href="../php/pages/" class="md-nav__link">
346 Pages
347 </a>
348 </li>
349
350
351
352
353
354
355
356 <li class="md-nav__item">
357 <a href="../php/database-objects/" class="md-nav__link">
358 Database Objects
359 </a>
360 </li>
361
362
363
364
365
366
367
368 <li class="md-nav__item">
369 <a href="../php/database-access/" class="md-nav__link">
370 Database Access
371 </a>
372 </li>
373
374
375
376
377
378
379
380 <li class="md-nav__item">
381 <a href="../php/exceptions/" class="md-nav__link">
382 Exceptions
383 </a>
384 </li>
385
386
387
388
389
390
391
392
393 <li class="md-nav__item md-nav__item--nested">
394
395
396 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2_5" type="checkbox" id="__nav_2_5" >
397
398 <label class="md-nav__link" for="__nav_2_5">
399 API
400 <span class="md-nav__icon md-icon"></span>
401 </label>
402 <nav class="md-nav" aria-label="API" data-md-level="2">
403 <label class="md-nav__title" for="__nav_2_5">
404 <span class="md-nav__icon md-icon"></span>
405 API
406 </label>
407 <ul class="md-nav__list" data-md-scrollfix>
408
409
410
411
412
413 <li class="md-nav__item">
414 <a href="../php/api/caches/" class="md-nav__link">
415 Caches
416 </a>
417 </li>
418
419
420
421
422
423
424
425 <li class="md-nav__item">
426 <a href="../php/api/comments/" class="md-nav__link">
427 Comments
428 </a>
429 </li>
430
431
432
433
434
435
436
437 <li class="md-nav__item">
438 <a href="../php/api/cronjobs/" class="md-nav__link">
439 Cronjobs
440 </a>
441 </li>
442
443
444
445
446
447
448
449 <li class="md-nav__item">
450 <a href="../php/api/events/" class="md-nav__link">
451 Events
452 </a>
453 </li>
454
455
456
457
458
459
460
461
462 <li class="md-nav__item md-nav__item--nested">
463
464
465 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2_5_5" type="checkbox" id="__nav_2_5_5" >
466
467 <label class="md-nav__link" for="__nav_2_5_5">
468 Form Builder
469 <span class="md-nav__icon md-icon"></span>
470 </label>
471 <nav class="md-nav" aria-label="Form Builder" data-md-level="3">
472 <label class="md-nav__title" for="__nav_2_5_5">
473 <span class="md-nav__icon md-icon"></span>
474 Form Builder
475 </label>
476 <ul class="md-nav__list" data-md-scrollfix>
477
478
479
480
481
482 <li class="md-nav__item">
483 <a href="../php/api/form_builder/overview/" class="md-nav__link">
484 Overview
485 </a>
486 </li>
487
488
489
490
491
492
493
494 <li class="md-nav__item">
495 <a href="../php/api/form_builder/structure/" class="md-nav__link">
496 Structure
497 </a>
498 </li>
499
500
501
502
503
504
505
506 <li class="md-nav__item">
507 <a href="../php/api/form_builder/form_fields/" class="md-nav__link">
508 Fields
509 </a>
510 </li>
511
512
513
514
515
516
517
518 <li class="md-nav__item">
519 <a href="../php/api/form_builder/validation_data/" class="md-nav__link">
520 Validation and Data
521 </a>
522 </li>
523
524
525
526
527
528
529
530 <li class="md-nav__item">
531 <a href="../php/api/form_builder/dependencies/" class="md-nav__link">
532 Dependencies
533 </a>
534 </li>
535
536
537
538 </ul>
539 </nav>
540 </li>
541
542
543
544
545
546
547
548 <li class="md-nav__item">
549 <a href="../php/api/package_installation_plugins/" class="md-nav__link">
550 Package Installation Plugins
551 </a>
552 </li>
553
554
555
556
557
558
559
560 <li class="md-nav__item">
561 <a href="../php/api/user_activity_points/" class="md-nav__link">
562 User Activity Points
563 </a>
564 </li>
565
566
567
568
569
570
571
572 <li class="md-nav__item">
573 <a href="../php/api/user_notifications/" class="md-nav__link">
574 User Notifications
575 </a>
576 </li>
577
578
579
580
581
582
583
584 <li class="md-nav__item">
585 <a href="../php/api/sitemaps/" class="md-nav__link">
586 Sitemaps
587 </a>
588 </li>
589
590
591
592 </ul>
593 </nav>
594 </li>
595
596
597
598
599
600
601
602 <li class="md-nav__item">
603 <a href="../php/code-style/" class="md-nav__link">
604 Code Style
605 </a>
606 </li>
607
608
609
610
611
612
613
614 <li class="md-nav__item">
615 <a href="../php/apps/" class="md-nav__link">
616 Apps
617 </a>
618 </li>
619
620
621
622
623
624
625
626 <li class="md-nav__item">
627 <a href="../php/gdpr/" class="md-nav__link">
628 GDPR
629 </a>
630 </li>
631
632
633
634 </ul>
635 </nav>
636 </li>
637
638
639
640
641
642
643
644
645
646
647
648 <li class="md-nav__item md-nav__item--nested">
649
650
651 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" >
652
653 <label class="md-nav__link" for="__nav_3">
654 Languages, Templates & CSS
655 <span class="md-nav__icon md-icon"></span>
656 </label>
657 <nav class="md-nav" aria-label="Languages, Templates & CSS" data-md-level="1">
658 <label class="md-nav__title" for="__nav_3">
659 <span class="md-nav__icon md-icon"></span>
660 Languages, Templates & CSS
661 </label>
662 <ul class="md-nav__list" data-md-scrollfix>
663
664
665
666
667
668 <li class="md-nav__item">
669 <a href="../view/languages/" class="md-nav__link">
670 Languages
671 </a>
672 </li>
673
674
675
676
677
678
679
680 <li class="md-nav__item">
681 <a href="../view/templates/" class="md-nav__link">
682 Templates
683 </a>
684 </li>
685
686
687
688
689
690
691
692 <li class="md-nav__item">
693 <a href="../view/css/" class="md-nav__link">
694 CSS
695 </a>
696 </li>
697
698
699
700 </ul>
701 </nav>
702 </li>
703
704
705
706
707
708
709
710
711
712
713
714 <li class="md-nav__item md-nav__item--nested">
715
716
717 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" >
718
719 <label class="md-nav__link" for="__nav_4">
720 JavaScript API
721 <span class="md-nav__icon md-icon"></span>
722 </label>
723 <nav class="md-nav" aria-label="JavaScript API" data-md-level="1">
724 <label class="md-nav__title" for="__nav_4">
725 <span class="md-nav__icon md-icon"></span>
726 JavaScript API
727 </label>
728 <ul class="md-nav__list" data-md-scrollfix>
729
730
731
732
733
734 <li class="md-nav__item">
735 <a href="../javascript/general-usage/" class="md-nav__link">
736 General Usage
737 </a>
738 </li>
739
740
741
742
743
744
745
746
747 <li class="md-nav__item md-nav__item--nested">
748
749
750 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4_2" type="checkbox" id="__nav_4_2" >
751
752 <label class="md-nav__link" for="__nav_4_2">
753 New API
754 <span class="md-nav__icon md-icon"></span>
755 </label>
756 <nav class="md-nav" aria-label="New API" data-md-level="2">
757 <label class="md-nav__title" for="__nav_4_2">
758 <span class="md-nav__icon md-icon"></span>
759 New API
760 </label>
761 <ul class="md-nav__list" data-md-scrollfix>
762
763
764
765
766
767 <li class="md-nav__item">
768 <a href="../javascript/new-api_writing-a-module/" class="md-nav__link">
769 Writing a module
770 </a>
771 </li>
772
773
774
775
776
777
778
779 <li class="md-nav__item">
780 <a href="../javascript/new-api_data-structures/" class="md-nav__link">
781 Data Structures
782 </a>
783 </li>
784
785
786
787
788
789
790
791 <li class="md-nav__item">
792 <a href="../javascript/new-api_core/" class="md-nav__link">
793 Core Functions
794 </a>
795 </li>
796
797
798
799
800
801
802
803 <li class="md-nav__item">
804 <a href="../javascript/new-api_dom/" class="md-nav__link">
805 DOM
806 </a>
807 </li>
808
809
810
811
812
813
814
815 <li class="md-nav__item">
816 <a href="../javascript/new-api_events/" class="md-nav__link">
817 Event Handling
818 </a>
819 </li>
820
821
822
823
824
825
826
827 <li class="md-nav__item">
828 <a href="../javascript/new-api_ajax/" class="md-nav__link">
829 Ajax
830 </a>
831 </li>
832
833
834
835
836
837
838
839 <li class="md-nav__item">
840 <a href="../javascript/new-api_dialogs/" class="md-nav__link">
841 Dialogs
842 </a>
843 </li>
844
845
846
847
848
849
850
851 <li class="md-nav__item">
852 <a href="../javascript/new-api_browser/" class="md-nav__link">
853 Browser and Screen Sizes
854 </a>
855 </li>
856
857
858
859
860
861
862
863 <li class="md-nav__item">
864 <a href="../javascript/new-api_ui/" class="md-nav__link">
865 User Interface
866 </a>
867 </li>
868
869
870
871 </ul>
872 </nav>
873 </li>
874
875
876
877
878
879
880
881 <li class="md-nav__item">
882 <a href="../javascript/legacy-api/" class="md-nav__link">
883 Legacy API
884 </a>
885 </li>
886
887
888
889
890
891
892
893 <li class="md-nav__item">
894 <a href="../javascript/helper-functions/" class="md-nav__link">
895 Helper Functions
896 </a>
897 </li>
898
899
900
901
902
903
904
905 <li class="md-nav__item">
906 <a href="../javascript/code-snippets/" class="md-nav__link">
907 Code Snippets
908 </a>
909 </li>
910
911
912
913 </ul>
914 </nav>
915 </li>
916
917
918
919
920
921
922
923
924
925
926
927 <li class="md-nav__item md-nav__item--nested">
928
929
930 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" >
931
932 <label class="md-nav__link" for="__nav_5">
933 Package Components
934 <span class="md-nav__icon md-icon"></span>
935 </label>
936 <nav class="md-nav" aria-label="Package Components" data-md-level="1">
937 <label class="md-nav__title" for="__nav_5">
938 <span class="md-nav__icon md-icon"></span>
939 Package Components
940 </label>
941 <ul class="md-nav__list" data-md-scrollfix>
942
943
944
945
946
947 <li class="md-nav__item">
948 <a href="../package/package-xml/" class="md-nav__link">
949 package.xml
950 </a>
951 </li>
952
953
954
955
956
957
958
959
960 <li class="md-nav__item md-nav__item--nested">
961
962
963 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5_2" type="checkbox" id="__nav_5_2" >
964
965 <label class="md-nav__link" for="__nav_5_2">
966 PIPs
967 <span class="md-nav__icon md-icon"></span>
968 </label>
969 <nav class="md-nav" aria-label="PIPs" data-md-level="2">
970 <label class="md-nav__title" for="__nav_5_2">
971 <span class="md-nav__icon md-icon"></span>
972 PIPs
973 </label>
974 <ul class="md-nav__list" data-md-scrollfix>
975
976
977
978
979
980 <li class="md-nav__item">
981 <a href="../package/pip/" class="md-nav__link">
982 Overview
983 </a>
984 </li>
985
986
987
988
989
990
991
992 <li class="md-nav__item">
993 <a href="../package/pip/acl-option/" class="md-nav__link">
994 aclOption
995 </a>
996 </li>
997
998
999
1000
1001
1002
1003
1004 <li class="md-nav__item">
1005 <a href="../package/pip/acp-menu/" class="md-nav__link">
1006 acpMenu
1007 </a>
1008 </li>
1009
1010
1011
1012
1013
1014
1015
1016 <li class="md-nav__item">
1017 <a href="../package/pip/acp-search-provider/" class="md-nav__link">
1018 acpSearchProvider
1019 </a>
1020 </li>
1021
1022
1023
1024
1025
1026
1027
1028 <li class="md-nav__item">
1029 <a href="../package/pip/acp-template/" class="md-nav__link">
1030 acpTemplate
1031 </a>
1032 </li>
1033
1034
1035
1036
1037
1038
1039
1040 <li class="md-nav__item">
1041 <a href="../package/pip/bbcode/" class="md-nav__link">
1042 bbcode
1043 </a>
1044 </li>
1045
1046
1047
1048
1049
1050
1051
1052 <li class="md-nav__item">
1053 <a href="../package/pip/box/" class="md-nav__link">
1054 box
1055 </a>
1056 </li>
1057
1058
1059
1060
1061
1062
1063
1064 <li class="md-nav__item">
1065 <a href="../package/pip/clipboard-action/" class="md-nav__link">
1066 clipboardAction
1067 </a>
1068 </li>
1069
1070
1071
1072
1073
1074
1075
1076 <li class="md-nav__item">
1077 <a href="../package/pip/core-object/" class="md-nav__link">
1078 coreObject
1079 </a>
1080 </li>
1081
1082
1083
1084
1085
1086
1087
1088 <li class="md-nav__item">
1089 <a href="../package/pip/cronjob/" class="md-nav__link">
1090 cronjob
1091 </a>
1092 </li>
1093
1094
1095
1096
1097
1098
1099
1100 <li class="md-nav__item">
1101 <a href="../package/pip/event-listener/" class="md-nav__link">
1102 eventListener
1103 </a>
1104 </li>
1105
1106
1107
1108
1109
1110
1111
1112 <li class="md-nav__item">
1113 <a href="../package/pip/file/" class="md-nav__link">
1114 file
1115 </a>
1116 </li>
1117
1118
1119
1120
1121
1122
1123
1124 <li class="md-nav__item">
1125 <a href="../package/pip/language/" class="md-nav__link">
1126 language
1127 </a>
1128 </li>
1129
1130
1131
1132
1133
1134
1135
1136 <li class="md-nav__item">
1137 <a href="../package/pip/media-provider/" class="md-nav__link">
1138 mediaProvider
1139 </a>
1140 </li>
1141
1142
1143
1144
1145
1146
1147
1148 <li class="md-nav__item">
1149 <a href="../package/pip/menu/" class="md-nav__link">
1150 menu
1151 </a>
1152 </li>
1153
1154
1155
1156
1157
1158
1159
1160 <li class="md-nav__item">
1161 <a href="../package/pip/menu-item/" class="md-nav__link">
1162 menuItem
1163 </a>
1164 </li>
1165
1166
1167
1168
1169
1170
1171
1172 <li class="md-nav__item">
1173 <a href="../package/pip/object-type/" class="md-nav__link">
1174 objectType
1175 </a>
1176 </li>
1177
1178
1179
1180
1181
1182
1183
1184 <li class="md-nav__item">
1185 <a href="../package/pip/object-type-definition/" class="md-nav__link">
1186 objectTypeDefinition
1187 </a>
1188 </li>
1189
1190
1191
1192
1193
1194
1195
1196 <li class="md-nav__item">
1197 <a href="../package/pip/option/" class="md-nav__link">
1198 option
1199 </a>
1200 </li>
1201
1202
1203
1204
1205
1206
1207
1208 <li class="md-nav__item">
1209 <a href="../package/pip/page/" class="md-nav__link">
1210 page
1211 </a>
1212 </li>
1213
1214
1215
1216
1217
1218
1219
1220 <li class="md-nav__item">
1221 <a href="../package/pip/pip/" class="md-nav__link">
1222 pip
1223 </a>
1224 </li>
1225
1226
1227
1228
1229
1230
1231
1232 <li class="md-nav__item">
1233 <a href="../package/pip/script/" class="md-nav__link">
1234 script
1235 </a>
1236 </li>
1237
1238
1239
1240
1241
1242
1243
1244 <li class="md-nav__item">
1245 <a href="../package/pip/smiley/" class="md-nav__link">
1246 smiley
1247 </a>
1248 </li>
1249
1250
1251
1252
1253
1254
1255
1256 <li class="md-nav__item">
1257 <a href="../package/pip/sql/" class="md-nav__link">
1258 sql
1259 </a>
1260 </li>
1261
1262
1263
1264
1265
1266
1267
1268 <li class="md-nav__item">
1269 <a href="../package/pip/style/" class="md-nav__link">
1270 style
1271 </a>
1272 </li>
1273
1274
1275
1276
1277
1278
1279
1280 <li class="md-nav__item">
1281 <a href="../package/pip/template/" class="md-nav__link">
1282 template
1283 </a>
1284 </li>
1285
1286
1287
1288
1289
1290
1291
1292 <li class="md-nav__item">
1293 <a href="../package/pip/template-listener/" class="md-nav__link">
1294 templateListener
1295 </a>
1296 </li>
1297
1298
1299
1300
1301
1302
1303
1304 <li class="md-nav__item">
1305 <a href="../package/pip/user-group-option/" class="md-nav__link">
1306 userGroupOption
1307 </a>
1308 </li>
1309
1310
1311
1312
1313
1314
1315
1316 <li class="md-nav__item">
1317 <a href="../package/pip/user-menu/" class="md-nav__link">
1318 userMenu
1319 </a>
1320 </li>
1321
1322
1323
1324
1325
1326
1327
1328 <li class="md-nav__item">
1329 <a href="../package/pip/user-notification-event/" class="md-nav__link">
1330 userNotificationEvent
1331 </a>
1332 </li>
1333
1334
1335
1336
1337
1338
1339
1340 <li class="md-nav__item">
1341 <a href="../package/pip/user-option/" class="md-nav__link">
1342 userOption
1343 </a>
1344 </li>
1345
1346
1347
1348
1349
1350
1351
1352 <li class="md-nav__item">
1353 <a href="../package/pip/user-profile-menu/" class="md-nav__link">
1354 userProfileMenu
1355 </a>
1356 </li>
1357
1358
1359
1360 </ul>
1361 </nav>
1362 </li>
1363
1364
1365
1366
1367
1368
1369
1370 <li class="md-nav__item">
1371 <a href="../package/database-php-api/" class="md-nav__link">
1372 Database PHP API
1373 </a>
1374 </li>
1375
1376
1377
1378 </ul>
1379 </nav>
1380 </li>
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392 <li class="md-nav__item md-nav__item--nested">
1393
1394
1395 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" >
1396
1397 <label class="md-nav__link" for="__nav_6">
1398 Migration
1399 <span class="md-nav__icon md-icon"></span>
1400 </label>
1401 <nav class="md-nav" aria-label="Migration" data-md-level="1">
1402 <label class="md-nav__title" for="__nav_6">
1403 <span class="md-nav__icon md-icon"></span>
1404 Migration
1405 </label>
1406 <ul class="md-nav__list" data-md-scrollfix>
1407
1408
1409
1410
1411
1412
1413 <li class="md-nav__item md-nav__item--nested">
1414
1415
1416 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_1" type="checkbox" id="__nav_6_1" >
1417
1418 <label class="md-nav__link" for="__nav_6_1">
1419 Migrating from WSC 5.3
1420 <span class="md-nav__icon md-icon"></span>
1421 </label>
1422 <nav class="md-nav" aria-label="Migrating from WSC 5.3" data-md-level="2">
1423 <label class="md-nav__title" for="__nav_6_1">
1424 <span class="md-nav__icon md-icon"></span>
1425 Migrating from WSC 5.3
1426 </label>
1427 <ul class="md-nav__list" data-md-scrollfix>
1428
1429
1430
1431
1432
1433 <li class="md-nav__item">
1434 <a href="../migration/wsc53/php/" class="md-nav__link">
1435 PHP API
1436 </a>
1437 </li>
1438
1439
1440
1441
1442
1443
1444
1445 <li class="md-nav__item">
1446 <a href="../migration/wsc53/session/" class="md-nav__link">
1447 Session Handling and Authentication
1448 </a>
1449 </li>
1450
1451
1452
1453
1454
1455
1456
1457 <li class="md-nav__item">
1458 <a href="../migration/wsc53/javascript/" class="md-nav__link">
1459 JavaScript
1460 </a>
1461 </li>
1462
1463
1464
1465
1466
1467
1468
1469 <li class="md-nav__item">
1470 <a href="../migration/wsc53/templates/" class="md-nav__link">
1471 Templates
1472 </a>
1473 </li>
1474
1475
1476
1477
1478
1479
1480
1481 <li class="md-nav__item">
1482 <a href="../migration/wsc53/libraries/" class="md-nav__link">
1483 Third Party Libraries
1484 </a>
1485 </li>
1486
1487
1488
1489 </ul>
1490 </nav>
1491 </li>
1492
1493
1494
1495
1496
1497
1498
1499
1500 <li class="md-nav__item md-nav__item--nested">
1501
1502
1503 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_2" type="checkbox" id="__nav_6_2" >
1504
1505 <label class="md-nav__link" for="__nav_6_2">
1506 Migrating from WSC 5.2
1507 <span class="md-nav__icon md-icon"></span>
1508 </label>
1509 <nav class="md-nav" aria-label="Migrating from WSC 5.2" data-md-level="2">
1510 <label class="md-nav__title" for="__nav_6_2">
1511 <span class="md-nav__icon md-icon"></span>
1512 Migrating from WSC 5.2
1513 </label>
1514 <ul class="md-nav__list" data-md-scrollfix>
1515
1516
1517
1518
1519
1520 <li class="md-nav__item">
1521 <a href="../migration/wsc52/php/" class="md-nav__link">
1522 PHP API
1523 </a>
1524 </li>
1525
1526
1527
1528
1529
1530
1531
1532 <li class="md-nav__item">
1533 <a href="../migration/wsc52/templates/" class="md-nav__link">
1534 Templates and Languages
1535 </a>
1536 </li>
1537
1538
1539
1540
1541
1542
1543
1544 <li class="md-nav__item">
1545 <a href="../migration/wsc52/libraries/" class="md-nav__link">
1546 Third Party Libraries
1547 </a>
1548 </li>
1549
1550
1551
1552 </ul>
1553 </nav>
1554 </li>
1555
1556
1557
1558
1559
1560
1561
1562
1563 <li class="md-nav__item md-nav__item--nested">
1564
1565
1566 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_3" type="checkbox" id="__nav_6_3" >
1567
1568 <label class="md-nav__link" for="__nav_6_3">
1569 Migrating from WSC 3.1
1570 <span class="md-nav__icon md-icon"></span>
1571 </label>
1572 <nav class="md-nav" aria-label="Migrating from WSC 3.1" data-md-level="2">
1573 <label class="md-nav__title" for="__nav_6_3">
1574 <span class="md-nav__icon md-icon"></span>
1575 Migrating from WSC 3.1
1576 </label>
1577 <ul class="md-nav__list" data-md-scrollfix>
1578
1579
1580
1581
1582
1583 <li class="md-nav__item">
1584 <a href="../migration/wsc31/php/" class="md-nav__link">
1585 PHP API
1586 </a>
1587 </li>
1588
1589
1590
1591 </ul>
1592 </nav>
1593 </li>
1594
1595
1596
1597
1598
1599
1600
1601
1602 <li class="md-nav__item md-nav__item--nested">
1603
1604
1605 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_4" type="checkbox" id="__nav_6_4" >
1606
1607 <label class="md-nav__link" for="__nav_6_4">
1608 Migrating from WSC 3.0
1609 <span class="md-nav__icon md-icon"></span>
1610 </label>
1611 <nav class="md-nav" aria-label="Migrating from WSC 3.0" data-md-level="2">
1612 <label class="md-nav__title" for="__nav_6_4">
1613 <span class="md-nav__icon md-icon"></span>
1614 Migrating from WSC 3.0
1615 </label>
1616 <ul class="md-nav__list" data-md-scrollfix>
1617
1618
1619
1620
1621
1622 <li class="md-nav__item">
1623 <a href="../migration/wsc30/php/" class="md-nav__link">
1624 PHP API
1625 </a>
1626 </li>
1627
1628
1629
1630
1631
1632
1633
1634 <li class="md-nav__item">
1635 <a href="../migration/wsc30/javascript/" class="md-nav__link">
1636 JavaScript API
1637 </a>
1638 </li>
1639
1640
1641
1642
1643
1644
1645
1646 <li class="md-nav__item">
1647 <a href="../migration/wsc30/templates/" class="md-nav__link">
1648 Templates
1649 </a>
1650 </li>
1651
1652
1653
1654
1655
1656
1657
1658 <li class="md-nav__item">
1659 <a href="../migration/wsc30/css/" class="md-nav__link">
1660 CSS
1661 </a>
1662 </li>
1663
1664
1665
1666
1667
1668
1669
1670 <li class="md-nav__item">
1671 <a href="../migration/wsc30/package/" class="md-nav__link">
1672 Package Components
1673 </a>
1674 </li>
1675
1676
1677
1678 </ul>
1679 </nav>
1680 </li>
1681
1682
1683
1684
1685
1686
1687
1688
1689 <li class="md-nav__item md-nav__item--nested">
1690
1691
1692 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_5" type="checkbox" id="__nav_6_5" >
1693
1694 <label class="md-nav__link" for="__nav_6_5">
1695 Migrating from WCF 2.1
1696 <span class="md-nav__icon md-icon"></span>
1697 </label>
1698 <nav class="md-nav" aria-label="Migrating from WCF 2.1" data-md-level="2">
1699 <label class="md-nav__title" for="__nav_6_5">
1700 <span class="md-nav__icon md-icon"></span>
1701 Migrating from WCF 2.1
1702 </label>
1703 <ul class="md-nav__list" data-md-scrollfix>
1704
1705
1706
1707
1708
1709 <li class="md-nav__item">
1710 <a href="../migration/wcf21/php/" class="md-nav__link">
1711 PHP API
1712 </a>
1713 </li>
1714
1715
1716
1717
1718
1719
1720
1721 <li class="md-nav__item">
1722 <a href="../migration/wcf21/templates/" class="md-nav__link">
1723 Templates
1724 </a>
1725 </li>
1726
1727
1728
1729
1730
1731
1732
1733 <li class="md-nav__item">
1734 <a href="../migration/wcf21/css/" class="md-nav__link">
1735 CSS
1736 </a>
1737 </li>
1738
1739
1740
1741
1742
1743
1744
1745 <li class="md-nav__item">
1746 <a href="../migration/wcf21/package/" class="md-nav__link">
1747 Package Components
1748 </a>
1749 </li>
1750
1751
1752
1753 </ul>
1754 </nav>
1755 </li>
1756
1757
1758
1759 </ul>
1760 </nav>
1761 </li>
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773 <li class="md-nav__item md-nav__item--nested">
1774
1775
1776 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" >
1777
1778 <label class="md-nav__link" for="__nav_7">
1779 Tutorials
1780 <span class="md-nav__icon md-icon"></span>
1781 </label>
1782 <nav class="md-nav" aria-label="Tutorials" data-md-level="1">
1783 <label class="md-nav__title" for="__nav_7">
1784 <span class="md-nav__icon md-icon"></span>
1785 Tutorials
1786 </label>
1787 <ul class="md-nav__list" data-md-scrollfix>
1788
1789
1790
1791
1792
1793
1794 <li class="md-nav__item md-nav__item--nested">
1795
1796
1797 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7_1" type="checkbox" id="__nav_7_1" >
1798
1799 <label class="md-nav__link" for="__nav_7_1">
1800 Tutorial Series
1801 <span class="md-nav__icon md-icon"></span>
1802 </label>
1803 <nav class="md-nav" aria-label="Tutorial Series" data-md-level="2">
1804 <label class="md-nav__title" for="__nav_7_1">
1805 <span class="md-nav__icon md-icon"></span>
1806 Tutorial Series
1807 </label>
1808 <ul class="md-nav__list" data-md-scrollfix>
1809
1810
1811
1812
1813
1814 <li class="md-nav__item">
1815 <a href="../tutorial/series/overview/" class="md-nav__link">
1816 Overview
1817 </a>
1818 </li>
1819
1820
1821
1822
1823
1824
1825
1826 <li class="md-nav__item">
1827 <a href="../tutorial/series/part_1/" class="md-nav__link">
1828 Part 1
1829 </a>
1830 </li>
1831
1832
1833
1834
1835
1836
1837
1838 <li class="md-nav__item">
1839 <a href="../tutorial/series/part_2/" class="md-nav__link">
1840 Part 2
1841 </a>
1842 </li>
1843
1844
1845
1846
1847
1848
1849
1850 <li class="md-nav__item">
1851 <a href="../tutorial/series/part_3/" class="md-nav__link">
1852 Part 3
1853 </a>
1854 </li>
1855
1856
1857
1858 </ul>
1859 </nav>
1860 </li>
1861
1862
1863
1864 </ul>
1865 </nav>
1866 </li>
1867
1868
1869
1870 </ul>
1871</nav>
1872 </div>
1873 </div>
1874 </div>
1875
1876
1877
1878 <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
1879 <div class="md-sidebar__scrollwrap">
1880 <div class="md-sidebar__inner">
1881
1882<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
1883
1884
1885
1886
1887
1888 <label class="md-nav__title" for="__toc">
1889 <span class="md-nav__icon md-icon"></span>
1890 Table of contents
1891 </label>
1892 <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
1893
1894 <li class="md-nav__item">
1895 <a href="#setup-and-requirements" class="md-nav__link">
1896 Setup and Requirements
1897 </a>
1898
1899</li>
1900
1901 <li class="md-nav__item">
1902 <a href="#the-packagexml-file" class="md-nav__link">
1903 The package.xml File
1904 </a>
1905
1906</li>
1907
1908 <li class="md-nav__item">
1909 <a href="#the-php-class" class="md-nav__link">
1910 The PHP Class
1911 </a>
1912
1913</li>
1914
1915 <li class="md-nav__item">
1916 <a href="#the-template" class="md-nav__link">
1917 The Template
1918 </a>
1919
1920</li>
1921
1922 <li class="md-nav__item">
1923 <a href="#the-page-definition" class="md-nav__link">
1924 The Page Definition
1925 </a>
1926
1927</li>
1928
1929 <li class="md-nav__item">
1930 <a href="#building-the-package" class="md-nav__link">
1931 Building the Package
1932 </a>
1933
1934</li>
1935
1936 <li class="md-nav__item">
1937 <a href="#installation" class="md-nav__link">
1938 Installation
1939 </a>
1940
1941</li>
1942
1943 <li class="md-nav__item">
1944 <a href="#developer-tools" class="md-nav__link">
1945 Developer Tools
1946 </a>
1947
1948 <nav class="md-nav" aria-label="Developer Tools">
1949 <ul class="md-nav__list">
1950
1951 <li class="md-nav__item">
1952 <a href="#registering-a-project" class="md-nav__link">
1953 Registering a Project
1954 </a>
1955
1956</li>
1957
1958 <li class="md-nav__item">
1959 <a href="#synchronizing" class="md-nav__link">
1960 Synchronizing
1961 </a>
1962
1963</li>
1964
1965 </ul>
1966 </nav>
1967
1968</li>
1969
1970 <li class="md-nav__item">
1971 <a href="#appendix" class="md-nav__link">
1972 Appendix
1973 </a>
1974
1975 <nav class="md-nav" aria-label="Appendix">
1976 <ul class="md-nav__list">
1977
1978 <li class="md-nav__item">
1979 <a href="#template-guessing" class="md-nav__link">
1980 Template Guessing
1981 </a>
1982
1983</li>
1984
1985 </ul>
1986 </nav>
1987
1988</li>
1989
1990 </ul>
1991
1992</nav>
1993 </div>
1994 </div>
1995 </div>
1996
1997
1998 <div class="md-content" data-md-component="content">
1999 <article class="md-content__inner md-typeset">
2000
2001
2002
2003 <h1 id="creating-a-simple-package">Creating a simple package<a class="headerlink" href="#creating-a-simple-package" title="Permanent link">#</a></h1>
2004<h2 id="setup-and-requirements">Setup and Requirements<a class="headerlink" href="#setup-and-requirements" title="Permanent link">#</a></h2>
2005<p>This guide will help you to create a simple package that provides a simple test
2006page. It is nothing too fancy, but you can use it as the foundation for your
2007next project.</p>
2008<p>There are some requirements you should met before starting:</p>
2009<ul>
2010<li>Text editor with syntax highlighting for PHP, <a href="https://notepad-plus-plus.org/">Notepad++</a> is a solid pick</li>
2011<li><code>*.php</code> and <code>*.tpl</code> should be encoded with ANSI/ASCII</li>
2012<li><code>*.xml</code> are always encoded with UTF-8, but omit the BOM (byte-order-mark)</li>
2013<li>Use tabs instead of spaces to indent lines</li>
2014<li>It is recommended to set the tab width to <code>8</code> spaces, this is used in the entire software and will ease reading the source files</li>
2015<li>An active installation of WoltLab Suite 3</li>
2016<li>An application to create <code>*.tar</code> archives, e.g. <a href="http://www.7-zip.org/">7-Zip</a> on Windows</li>
2017</ul>
2018<h2 id="the-packagexml-file">The package.xml File<a class="headerlink" href="#the-packagexml-file" title="Permanent link">#</a></h2>
2019<p>We want to create a simple page that will display the sentence "Hello World" embedded
2020into the application frame. Create an empty directory in the workspace of your choice
2021to start with.</p>
2022<p>Create a new file called <code>package.xml</code> and insert the code below:</p>
2023<div class="highlight"><pre><span></span><code><span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
2024<span class="nt">&lt;package</span> <span class="na">xmlns=</span><span class="s">&quot;http://www.woltlab.com&quot;</span> <span class="na">xmlns:xsi=</span><span class="s">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span class="na">xsi:schemaLocation=</span><span class="s">&quot;http://www.woltlab.com http://www.woltlab.com/XSD/2019/package.xsd&quot;</span> <span class="na">name=</span><span class="s">&quot;com.example.test&quot;</span><span class="nt">&gt;</span>
2025 <span class="nt">&lt;packageinformation&gt;</span>
2026 <span class="c">&lt;!-- com.example.test --&gt;</span>
2027 <span class="nt">&lt;packagename&gt;</span>Simple Package<span class="nt">&lt;/packagename&gt;</span>
2028 <span class="nt">&lt;packagedescription&gt;</span>A simple package to demonstrate the package system of WoltLab Suite Core<span class="nt">&lt;/packagedescription&gt;</span>
2029 <span class="nt">&lt;version&gt;</span>1.0.0<span class="nt">&lt;/version&gt;</span>
2030 <span class="nt">&lt;date&gt;</span>2019-04-28<span class="nt">&lt;/date&gt;</span>
2031 <span class="nt">&lt;/packageinformation&gt;</span>
2032 <span class="nt">&lt;authorinformation&gt;</span>
2033 <span class="nt">&lt;author&gt;</span>Your Name<span class="nt">&lt;/author&gt;</span>
2034 <span class="nt">&lt;authorurl&gt;</span>http://www.example.com<span class="nt">&lt;/authorurl&gt;</span>
2035 <span class="nt">&lt;/authorinformation&gt;</span>
2036 <span class="nt">&lt;excludedpackages&gt;</span>
2037 <span class="nt">&lt;excludedpackage</span> <span class="na">version=</span><span class="s">&quot;6.0.0 Alpha 1&quot;</span><span class="nt">&gt;</span>com.woltlab.wcf<span class="nt">&lt;/excludedpackage&gt;</span>
2038 <span class="nt">&lt;/excludedpackages&gt;</span>
2039 <span class="nt">&lt;instructions</span> <span class="na">type=</span><span class="s">&quot;install&quot;</span><span class="nt">&gt;</span>
2040 <span class="nt">&lt;instruction</span> <span class="na">type=</span><span class="s">&quot;file&quot;</span> <span class="nt">/&gt;</span>
2041 <span class="nt">&lt;instruction</span> <span class="na">type=</span><span class="s">&quot;template&quot;</span> <span class="nt">/&gt;</span>
2042 <span class="nt">&lt;instruction</span> <span class="na">type=</span><span class="s">&quot;page&quot;</span> <span class="nt">/&gt;</span>
2043 <span class="nt">&lt;/instructions&gt;</span>
2044<span class="nt">&lt;/package&gt;</span>
2045</code></pre></div>
45ca63d0
TD
2046<p>There is an <a href="../package/package-xml/">entire chapter</a> on the package system that explains what the code above
2047does and how you can adjust it to fit your needs. For now we'll keep it as it is.</p>
2048<h2 id="the-php-class">The PHP Class<a class="headerlink" href="#the-php-class" title="Permanent link">#</a></h2>
2049<p>The next step is to create the PHP class which will serve our page:</p>
2050<ol>
2051<li>Create the directory <code>files</code> in the same directory where <code>package.xml</code> is located</li>
2052<li>Open <code>files</code> and create the directory <code>lib</code></li>
2053<li>Open <code>lib</code> and create the directory <code>page</code></li>
2054<li>Within the directory <code>page</code>, please create the file <code>TestPage.class.php</code></li>
2055</ol>
2056<p>Copy and paste the following code into the <code>TestPage.class.php</code>:</p>
2057<div class="highlight"><pre><span></span><code><span class="o">&lt;?</span><span class="nx">php</span>
2058<span class="k">namespace</span> <span class="nx">wcf\page</span><span class="p">;</span>
2059<span class="k">use</span> <span class="nx">wcf\system\WCF</span><span class="p">;</span>
2060
2061<span class="sd">/**</span>
2062<span class="sd"> * A simple test page for demonstration purposes.</span>
2063<span class="sd"> *</span>
2064<span class="sd"> * @author YOUR NAME</span>
2065<span class="sd"> * @license GNU Lesser General Public License &lt;http://opensource.org/licenses/lgpl-license.php&gt;</span>
2066<span class="sd"> */</span>
2067<span class="k">class</span> <span class="nc">TestPage</span> <span class="k">extends</span> <span class="nx">AbstractPage</span> <span class="p">{</span>
2068 <span class="sd">/**</span>
2069<span class="sd"> * @var string</span>
2070<span class="sd"> */</span>
2071 <span class="k">protected</span> <span class="nv">$greet</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">;</span>
2072
2073 <span class="sd">/**</span>
2074<span class="sd"> * @inheritDoc</span>
2075<span class="sd"> */</span>
2076 <span class="k">public</span> <span class="k">function</span> <span class="nf">readParameters</span><span class="p">()</span> <span class="p">{</span>
2077 <span class="k">parent</span><span class="o">::</span><span class="na">readParameters</span><span class="p">();</span>
2078
2079 <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$_GET</span><span class="p">[</span><span class="s1">&#39;greet&#39;</span><span class="p">]))</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">greet</span> <span class="o">=</span> <span class="nv">$_GET</span><span class="p">[</span><span class="s1">&#39;greet&#39;</span><span class="p">];</span>
2080 <span class="p">}</span>
2081
2082 <span class="sd">/**</span>
2083<span class="sd"> * @inheritDoc</span>
2084<span class="sd"> */</span>
2085 <span class="k">public</span> <span class="k">function</span> <span class="nf">readData</span><span class="p">()</span> <span class="p">{</span>
2086 <span class="k">parent</span><span class="o">::</span><span class="na">readData</span><span class="p">();</span>
2087
2088 <span class="k">if</span> <span class="p">(</span><span class="k">empty</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">greet</span><span class="p">))</span> <span class="p">{</span>
2089 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">greet</span> <span class="o">=</span> <span class="s1">&#39;World&#39;</span><span class="p">;</span>
2090 <span class="p">}</span>
2091 <span class="p">}</span>
2092
2093 <span class="sd">/**</span>
2094<span class="sd"> * @inheritDoc</span>
2095<span class="sd"> */</span>
2096 <span class="k">public</span> <span class="k">function</span> <span class="nf">assignVariables</span><span class="p">()</span> <span class="p">{</span>
2097 <span class="k">parent</span><span class="o">::</span><span class="na">assignVariables</span><span class="p">();</span>
2098
2099 <span class="nx">WCF</span><span class="o">::</span><span class="na">getTPL</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">assign</span><span class="p">([</span>
2100 <span class="s1">&#39;greet&#39;</span> <span class="o">=&gt;</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">greet</span>
2101 <span class="p">]);</span>
2102 <span class="p">}</span>
2103<span class="p">}</span>
2104</code></pre></div>
45ca63d0
TD
2105<p>The class inherits from <a href="https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/page/AbstractPage.class.php">wcf\page\AbstractPage</a>, the default implementation of pages without form controls. It
2106defines quite a few methods that will be automatically invoked in a specific order, for example <code>readParameters()</code> before <code>readData()</code> and finally <code>assignVariables()</code> to pass arbitrary values to the template.</p>
2107<p>The property <code>$greet</code> is defined as <code>World</code>, but can optionally be populated through a GET variable (<code>index.php?test/&amp;greet=You</code> would output <code>Hello You!</code>). This extra code illustrates the separation of data
2108processing that takes place within all sort of pages, where all user-supplied data is read from within a single method. It helps organizing the code, but most of all it enforces a clean class logic that does not
2109start reading user input at random places, including the risk to only escape the input of variable <code>$_GET['foo']</code> 4 out of 5 times.</p>
2110<p>Reading and processing the data is only half the story, now we need a template to display the actual content for our page. You don't need to specify it yourself, it will be automatically guessed based on your
2111namespace and class name, you can <a href="#template-guessing">read more about it later</a>.</p>
2112<p>Last but not least, you must not include the closing PHP tag <code>?&gt;</code> at the end, it can cause PHP to break on whitespaces and is not required at all.</p>
2113<h2 id="the-template">The Template<a class="headerlink" href="#the-template" title="Permanent link">#</a></h2>
2114<p>Navigate back to the root directory of your package until you see both the <code>files</code> directory and the <code>package.xml</code>. Now create a directory called <code>templates</code>, open it and create the file <code>test.tpl</code>.</p>
2115<div class="highlight"><pre><span></span><code><span class="cp">{</span><span class="nf">include</span> <span class="na">file</span><span class="o">=</span><span class="s1">&#39;header&#39;</span><span class="cp">}</span><span class="x"></span>
2116
2117<span class="x">&lt;div class=&quot;section&quot;&gt;</span>
2118<span class="x"> Hello </span><span class="cp">{</span><span class="nv">$greet</span><span class="cp">}</span><span class="x">!</span>
2119<span class="x">&lt;/div&gt;</span>
2120
2121<span class="cp">{</span><span class="nf">include</span> <span class="na">file</span><span class="o">=</span><span class="s1">&#39;footer&#39;</span><span class="cp">}</span><span class="x"></span>
2122</code></pre></div>
45ca63d0
TD
2123<p>Templates are a mixture of HTML and Smarty-like template scripting to overcome the static nature of raw HTML. The above code will display the phrase <code>Hello World!</code> in the application frame, just as any other
2124page would render. The included templates <code>header</code> and <code>footer</code> are responsible for the majority of the overall page functionality, but offer a whole lot of customization abilities to influence their behavior and appearance.</p>
2125<h2 id="the-page-definition">The Page Definition<a class="headerlink" href="#the-page-definition" title="Permanent link">#</a></h2>
2126<p>The package now contains the PHP class and the matching template, but it is still missing the page definition. Please create the file <code>page.xml</code> in your project's root directory, thus on the same level as the <code>package.xml</code>.</p>
2127<div class="highlight"><pre><span></span><code><span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
2128<span class="nt">&lt;data</span> <span class="na">xmlns=</span><span class="s">&quot;http://www.woltlab.com&quot;</span> <span class="na">xmlns:xsi=</span><span class="s">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span class="na">xsi:schemaLocation=</span><span class="s">&quot;http://www.woltlab.com http://www.woltlab.com/XSD/2019/page.xsd&quot;</span><span class="nt">&gt;</span>
2129 <span class="nt">&lt;import&gt;</span>
2130 <span class="nt">&lt;page</span> <span class="na">identifier=</span><span class="s">&quot;com.example.test.Test&quot;</span><span class="nt">&gt;</span>
2131 <span class="nt">&lt;controller&gt;</span>wcf\page\TestPage<span class="nt">&lt;/controller&gt;</span>
2132 <span class="nt">&lt;name</span> <span class="na">language=</span><span class="s">&quot;en&quot;</span><span class="nt">&gt;</span>Test Page<span class="nt">&lt;/name&gt;</span>
2133 <span class="nt">&lt;pageType&gt;</span>system<span class="nt">&lt;/pageType&gt;</span>
2134 <span class="nt">&lt;/page&gt;</span>
2135 <span class="nt">&lt;/import&gt;</span>
2136<span class="nt">&lt;/data&gt;</span>
2137</code></pre></div>
45ca63d0
TD
2138<p>You can provide a lot more data for a page, including logical nesting and dedicated handler classes for display in menus.</p>
2139<h2 id="building-the-package">Building the Package<a class="headerlink" href="#building-the-package" title="Permanent link">#</a></h2>
2140<p>If you have followed the above guidelines carefully, your package directory should now look like this:</p>
2141<div class="highlight"><pre><span></span><code>├── files
2142│ └── lib
2143│ ├── page
2144│ │ ├── TestPage.class.php
2145├── package.xml
2146├── page.xml
2147├── templates
2148│ └── test.tpl
2149</code></pre></div>
45ca63d0
TD
2150<p>Both files and templates are archive-based package components, that deploy their payload using tar archives rather than adding the raw files to the package file. Please create the archive <code>files.tar</code> and add the contents of the <code>files/*</code> directory, but not the directory <code>files/</code> itself. Repeat the same process for the <code>templates</code> directory, but this time with the file name <code>templates.tar</code>. Place both files in the root of your project.</p>
2151<p>Last but not least, create the package archive <code>com.example.test.tar</code> and add all the files listed below.</p>
2152<ul>
2153<li><code>files.tar</code></li>
2154<li><code>package.xml</code></li>
2155<li><code>page.xml</code></li>
2156<li><code>templates.tar</code></li>
2157</ul>
2158<p>The archive's filename can be anything you want, all though it is the general convention to use the package name itself for easier recognition.</p>
2159<h2 id="installation">Installation<a class="headerlink" href="#installation" title="Permanent link">#</a></h2>
2160<p>Open the Administration Control Panel and navigate to <code>Configuration &gt; Packages &gt; Install Package</code>, click on <code>Upload Package</code> and select the file <code>com.example.test.tar</code> from your disk. Follow the on-screen instructions until it has been successfully installed.</p>
2161<p>Open a new browser tab and navigate to your newly created page. If WoltLab Suite is installed at <code>https://example.com/wsc/</code>, then the URL should read <code>https://example.com/wsc/index.php?test/</code>.</p>
2162<p>Congratulations, you have just created your first package!</p>
2163<h2 id="developer-tools">Developer Tools<a class="headerlink" href="#developer-tools" title="Permanent link">#</a></h2>
2164<div class="admonition warning">
2165<p class="admonition-title">This feature is available with WoltLab Suite 3.1 or newer only.</p>
2166</div>
2167<p>The developer tools provide an interface to synchronize the data of an installed package with a bare repository on the local disk. You can re-import most PIPs at any time and have the changes applied without crafting a manual update. This process simulates a regular package update with a single PIP only, and resets the cache after the import has been completed.</p>
2168<h3 id="registering-a-project">Registering a Project<a class="headerlink" href="#registering-a-project" title="Permanent link">#</a></h3>
2169<p>Projects require the absolute path to the package directory, that is, the directory where it can find the <code>package.xml</code>. It is not required to install an package to register it as a project, but you have to install it in order to work with it. It does not install the package by itself!</p>
2170<p>There is a special button on the project list that allows for a mass-import of projects based on a search path. Each direct child directory of the provided path will be tested and projects created this way will use the identifier extracted from the <code>package.xml</code>.</p>
2171<h3 id="synchronizing">Synchronizing<a class="headerlink" href="#synchronizing" title="Permanent link">#</a></h3>
2172<p>The install instructions in the <code>package.xml</code> are ignored when offering the PIP imports, the detection works entirely based on the default filename for each PIP. On top of that, only PIPs that implement the interface <code>wcf\system\devtools\pip\IIdempotentPackageInstallationPlugin</code> are valid for import, as it indicates that importing the PIP multiple times will have no side-effects and that the result is deterministic regardless of the number of times it has been imported.</p>
2173<p>Some built-in PIPs, such as <code>sql</code> or <code>script</code>, do not qualify for this step and remain unavailable at all times. However, you can still craft and perform an actual package update to have these PIPs executed.</p>
2174<h2 id="appendix">Appendix<a class="headerlink" href="#appendix" title="Permanent link">#</a></h2>
2175<h3 id="template-guessing">Template Guessing<a class="headerlink" href="#template-guessing" title="Permanent link">#</a></h3>
2176<p>The class name including the namespace is used to automatically determine the path to the template and its name. The example above used the page class name <code>wcf\page\TestPage</code> that is then split into four distinct parts:</p>
2177<ol>
2178<li><code>wcf</code>, the internal abbreviation of WoltLab Suite Core (previously known as WoltLab Community Framework)</li>
2179<li><code>\page\</code> (ignored)</li>
2180<li><code>Test</code>, the actual name that is used for both the template and the URL</li>
2181<li><code>Page</code> (page type, ignored)</li>
2182</ol>
2183<p>The fragments <code>1.</code> and <code>3.</code> from above are used to construct the path to the template: <code>&lt;installDirOfWSC&gt;/templates/test.tpl</code> (the first letter of <code>Test</code> is being converted to lower-case).</p>
2184
2185
2186
2187
2188
2189
2190
2191 </article>
2192 </div>
2193 </div>
2194 </main>
2195
2196
2197<footer class="md-footer">
2198
2199 <nav class="md-footer__inner md-grid" aria-label="Footer">
2200
2201
2202 <a href="../php/pages/" class="md-footer__link md-footer__link--next" rel="next">
2203 <div class="md-footer__title">
2204 <div class="md-ellipsis">
2205 <span class="md-footer__direction">
2206 Next
2207 </span>
2208 Pages
2209 </div>
2210 </div>
2211 <div class="md-footer__button md-icon">
2212 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
2213 </div>
2214 </a>
2215
2216 </nav>
2217
2218 <div class="md-footer-meta md-typeset">
2219 <div class="md-footer-meta__inner md-grid">
2220 <div class="md-footer-copyright">
2221
2222 <div class="md-footer-copyright__highlight">
2223 Copyright © 2020 WoltLab GmbH
2224 </div>
2225
2226 Made with
2227 <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
2228 Material for MkDocs
2229 </a>
fb88dc6e 2230
45ca63d0
TD
2231 </div>
2232 <div class="md-footer-copyright">
2233 <a href="https://www.woltlab.com/legal-notice/">Legal Notice</a>
2234 <a href="https://www.woltlab.com/privacy-policy/">Privacy Policy</a>
2235</div>
2236 </div>
2237 </div>
2238</footer>
2239
2240 </div>
2241 <div class="md-dialog" data-md-component="dialog">
2242 <div class="md-dialog__inner md-typeset"></div>
2243 </div>
2244 <script id="__config" type="application/json">{"base": "..", "features": [], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing"}, "search": "../assets/javascripts/workers/search.fb4a9340.min.js", "version": {"provider": "mike"}}</script>
2245
2246
fb88dc6e 2247 <script src="../assets/javascripts/bundle.5cf3e710.min.js"></script>
45ca63d0
TD
2248
2249
2250 </body>
2251</html>