|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
css, functions, headers and includes troubles
Hi,
I have setup a templating system for a project I am working on. I have got a css file (css/style.css), which needs to be included before ANY text is sent to the browser. A common.php which must NOT output anything to the browser (called before header functions and stuff). A lib.php, which contains some functions, some which output text and need the CSS and some that will error if the css is included. How can I setup something so that when the lib.php is called, for some functions the css header is included and sometimes not? Thanks, computer |
|
#2
|
||||
|
||||
|
This is a hard one for us b/c we have no idea what's in each file. Sounds like you may need to rethink some logic!? Try changing the functions in lib.php to return text instead of echo()ing it.
|
|
#3
|
||||
|
||||
|
return text how?
some of the header needie fucntions build the cell headers and stuff: for example: PHP Code:
|
|
#4
|
|||
|
|||
|
Quote:
why would some of your functions cause error if the css was included? |
|
#5
|
||||
|
||||
|
because to include the css i must do a <head>, no?
as soon as that happens kabloom ![]() |
|
#6
|
|||
|
|||
|
when are you including lib.php before or after the css?
if before, why? sorry if I'm missing something :P |
|
#7
|
||||
|
||||
|
I'm confused by it all as well. Why would you call a function that builds a table before you call a function that builds the <head>?
More on my previous post (returning text): PHP Code:
|
|
#8
|
||||
|
||||
|
okay i see i am not making sense
![]() i have a lib.php which contains some functions that cannot be called after headers have been sent. some functions need to have the headers though before they will work correctly. on the pages, i have: <? include("common.php") ?> <? include("header.php") ?> <? include("menu.php") ?> common.php: Code:
<?php
session_start();
header("Cache-control: private");
include("configuration.php");
include("lib.php");
db_connect($dbhost, $dbuser, $dbpass, $dbdb);
include("online_update.php");
?>
configuration and online_update self explainatery. db_connect is a fnction defiend in lib.php header.php: does all the sites <head> and starts the body. also includes the css line. menu.php: just the nav bar. I hope you understand, if not, i can just post my source files for you to look at ![]() Got to go soon though, speak later, computer |
|
#9
|
||||
|
||||
|
why dont you use templates? smarty, for instance.
|
|
#10
|
|||
|
|||
|
Quote:
... then don't call those functions after the header's been sent? I'm still confused, does lib.php only declare functions or does it actually call/output something? If it only declares functions you should be OK. It's valid to use CSS in a function, and to declare it before loading the CSS as long as the CSS has been loaded by the time you call the function. |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > css, functions, headers and includes troubles |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|