Topic: Direct link to stylesheets help please (Page 1 of 1) Pages that link to <a href="" 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>\

Bipolar (III) Inmate

Insane since: Jun 2003

IP logged posted posted 06-21-2009 00:19 Edit Quote

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:

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

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

my test page looks like this

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

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)

Paranoid (IV) Inmate

From: Florida
Insane since: Mar 2005

IP logged posted posted 06-21-2009 04:09 Edit Quote

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

What's wrong with this?:

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

Post Reply
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
Your Text:
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu