How do i do this properly?

Status
Not open for further replies.

St4nley

Member
Apr 13, 2013
469
76
The pic is pretty self explanatory
2zzubeb.png

i'm a noob who is learning, refrain from yelling and laughter, how do i link stylesheets?
 

TesoMayn

Boredom, it vexes me.
Oct 30, 2011
1,482
1,482
Code:
<?php
if (5<10) {
include('\firstpage\Home.html');
include('\firstpage\home.css');
}else{
echo("goodbye");
}
?>

Also, why not put the CSS in the Home.html page?
Code:
<link rel="stylesheet" href="home.css" />

Also, you are going to get the code, as it will just put the words from the page on it, for it to be style you need to add <style> tags
 

IntactDev

Member
Nov 22, 2012
399
71
@Timmy_'s method should work perfectly. Do as he said, and put:
Code:
<link rel="stylesheet" href="home.css" />
into the head tag of home.html
 

St4nley

Member
Apr 13, 2013
469
76
@Timmy_'s method should work perfectly. Do as he said, and put:
Code:
<link rel="stylesheet" href="home.css" />
into the head tag of home.html

in my home.html code there is that line of code in the header, when i just open up home.html i see everything i want to see aswell as in style etc. but when i launch it through php and localhost i get the coding instead.
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
im just playing around, thats my first php file or script so i was just having fun familiarizing with all the aspects of it.

Oh I understand.

Also, your code won't work because your CSS needs to be inside your <head></head> tags in your HTML file OR linked in via <link type="text/css" rel="stylesheet" href="css/global.css" />

You're calling your HTML and then your CSS at separate times which means your CSS won't be included in your HTML and HTML won't parse it so it will just be echoed as standard text.
 

St4nley

Member
Apr 13, 2013
469
76
Oh I understand.

Also, your code won't work because your CSS needs to be inside your <head></head> tags in your HTML file OR linked in via <link type="text/css" rel="stylesheet" href="css/global.css" />

You're calling your HTML and then your CSS at separate times which means your CSS won't be included in your HTML and HTML won't parse it so it will just be echoed as standard text.

That makes perfect sense, thanks for answering my question :)
 

GarettM

Posting Freak
Aug 5, 2010
833
136
Another cool trick with php is
PHP:
<?php
 If(false) {
?>
CGI is not running!?
<?php
} 
ob_start();

Require( dirname(__FILE__) . '/template/home.phtml' );

ob_end_flush();

?>

This checks to see if php is running it also includes the php enabled HTML file. And compresses the data :3 ... I believe I haven't programmed in awhile

Sent from my SGH-T999 using Tapatalk 2
 

St4nley

Member
Apr 13, 2013
469
76
Another cool trick with php is
PHP:
<?php
If(false) {
?>
CGI is not running!?
<?php
}
ob_start();
 
Require( dirname(__FILE__) . '/template/home.phtml' );
 
ob_end_flush();
 
?>

This checks to see if php is running it also includes the php enabled HTML file. And compresses the data :3 ... I believe I haven't programmed in awhile

Sent from my SGH-T999 using Tapatalk 2

i have no idea what any of that means. aha i just started php a day ago.
 
Status
Not open for further replies.

Users who are viewing this thread

Top