Reputation: 3788
I'm making a simple website with 3 pages in php. The main page is index.php and the other two can be opened through index.php via links.
The link to CSS is given in the index.php file and I want the CSS to get applied to all the other files as well. Do I have to put link tags in all php files to refer to the stylesheet? Is there any other way possible?
Upvotes: 1
Views: 1554
Reputation: 21437
If you had header/top.php
then copy all those files within your top.php
as like
<link rel="stylesheet" href="style.css"/>...
and you can use top.php within your each php file just by adding
<?php include 'pathtocss/top.php'?>
Upvotes: 2
Reputation: 2130
If you have three different pages and linking all the css file in index.php, It will not get reflected in all the pages.
So better you can follow any of the three approach,
Put all the css file in one php file, say styles.php and link it in all the pages
Separate css file for each page.
You can go for single page application. but you have to do some magics using JS
Now the choice is yours!!
Upvotes: 2
Reputation: 7791
You can do one page named includes.php put into all yours files include and include this page in all your pages
Upvotes: 1