The Random Quote Generator is a simple web application that displays a randomly selected quote each time the user requests a new one. It is implemented in PHP and includes basic styling with CSS. The quotes are stored in a separate file named quotes.txt.
index.php
: The main PHP script that generates and displays random quotes.style.css
: The stylesheet defining the visual appearance of the web page.quotes.txt
: A file containing a list of quotes.
- Install PHP: Ensure you have PHP installed on your server.
- Create a Quotes File: Create a quotes.txt file with a list of quotes. Each quote should be on a new line.
- Update Site Header: Open index.php in a text editor and replace the site header with your desired site name.
- View the Generator: Open index.php in a web browser to view the random quote generator.
The visual style of the Random Quote Generator is defined in the style.css file. It uses a simple color scheme, a readable font, and a responsive layout for different screen sizes. The header is fixed at the top of the page, and the main quote container has a maximum width for a clean presentation.
The JavaScript functionality is minimal, with a single function getNewQuote() that reloads the page when the "Get New Quote" button is clicked. This triggers the PHP script to generate and display a new random quote.
Visit the live Random Quote Generator at https://php.ahmmedimtiaz.com/quote-generator/
For any inquiries or further assistance, please feel free to contact me:
- Name: Ahmmed Imtiaz
- Email: hello@ahmmedimtiaz.com