Topic: Direct link to stylesheets help please (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=31071" title="Pages that link to Topic: Direct link to stylesheets help please (Page 1 of 1)" rel="nofollow" >Topic: Direct link to stylesheets help please <span class="small">(Page 1 of 1)</span>\

 
Hustluz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

posted posted 06-21-2009 00:19

Im trying to link to my style sheets from the root of my drive so that i can put the same dynamic link on every page no matter where the page is located on my site

this is my code:

code:
define('STYLE_PATH', "C:\wamp\www\digiblueprint\public\stylesheets\main.css");

$page_title = "Testing Layout Function";
$stylesheet = "main.css";


	public static function page_header($page_title="", $stylesheet="") {
		$style_path = STYLE_PATH;
		$output  = "<html>\n";
		$output .= 	"<head>\n";
		$output .=		"<title>". $page_title ."</title>\n";
		$output .= 		"<link href=\"".  $style_path ."\" media=\"all\" rel=\"stylesheet\" type=\"text/css\" />\n";
		$output .= 	"</head>\n";
		$output .= 	"<body>\n";
		$output .= 		"<div id=\"header\">\n";
		$output .= 	  	"<h1>". $page_title ."</h1>\n";
		$output .= 		"</div>\n";
		$output .= 		"<div id=\"main\">\n";
		echo $output;
	}



but the linking to the style sheet only works when i use this kind of link

code:
$output .= "<link href=\"". STYLE_PATH.DS.$stylesheet ."\" media=\"all\" rel=\"stylesheet\" type=\"text/css\" />\n";





my test page looks like this

code:
<?php require_once("includes/initialize.php"); ?>
<?php 
$page_title = "Testing Layout Function";
$stylesheet = "main.css";
?>
<?php Layout::page_header($page_title, $stylesheet); ?>
<?php

echo "<div><p>This is a test page for layout.</p></div>";

?>
<?php Layout::page_footer(); ?>



can someone please tell me what im missing or doing wrong

(Edited by Hustluz on 06-21-2009 00:21)

reisio
Paranoid (IV) Inmate

From: Florida
Insane since: Mar 2005

posted posted 06-21-2009 04:09

That's some pretty awful mixing of code, and where's your doctype declaration?

What's wrong with this?:

code:
<link href="/public/stylesheets/main.css" rel="stylesheet">



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu