No idea how to do this

liunx

Guest
Here's what I envision: There are many pages on my website that have text areas that I update sometimes. What I would like to do is set up those pages to pull text from a single text file that resides on the server. <br />
<br />
Basically I assume that the text file that stores all of the content will have to be set up into sections, like A, B, C, so on. Then on my first webpage, all the static code would be there, but when it got down to the text part, it would in effect say "go to document "docname.txt" and insert section "A" into this spot". <br />
<br />
Does this make sense to anyone? <br />
<br />
I would like to do this because it would be much easier than updating each HTML file individually. The text file can just contain text, and then the HTML document that calls text can control the formatting via a CSS I have set up. <br />
<br />
It's important that all of the text is contained within 1 file. I am doing this so that it's much easier to change the content on my website, so that is my goal. There are many solutions that come CLOSE, but I haven't found anything like this. <br />
<br />
I know nothing about JavaScript, Perl, or any of that. But I am willing to learn whatever I need to in order to get this to work. I think others could benefit from solving this issue, so please give this a thought. <br />
<br />
Thanks! <br />
Dave Heinzel<!--content-->You need something like Perl or PhP. But why would you need to limit your content to one text file? I don't know how you would segregate different sections of that file for use on different web pages, and without doing that, you'd be using the same text on multiple pages. Probably make for a pretty annoying site, I think. I expect you'd need multiple text files. The update of your site would still be the same.<!--content-->What I envision wouldn't make a site look any different than it already does, so I don't know how that could be annoying. It's the same look - but what happens behind the scenes is different.<br />
<br />
You are right that it might be easier to have different text files for each page, so it doesn't all pull from one large text file. But editing a plain text file isn't much harder than editing text in an HTML document, so that doesn't really make anything easier. The extra ease of not sifting through HTML would be balanced out by having two (instead of one) files for each page.<br />
<br />
Still, there must be an easy way to update the content on many of my webpages at the same time. I think PHP is the way to go from what I've been reading.<br />
<br />
Anyone else out there have a solution for this?<br />
<br />
Thanks,<br />
Dave<br />
<br />
<br />
*** *** ***<!--content-->It really would be quite simple to do, but here's how I would recommend doing it (and how I do it on most of my sites). Create two pages, one named header.php and one named footer.php. The header.php page will contain all the code up to the content area. The footer.php page will contain all code after the content area. Now, each page will look something like this:<br />
<br />
<?PHP<br />
include "path/to/header.php";<br />
?><br />
<p>Page content</p><br />
<?PHP<br />
include "path/to/footer.php";<br />
?>Still very easy to edit, and much more likely to be search engine friendly.<!--content-->Again, I don't think you can do what you want to do. Your server-side script is going to pull whatever text is in that text file, and I don't think there is a way to tell it to retrieve only the first paragraph, or only the fifth paragraph, etc. If all of your text is in one file, and all of your scripts pull site content from that file, then all of your pages will have the same content. I stand ready to be corrected (it wouldn't be the first time), but I think what Pyro has laid out is about as simple as it's going to get.<!--content-->Originally posted by Aronya1 <br />
...and I don't think there is a way to tell it to retrieve only the first paragraph, or only the fifth paragraph, etc.Actually, yes, there would be a way to do that (or the equivalent). But, as I said, I would not recommend doing it that way. :)<!--content-->Originally posted by pyro <br />
Actually, yes, there would be a way to do that (or the equivalent). <br />
And therein lies my reason for my disclaimer:I stand ready to be corrected (it wouldn't be the first time), :)<br />
Does that mean I'm right once again?<!--content-->lol... :D<!--content-->It occurs to me that I should add something to my disclaimer:I stand ready to be corrected by Pyro (it wouldn't be the first time) In fact, I may just use that as my sig file. Whaddaya think?<!--content-->I LIKE it! Hey Moe!<!--content-->Lol... that's all I can say :p<!--content-->Thanks for the replies guys. Sounds like it's not gonna work the way I had planned, but it still can be relitavely easy. One thing I've always tried to avoid is the cookie-cutter 'header - body - footer' sites, but it doesn't have to look simple, and I can still have simple code.<br />
<br />
Pyro - you mentioned something about the site being search engine friendly. This is something that I completely didn't think of before, and I'm glad you mentioned it. That is something I will need to take into consideration.<br />
<br />
Looks like I'm going to be learning some PHP. Sweet, new stuff is always kinda fun, till I forget 90% of it because I don't use it often. Oh well<br />
<br />
-Dave<!--content-->
 
Back
Top