really dumb question (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


kitcar -> really dumb question (4/17/2005 16:57:10)

It's a dumb question but I'm still learning my way through css so don't shoot me please.

Is there a way in a css file to have text appear globally in the html files, kind of like a global call or include?

See, it's a dumb question. Don't ask why I want to do it, I'm just daydreaming. The short explanation is that I need to redo a site with many many pages that has shared borders and I need to get the shared borders out and creating a template html file would be cumbersome.




jaybee -> RE: really dumb question (4/17/2005 18:15:57)

CSS is for styling. You would use HTML or PHP or ASP includes and style them/position them with css.

If you go and look at the homepage of my site and view source, as you go down the page you'll see comments where the various bits go.

The <!-- center column --> is the content and different on each page.

Further down you'll find
<!-- end of center column -->
<!-- header div -->
blah blah blah blah blah blah blah blah blah
<!-- end of header -->
<!--FF_END_IGNORE--><!--FF_IGNORE-->
<!-- left column -->
blah blah blah blah blah blah blah blah blah
<!-- end of left column -->
<!--FF_END_IGNORE--><!-- right column -->
blah blah blah blah blah blah blah blah blah
<!-- end of right column -->

Although you can see all the html, it has been written out by the server. The actual source of the page has 3 php includes.
<!-- end of center column -->
<?php include("/host/domain/html/includes/header.htm"); ?>
<?php include("/host/domain/html/includes/leftcol.htm"); ?>
<?php include("/host/domain/html/includes/indexrightcol.htm"); ?>

Each of these includes has its own Div the position, layout and style of which is controlled by an external Style Sheet:

#hdr{ position:absolute; top:0; height:200px; width:100%; 
 border-bottom:1px solid #000000;  background:#000000; margin:0;}

#lh-col{ position:absolute; top:230px; left:0; width:140px;
 background:#000000; color: #cccccc; z-index:3;}

#c-col{ position:absolute; top:270px; right:180px; left:180px;
 background:#000000;padding-left:25px;font-size:0.9em;
 border: solid #000000; border-width:0 1px; z-index:3;text-align:center;}

#rh-col{ position:absolute; top:140px; right:0; width:140px;
 background:#000000; color: #cccccc; z-index:3; text-align:center;}


Does that all make sense. (Bit late here and I've been staring at this screen for the past 12 hours) [&o]




c1sissy -> RE: really dumb question (4/24/2005 10:32:32)

Hey Kitcat, for futre reference
There are no dumb questons at all [;)]

Note my sig that has been here since I signed on to outfront [;)]




Kitka -> RE: really dumb question (5/4/2005 15:55:41)

quote:

The actual source of the page has 3 php includes.


Does anyone know of a good but reasonably simple tutorial for php includes? I have a site which uses FP includes and I'd very much like convert it.

I found this: http://us2.php.net/include/ but found it too technical for me to grasp.




bobby -> RE: really dumb question (5/4/2005 16:05:00)

php includes require that your page be a .php extension (or that the server be set up to parse for them on other page types)

Then you use:

<?php include("filename.php"); ?>

Whatever is in the filename.php page will be "copy > pasted" into the page code prior to the page being sent to the browser for rendering.

Make sense?

Depending on your server settings you can use SSI (Server Side Includes) with the following:

<!--include file="filename.txt" -->

If your server is set up for SSI you can use just about any page extension (.shtml, .html, .php, .asp) as long as the server knows to parse those page extensions for SSI

Your host will likely have a list of them.

Also, filename.txt or filename.php can just as easily be filename.asp (if you're on an ASP enabled server) or filename.htm, or filename.inc... doesn't really matter...





Kitka -> RE: really dumb question (5/4/2005 21:15:55)

Many thanks for the reply Bobby.

quote:

Make sense?


Um, I think so. But I'll have to try it out to see if I can make it work before I'm certain.




bobby -> RE: really dumb question (5/5/2005 1:16:46)

I would check with your host to see if your server supports SSI, if so try to find out what page extensions are supported (typically .asp and .shtml or .shtm).  With any luck you won't have to change all of your page extensions...

(In fact, if you're on a Unix / Linux server your .htaccess file can set this for you!)
http://www.ssi-developer.net/ssi/

If not, then find out if ASP is supported (ASP uses SSI by default)

If not, do the same for php, and so on...

[:D]




Kitka -> RE: really dumb question (5/5/2005 1:30:10)

I'm on a Linux server, so naturally have php - I already use it for my search engine and contact form. Don't have any access to asp.

I have also programmed the Apache handler (through Control panel) to parse .htm and .html as php (or should I have said that vice versa?? [>:] ). So does that mean I won't need to change any page extensions? They are mostly .htm now.




bobby -> RE: really dumb question (5/5/2005 2:13:53)

If it's parsing .htm for SSI then all you need to do is replace your FP include tag with the SSI format above... I'd test one out and see how it works for you.

Oh, and don't forget to remove anything from the included page that you don't want "pasted" into the parent document (web page)

FP includes look for everything between the <body> tags, so naturally you have to have those... if you leave them there they will be pasted in along with the <html>, <head> and any <meta> tags you have on there... delete those first, before trying out SSI

Remember that SSI "copy > pastes" EVERYTHING in the included document or file...

[;)]




Kitka -> RE: really dumb question (5/5/2005 4:09:21)

Okay, I've been testing. First I tried saving my left include as left.php then inserting the correct code as you mention above, on my test.htm page:
<?php include("left.php"); ?>

Didn't work. So I tried changing the file name to "left.htm", still no luck. So then I changed the test.htm to test.php, and bingo it worked! BUT ... only when viewed online in a browser. Even though I was working live on the server, FP refuses to show the php includes, in both Normal view and Preview.

It isn't very satisfactory being unable to view the assembled page before saving/publishing like you can with FP includes or shared borders.

Also, I am really aiming to not have to change the extension of all my many pages, mostly because of Search engine placings.

I have edited the Apache "User Defined handler" supposedly to parse .htm and .html pages with php, but maybe I have got it all wrong? Here is what it says in Control Panel:

User Defined Handlers
.htm AddTypeapplication/x-httpd-php
.html AddTypeapplication/x-httpd-php


All help gratefully received, I'm feeling very confused. [sm=unsure.gif]




Kitka -> RE: really dumb question (5/5/2005 4:34:22)

Okay, I finally figured there was something wrong with the syntax of handlers, so I Googled and found the following, which I added, and deleted the other 2.

User Defined Handlers
.htm .html application/x-httpd-php

Now it works with .htm extension <phew>! The only problem is not being able to see the complete page in FP while editing. Is there a solution for that? (And PLEASE don't say "buy Dreamweaver", I can't afford it and am basically happy working in FP2002 and Notepad etc.)




jaybee -> RE: really dumb question (5/5/2005 6:56:51)

OK, teach me to read to the end of the thread before replying.... [:D]

I just typed you a complete Apache handler thing

Answer to viewing locally is no, not in FP, not in DW, not in anything unless you set your machine up to run Apache and php. Can be done.

I used EasyPHP to set my machine up as a WAMP, Bobby used something else.




Kitka -> RE: really dumb question (5/5/2005 7:18:18)

quote:

I just typed you a complete Apache handler thing

[sm=lol.gif]

quote:

I used EasyPHP to set my machine up as a WAMP


WAMP? Is that where you get paid for all your work in beads? [:D]

EasyPHP sounds like it might be manageable - is it suitable for PHP neophyte?




jaybee -> RE: really dumb question (5/5/2005 9:52:41)

quote:

WAMP? Is that where you get paid for all your work in beads?


I wish, it might be worth more.

EasyPHP is pretty straightforward but I did have a wonderous book at hand to assist with the "what next" scenario. All very well installing it if you don't have a clue what to do with it. Book is PHP and MySQL for Dummies get it from Amazon. It's not the gospel on but it does give you the basics in a readable fashion.

WAMP - Windows Apache MySQL and PHP




bobby -> RE: really dumb question (5/5/2005 14:24:08)

I used XAMPP, incredibly simple and the newest version has a much simplified interface for turning services on and off (for when you're not developing)

http://www.apachefriends.org/en/xampp.html




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.09375