CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 20th, 2003, 02:32 PM
computer's Avatar
computer computer is offline
echo $usertitle['computer'];
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2003
Location: UK
Posts: 6,673 computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 4 Weeks 9 h 2 m 19 sec
Reputation Power: 219
Send a message via ICQ to computer
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
__________________

Reply With Quote
  #2  
Old July 20th, 2003, 02:38 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,299 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 54 m 17 sec
Reputation Power: 760
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.

Reply With Quote
  #3  
Old July 20th, 2003, 02:40 PM
computer's Avatar
computer computer is offline
echo $usertitle['computer'];
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2003
Location: UK
Posts: 6,673 computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 4 Weeks 9 h 2 m 19 sec
Reputation Power: 219
Send a message via ICQ to computer
return text how?

some of the header needie fucntions build the cell headers and stuff:

for example:
PHP Code:
function mainbox_top(){
?>
<table width="100%">
<tr>
<td>

<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td><img src="images/box/M-up-left.gif" width="15" height="15" /></td>
<td background="images/box/M-up.gif" width="100%"><img src="images/box/M-up.gif" width="15" height="15" /></td>
<td><img src="images/box/M-up-right.gif" width="15" height="15" /></td>
</tr>
<tr>
<td background="images/box/M-left.gif"><img src="images/box/M-left.gif" width="15" height="15" /></td>
<td>

<!-- Content -->

<table width=100% BGCOLOR="white">
<tr>
<td>
<p>
<?php
}
?> 

Reply With Quote
  #4  
Old July 20th, 2003, 02:40 PM
FlyingSmurf FlyingSmurf is offline
The Freshmaker
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Smurf Village
Posts: 335 FlyingSmurf Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 3 Days 21 h 38 m 32 sec
Reputation Power: 0
Quote:
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.


why would some of your functions cause error if the css was included?

Reply With Quote
  #5  
Old July 20th, 2003, 02:41 PM
computer's Avatar
computer computer is offline
echo $usertitle['computer'];
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2003
Location: UK
Posts: 6,673 computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 4 Weeks 9 h 2 m 19 sec
Reputation Power: 219
Send a message via ICQ to computer
because to include the css i must do a <head>, no?

as soon as that happens kabloom

Reply With Quote
  #6  
Old July 20th, 2003, 02:47 PM
FlyingSmurf FlyingSmurf is offline
The Freshmaker
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Smurf Village
Posts: 335 FlyingSmurf Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 3 Days 21 h 38 m 32 sec
Reputation Power: 0
when are you including lib.php before or after the css?

if before, why? sorry if I'm missing something :P

Reply With Quote
  #7  
Old July 20th, 2003, 02:49 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,299 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 54 m 17 sec
Reputation Power: 760
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:
function foo()
  {
  
$foo 'text to return';
  return 
$foo// could just `return 'text to return';`
  
}
// use
echo foo();
// or
$foo foo(); // stores in variable for later 

Reply With Quote
  #8  
Old July 20th, 2003, 03:00 PM
computer's Avatar
computer computer is offline
echo $usertitle['computer'];
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2003
Location: UK
Posts: 6,673 computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level)computer User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 4 Weeks 9 h 2 m 19 sec
Reputation Power: 219
Send a message via ICQ to computer
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

Reply With Quote
  #9  
Old July 20th, 2003, 06:42 PM
meddle's Avatar
meddle meddle is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Barcelona
Posts: 133 meddle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
why dont you use templates? smarty, for instance.

Reply With Quote
  #10  
Old July 20th, 2003, 06:54 PM
FlyingSmurf FlyingSmurf is offline
The Freshmaker
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Smurf Village
Posts: 335 FlyingSmurf Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 3 Days 21 h 38 m 32 sec
Reputation Power: 0
Quote:
i have a lib.php which contains some functions that cannot be called after headers have been sent.


... 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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > css, functions, headers and includes troubles


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |