/    Sign up×
Community /Pin to ProfileBookmark

how do I call the css file on every page

I have this project, a dynamic website with around 7 php pages, users, log in, register etc, I’m not very experienced with coding in general, I’m still learning, I would like to know how do I call the css file on every page instead of creating the head tag and linking the stylesheet, is there any way I can create a function to call the css file for every page ? I even have some body styling that is custom for some pages and i want to put all the styling in main.css but I don’t want to have the head tag with the link on every page as I said, is there any way ? Thanks

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@cbVisionOct 23.2014 — One way to do this is by using the include for your header/footer.

For example:

head.php
[CODE]
<html>
<head>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
[/CODE]


footer.php
[CODE]
<div>Whatever you want in your global footer</div>
</body>
[/CODE]


your-page.php
[CODE]
<?php include('head.php'); ?>
<h1>Page content</h1>
<p>Whatever you want on that page</p>
<?php include('footer.php'); ?>
[/CODE]
Copy linkTweet thisAlerts:
@FlowxauthorOct 23.2014 — I actually thought about that but I didn't try it haha, thanks for the suggestion mate! I will try it now
Copy linkTweet thisAlerts:
@NogDogOct 23.2014 — [I][ Changed thread title to something meaningful (and therefore searchable). ][/I]
×

Success!

Help @Flowx spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...