Search Results

    Getting Started with CastleWiki

    Learn AdenaAdena how to set up, configure, and use CastleWiki for your documentation needs.

    Prerequisites

    Elemental HealElemental Heal (Level 4) Before you begin, ensure you have the following:

    • A modern web browser (Chrome, Firefox, Safari, or Edge)
    • Basic knowledge of HTML (for content editing)
    • Text editor for modifying files
    • PHP 5.4+ (for running the local server)

    Installation

    To get started with CastleWiki, follow these simple steps:

    1. Download the files

      Clone the repository or download the ZIP file to your local machine.

      git clone https://github.com/yourusername/castlewiki.git
    2. Navigate to the directory

      Open your terminal or command prompt and navigate to the CastleWiki folder.

      cd castlewiki
    3. Start the server

      Run the local server to view your wiki:

      php -S localhost:8000

      On Windows, you can also double-click the start-server.bat file.

    4. Open in browser

      Open your browser and go to http://localhost:8000

    Project Structure

    Understanding the CastleWiki file structure will help you customize it for your needs:

    πŸ“ Main Files

    • index.php - The main router for the wiki
    • .htaccess - URL rewriting rules
    • layouts/main.php - Main layout template
    • README.md - Project documentation
    • start-server.bat - Windows batch file to start the server

    πŸ“ pages/

    • home.php - The main/home page content
    • getting-started.php - Getting started guide
    • example.php - Example page
    • test.php - Test page
    • 404.php - Error page for missing content

    πŸ“ includes/

    • functions.php - Helper functions

    πŸ“ styles/

    • main.css - All styling for the wiki

    πŸ“ scripts/

    • main.js - JavaScript functionality for navigation and interactivity

    Creating Content

    CastleWiki makes it easy to create and organize your documentation:

    Adding Pages

    1. Create a new PHP file in the pages/ directory
    2. Name the file with your desired URL slug (e.g., my-page.php for /my-page)
    3. Add your content using HTML
    4. Add the page to the sidebar navigation in layouts/main.php (optional)
    5. That\'s it! Your page is automatically available at /your-page-name

    Customizing the Sidebar

    The sidebar navigation is defined in layouts/main.php. To add a new item:

    <li class="<?= is_active(\'page-name\') ? \'active\' : \'\' ?>">
        <a href="<?= url(\'page-name\') ?>">Page Title</a>
    </li>

    For nested items (submenus):

    <li>
        <a href="#">Category</a>
        <ul class="submenu">
            <li><a href="<?= url(\'page1\') ?>">Page 1</a></li>
            <li><a href="<?= url(\'page2\') ?>">Page 2</a></li>
        </ul>
    </li>

    Helper Functions

    CastleWiki includes helper functions to make development easier:

    • url(\'page-name\') - Generates the correct URL for a page
    • is_active(\'page-name\') - Checks if the current page is active

    Next Steps

    Now that you have CastleWiki running, here are some recommended next steps: