Solved

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

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now