# Hero Slider Setup Instructions
This document provides instructions on how to set up the hero slider functionality.
## Database Setup
The hero slider requires a `sliders` table in your database. Follow these steps to create it:
1. **Import the SQL Schema:**
- Locate the `database_schema.sql` file in the root directory.
- Import this file into your MySQL database using phpMyAdmin or the MySQL command line:
```
mysql -u [username] -p [database_name] < database_schema.sql
```
2. **Alternative Manual Setup:**
If you're unable to import the SQL file, you can manually create the table with the following SQL:
```sql
CREATE TABLE IF NOT EXISTS `sliders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`subtitle` varchar(255) DEFAULT NULL,
`description` text DEFAULT NULL,
`button_text` varchar(50) DEFAULT NULL,
`button_url` varchar(255) DEFAULT NULL,
`content_type` enum('image','video') NOT NULL DEFAULT 'image',
`media_url` varchar(255) NOT NULL,
`overlay_color` varchar(30) DEFAULT 'rgba(0, 0, 0, 0.4)',
`text_color` varchar(30) DEFAULT '#ffffff',
`animation` varchar(20) DEFAULT 'fade',
`status` enum('active','inactive') NOT NULL DEFAULT 'active',
`sort_order` int(11) NOT NULL DEFAULT 0,
`date_created` datetime NOT NULL DEFAULT current_timestamp(),
`date_updated` datetime DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```
3. **Default Sliders:**
The system includes default sliders that will be shown if no sliders are found in the database. To use your own sliders instead, add them through the admin panel at `admin/sliders.php`.
## Image Files
The default slider configuration refers to image files in `assets/img/slider/`. Make sure these files exist or update the paths in the default slider configuration in `includes/hero_slider.php`.
## Troubleshooting
- **Fatal Error with Table:** If you see an error about the sliders table not existing, follow the database setup instructions above.
- **Slider Not Showing:** Check that the `includes/hero_slider.php` file is properly included in your page's PHP code.
- **Images Not Showing:** Ensure the image paths in the slider configuration are correct and the image files exist.
## Management
Once set up, you can manage your sliders through the admin panel at `admin/sliders.php`. This interface allows you to:
- Add new sliders
- Edit existing sliders
- Delete sliders
- Change the order of sliders
- Set sliders as active or inactive