Solved

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

Posted on 2011-09-17
2
376 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

730 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