====== Chapter 4 - adding pages to the website ====== Including pages in the website is almost the same as including pages in plucks administration center. First, we'll explain how you can define the //inclusion page// of your module. ===== Defining the inclusion page ===== When a user includes your module in (a page of) his website, pluck needs to know which file must be included in the page. We inform pluck about this by using the variable **$includepage**. For including pages in the administration center of pluck, we used a file called //module_pages_admin.php// (see [[dev:modules:chapter_3|chapter 3]]). For including pages in the website, we have a similar file, called **module_pages_site.php**. The pages we'll put in the directory **pages_site**, located in the module-directory. In the case of our poll module, this will be //data/modules/polls/pages_site///. Now, if the filename of the inclusion page is //show_poll.php//, we can put the following in //module_pages_site.php//: Now, pluck knows how to include your module into pages of the website. ===== Adding more pages ===== Ok, now we pluck can show our poll module in a page. However, some modules may want to include more pages in the website: for our poll module for example, we want a page on which the visitor can see all old (archived) polls. How can we achieve that? ==== Adding the page ==== Adding additional pages works exactly the same for the website as for the administration center. Read how to add a page [[dev:modules:chapter_3#adding_the_page|here]]. In the case of our poll module (where we want to include the file //show_archived.php//), this will be the resulting code: $module_page['show_archived'] = "show archived polls"; ==== Linking to the page ==== We have now included the page to show the archived polls, but we still want to link to that page so the user can easily find the page. How do we know the exact URL to the page? The URL for a module-page on the website looks almost the same as the URL for a page in the administration center: ?module=module_dir&page=filename_without_extension * **module_dir** is the same as the name of your module-dir, and also the same as the **$module_dir** variable inside //module_info.php// (for more information, see [[dev:modules:chapter_2|Chapter 2]]). In our case, this is //polls//. * **filename_without_extension** is the same filename without extension you put in //module_pages_admin.php//. In our case, this is //show_archived//. So, the entire URL to access our "new poll"-page is: ?module=polls&page=show_archived We can link to the page like this: show archived polls ===== Resulting code ===== After implementing a few more pages, this could be an example of the resulting code in **module_pages_site**: ===== Ok, let's go to the next chapter! ===== Let's go to the next chapter and learn more about other possibilities of the pluck module system! [[dev:modules:chapter_5|Go to the next chapter...]]