Forum Moderators: coopster
However, if you know of any other articles on the subject please post them.
Here is the ALA article:
http://www.alistapart.com/stories/phpcms/
Thanks-
I found that the mozilla compatible alternate style sheets cause problems with Konqueror though, the article mentioned above doesn't use this method but rather directly replace the code in the head.
It doesn't have anything on including content, for this http://evolt.org/article/Making_clean_URLs_with_Apache_and_PHP/18/22880/
would do.
Are you meaning along the lines of this?
[webmasterworld.com...]
If you are, then there are a few things to learn, mainly how to escape certain characters. If you are meaning something along these lines - its not hard to pick up......
/added
I highly recommend downloading the PHP and mySQL documentation and filling the kettle ;)
I am currently working towards doing this but I have not gotten very far. I do have the DB pulling into <div>'s but I have not started looping or anything which is my next step. <added> I think the hardest thing about changing from a table layout for DBs is you have to find a way to keep everything as uniform as possible to make it come out right. Hopefully I wont have that problem to much. </added>
The way around it is CSS no doubt. setting margins for <p> tags, setting classes for your outputted SQL etc etc can *hopefully* give the look that you wanted on the webpage.
I am sure that any questions thrown into the HTML/CSS forum ring would be sorted in a sec.
When I first looked at PHP I also wondered how design "fitted in" to the code. After seeing the client/server diagram and hearing about "middleware" a few hundred times here and elsewhere it soon became clear :)
It makes me wonder, for a bigger site, whether its wise to even include style tags inside a database, because if uniform is uniform, then you are going to be using a finite amount of tags and classes over a huge amount of pages. Inside the db or outside the DB?
If you had them inside the DB, I guess you could almost forget knowledge of HTML and SQL/CSS our way into freedom and ease of maintenance :)
I hope to use that content management system. Just build a template in the format you want the articles and insert it into a <div> using a common variable that changes for each article.
Those submitting won't have to know a thing - and that's the only way to make things work right. Of course, I'll be flying by the seat of my pants;)
How am I going to insert the <p> for each paragraph?
Tis not hard at all. Upon submission to the db make sure you use the addslashes() function to escape any troublesome characters. Tell the folks to use 2 carriage returns to separate paragraphs when they fill in the form. When you echo the text to screen (after retrieving it from the db) use the stripslashes function and nl2br() which is short for "\n (new line) to <br>" which will give you your paragraphs.
Alternately you could parse through the strings and look for the "\n" and replace it with "<p>".
On another note, I've been playing around with XHTML, CSS, PHP and MySQL and have found the combination to be extremely powerful. As of late I've been building my own functions to handle some of the more routine code like oft-used queries. With all that I've learned over the past few months I think I've died and gone to heaven! :)
insights on this?
Their CMS is done thru Atomz, which is similar to blogger software only more flexible. Perhaps 2-3 years ahead of standard blog technology.
Except it's done with tables.
how about using a folder and a file only instead of mysql
Perfectly acceptable. If you don't don't have a lot of content and/or traffic then this method will work quite fine. As for XML - if you're going to do what I think you're going to do - use PHP to parse XML into XHTML then yes - again I think that'll work fine although using a db would be faster.
It depends - opening a connection to the database is slow, but once you've got one open use it. Use it for anything and everything (unless you're dealing with video files, archives, etc.).
Using database is beneficial if you want to sort the data or extract parts of it, files are good it you make atomic use ot them.
Their CMS example includes an admin section where people can add articles. It even includes an editor feature so that someone else, as an editor, makes a final decision about whether or not a certain article will appear on the site after a writer has written and submitted it.
Unfortunately, I also have some XHTML stored in the db, as part of the article. It's not a problem as long as I'm the only one adding articles. As long as the CSS is all set up, I could teach someone some basic XHTML so they could add articles too. They wouldn't need to know much more than how to use: <p></p>. lorax's idea is good, I may consider adding something like that someday. The other, simpler, but less elegant idea I had was to just put some text, containing bits of code, on the article submit form page that they can copy and paste into the text box. Of course, if their article needs something more complex, like a table (containing only real tabular data, of course!) it would be more difficult to show them how to do that.
The W&T book is great. That's what I relied on to learn PHP, that and knocking around a bit with a few projects that required PHP.
But really, it's a snap to avoid having to include tags in your content. The framework (the formating you apply to the output) is the most important piece and you sound as though you're comfortable enough with the code to accomplish this.
lorax - the problem with using the more elegant solution, is that I keep thinking up all sorts of possible better, more elegant ways to do things. If I'm not careful I'm going to end up with a site full of "elegant solutions" - but no content! Once I get the site officially up and running with plenty of articles, I may take the time out to add more features like this.
I really like the Welling and Thomson book too, I'm glad I decided on that one. I have thought about getting that new O'Reilly book also, but I'm not sure if it would be worth it.
Trisha
I don't believe you need to - unless you WANT to. The W&T book has everything I've needed and when I want a bit more clarification I go to php.net or come here and posted a Q.
Re: elegant solution - I completely understand. It's a good situation to be in though - it means you're learning. It seems that once every 8 months to a year I overhaul my web sites to make them better with what I've learned since their last build.
My question in the same vein, how to manage all the other structure tags in xhtml - h1-h5, div, cite, strong, etc etc.
Again, this comes back to storing tags in db tables, as well as getting users to know more tags.
It is getting to the point where you need a CSS "word processor" that can create and position these according to a custom DTD.
I am beginning to wonder if a correctly structured xml document should "stand on its own", and not be split and chopped to fit into neat db tables, ruining the whole conceptual point of xml.
cheers,
asp