Solved

PHP5/ZEND: css not found problem by using header in controller

Posted on 2011-09-17
2
379 Views
Last Modified: 2013-11-10
hello all,

i would like to open a file in public folder within a zend controller. all work fine except the css file losed, the page is display but the css which used in the page is losed. any suggestion?

codes are below.

thanks.
wantime

if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
		$uri = 'https://';
	} else {
		$uri = 'http://';
	}
	$uri .= $_SERVER['HTTP_HOST'];
	header('Location: '.$uri.'/folderInPublicfolder/readme.phtml/');
	exit;

Open in new window

0
Comment
Question by:wantime
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:wantime
ID: 36553646
btw,  i linked the css file in the readme.phtml, it seems the link doesn't work when i call this page from controller. But if i open this readme.phtml directly in browser, the css works without problem.

 <LINK REL=StyleSheet HREF="../mycssfolder/my.css" TYPE="text/css" >  </LINK>

and when i attach the whole css inside the readme.phtml, the problem is resolved and the page is displayed as i wish.

now the question is: are there any way to let the LINK work? because i don't want to attach css content in the readme.phtml.

thanks.
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 36554263
I've used this successfully:

<style type="text/css" media="all">
@import url("style.css");
</style>

The file "style.css" is in the WWW root directory.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question