12 replies [Last post]
Pman
Pman's picture
Offline
Enthusiast
Sweden
Last seen: 12 years 24 weeks ago
Sweden
Timezone: GMT+2
Joined: 2004-04-15
Posts: 60
Points: 0

...at least I think it is, hehe...If in wrong section I appologize.

Ok I 'll try to explain this as simple as I can, hehe...Feels like I'm on beer already, alltho it's 0915 am...

I have a site. mulitiple pages, and a bit of different elements on the pages, that is the same throughout the page except the content area in the middle.

My question is due to update issues. Is it possible (I know nothing of PHP) to make them htm files into php ones and include each element onto the page, in order to have just the "elementpages" to update, which leads to a "automatic update" of everypage when updating one "element page" ???

Illustratively put (if you check my link below)...The left hand "resource" thingy...If I need to update that today, I have to do that on every page. Could I name that thing resource.htm (or php perhaps), put it on a page of it's own and do my updates there. ? And then on every single page (where this element is placed right now) have that <? include("elements/resource.php") ?> (within the specific div tag of that element)???

Hmmm, I barely understand what I'm saying myself, so I hope someone get this...

Patric.

Anything that happens to irritate you, will happen atleast once more
- p-ahlqvist.com - Online, not entirely done contentwise, but I'm up

Tags:
thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 20 weeks 5 days ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Combined CSS and php Q

Quote:
Is it possible (I know nothing of PHP) to make them htm files into php ones and include each element onto the page, in order to have just the "elementpages" to update, which leads to a "automatic update" of everypage when updating one "element page" ???

Yes. If you use the php include (as you are), then when you update the source file, the page with it included on will update - when it is refreshed.

For instance, if someone is on a page that contains a php include, and while they are on the page you update the source file. When you save the changes, they won't see them until they refresh.

It's the same with iframes, so you're better off using php includes.

Verschwindende wrote:
  • CSS doesn't make pies

Pman
Pman's picture
Offline
Enthusiast
Sweden
Last seen: 12 years 24 weeks ago
Sweden
Timezone: GMT+2
Joined: 2004-04-15
Posts: 60
Points: 0

Combined CSS and php Q

Great. thanks for swift reply.

Further Q's then...Am I supposed to name the included file .php aswell as the page on which I include it, or does it work with htm ?

Ie, will <? include("elements/resource.HTM") ?> work ? Or should it be .php ?

Patric.

Anything that happens to irritate you, will happen atleast once more
- p-ahlqvist.com - Online, not entirely done contentwise, but I'm up

euio
Offline
Enthusiast
Last seen: 15 years 23 weeks ago
Timezone: GMT+8
Joined: 2005-03-03
Posts: 71
Points: 0

Combined CSS and php Q

if i understand it right, you simply want to extract the elements-needed-to-be-updated to a separate .html or .php..

actually you can even copy those elements and paste them into notepad and save as .txt ...

conditions will be: your main page should have .php extension,
the elements-to-be-updated should be replaced in the main page with

<?php
include("page.txt");
?>

and page.txt will have to be the file that contains the elements to be updated! Laughing out loud

hope what im saying is correct...

euio

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Combined CSS and php Q

Pman as this contains exactly zero reference to anything CSS perhaps it would have been better suited to the 'Off Topic' section.
As the name implies this is a forum mainly geared towards CSS related matters especially a sub forum with the name 'Beginners CSS...' Smile

By all means post off topic questions but could you select the appropriate area please Smile

I'll move this topic over.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Pman
Pman's picture
Offline
Enthusiast
Sweden
Last seen: 12 years 24 weeks ago
Sweden
Timezone: GMT+2
Joined: 2004-04-15
Posts: 60
Points: 0

Combined CSS and php Q

Yea, I was a bit confused 'bout where to put it, and I am sorry for any inconviiiiiniance.

Anything that happens to irritate you, will happen atleast once more
- p-ahlqvist.com - Online, not entirely done contentwise, but I'm up

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Combined CSS and php Q

What's to be confused about Laughing out loud

Simple rule of thumb: if it doesn't make reference somewhere to stylesheets/CSS then it's a good bet that it should go into 'Off Topic' Smile

It's not an inconvenience, and occasional Off topic questions make
for a refreshing diversion from weighty CSS matters.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Pman
Pman's picture
Offline
Enthusiast
Sweden
Last seen: 12 years 24 weeks ago
Sweden
Timezone: GMT+2
Joined: 2004-04-15
Posts: 60
Points: 0

Combined CSS and php Q

Hehe, well now the confusion seems a bit odd, but preposting, it had everything to do with CSS in my brainfreezed state of mind. I figured...god alone knows what I figured...

ah, we'll leave it at that, hehe...

Here on by, I'll post everything that isn't pure CSS in the off topic Wink

Cheers - have a nice weekend (I'll have that, will go icefishing and drink beer.)

Anything that happens to irritate you, will happen atleast once more
- p-ahlqvist.com - Online, not entirely done contentwise, but I'm up

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 20 weeks 5 days ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Combined CSS and php Q

Quote:
Further Q's then...Am I supposed to name the included file .php aswell as the page on which I include it, or does it work with htm ?

Ie, will <? include("elements/resource.HTM") ?> work ? Or should it be .php ?

You don't have to name the included file php, but the page with the <include> does. The included page only needs .php extension if it contains any php commands.

Verschwindende wrote:
  • CSS doesn't make pies

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 7 years 46 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

Combined CSS and php Q

thepineapplehead wrote:
Quote:
Further Q's then...Am I supposed to name the included file .php aswell as the page on which I include it, or does it work with htm ?

Ie, will <? include("elements/resource.HTM") ?> work ? Or should it be .php ?

You don't have to name the included file php, but the page with the <include> does. The included page only needs .php extension if it contains any php commands.

Thats not correct. You can give the included file any extension, the server (at least apache) is already in php processing mode. e.g., For security, I only give the pages I expect users to call .php extensions all the other files I give .inc extensions and I then disable direct serving of .inc files via .htaccess.

If you are including a file from another webserver, then it will need the .php extension so that other webserver can process it before it sends it to you. If the file is on the same server you can call it anything you like.

Pman
Pman's picture
Offline
Enthusiast
Sweden
Last seen: 12 years 24 weeks ago
Sweden
Timezone: GMT+2
Joined: 2004-04-15
Posts: 60
Points: 0

Combined CSS and php Q

Woah, thanks a bunch guys ('n'gals?) for this tutoring...I experiance a slightly neater way of updating my pages now, hehe...Hows that for irony, eh ?

I even experiance a much faster site altogether...Is that really happening ?

Chris..S

Quote:
I then disable direct serving of .inc files via .htaccess.

Is this doable on -txt files aswell ? And is it hard (have never been fumbeling with .htaccess before)

Patric.

Anything that happens to irritate you, will happen atleast once more
- p-ahlqvist.com - Online, not entirely done contentwise, but I'm up

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 7 years 46 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

Combined CSS and php Q

this will prevent apache serving *.txt files to any browser which requests them, in this folder and all subfolders.

<Files "*.txt">
    Order allow,deny
    Deny from all
</Files>

if there are multiple file types you wish to protect, you can either duplicate those lines for each file type or use the regexp format (or even the <FilesMatch> directive).

will prevent apache serving *.txt, *.inc & *.doc files to any browser which requests them, in this folder and all subfolders.

<Files ~ "\.(txt|inc|doc)$">
    Order allow,deny
    Deny from all
</Files>

for more information check out http://httpd.apache.org for File Directive info.

Pman
Pman's picture
Offline
Enthusiast
Sweden
Last seen: 12 years 24 weeks ago
Sweden
Timezone: GMT+2
Joined: 2004-04-15
Posts: 60
Points: 0

Combined CSS and php Q

Aaahhh, kudos and a sixpack to you, Chris..S (feel like I'm studdering when typing you nick Wink), this is most helpful. I get a warm, fuzzy feeling in my body now...Hehe, I'll go right on home denying folks to get my .txt's.

Thanks.

/* -- Yo, works great. Thanks again. -- */

Anything that happens to irritate you, will happen atleast once more
- p-ahlqvist.com - Online, not entirely done contentwise, but I'm up