homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

ALA Article ->Manage Your Content With PHP

 9:24 pm on Aug 13, 2002 (gmt 0)
My original question was if anyone knew of any good articles or tutorials on using CSS with PHP, then I found ALA's article this week which utilizes XHTML/CSS/Cookies/PHP - so I thought I could find a few clues there.

However, if you know of any other articles on the subject please post them.

Here is the ALA article:





 11:54 pm on Aug 13, 2002 (gmt 0)
If you're looking for the style switcher only this is relevant: http://martin.f2o.org/php/designcustomization.

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.


 12:21 am on Aug 14, 2002 (gmt 0)

Cool, I'll have a look around at your site and the evolt link - looks like good stuff. I want to use PHP, CSS and XHTML only for time being - so any info on explaining the alchemy of such would be right on.



 12:37 am on Aug 14, 2002 (gmt 0)

>I want to use PHP, CSS and XHTML only for time being - so any info on explaining the alchemy of such would be right on.

I don't understand any chemistry, sorry ;-)
Seriously what do you mean?


 4:05 pm on Aug 14, 2002 (gmt 0)

Hey- Most of the tutorials on PHP and MySQL that I have been going through use tables for the layout- like when pulling content from a database.

I just wanted to find some that deal with table-less design.

brotherhood of LAN

 4:56 pm on Aug 14, 2002 (gmt 0)

Hello madcat,

Are you meaning along the lines of this?

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

I highly recommend downloading the PHP and mySQL documentation and filling the kettle ;)


 5:16 pm on Aug 14, 2002 (gmt 0)

You caught me- that's what I'm doing right now. I'll have a look at the thread and the links posted on it - thanks.

In the end, I simply want to use CSS/XHTML for the frontend and PHP/MySQL for the backend- no tables at all except for graphical data. Simple enough eh?


 5:20 pm on Aug 14, 2002 (gmt 0)

As a newbie to all of these technologies... I have to admit, I never thought you could have a table-less thing going on with MySQL... Isn't SQL itself all based upon tables?

Regardless, getting into these things is exciting... Not to mention headache-inducing!


brotherhood of LAN

 5:22 pm on Aug 14, 2002 (gmt 0)

>Simple enough eh?

Nothing seems simply after you are introduced to these excellent codes. I want to make my webpages so light they are in danger of floating away. I asked the question in the above thread for the same reason. :)


 5:24 pm on Aug 14, 2002 (gmt 0)

RC78 they are referring to different tables than the DB tables. They are talking about when you pull the data from the DB table and place it in a HTML <table>. They are trying to find away around it.

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>

brotherhood of LAN

 5:40 pm on Aug 14, 2002 (gmt 0)


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 :)


 5:46 pm on Aug 14, 2002 (gmt 0)

Yeah no doubt CSS is the way to achive what is requested. Defining the <p> in CSS is not a problem either. But you have made me think of a question. Some of what I am doing are articles. Eventually someone else will be entering them into the DB through a form. How am I going to insert the <p> for each paragraph? Currently I am just putting them in the DB with the content but thats not going to be possible unless I teach them how to do this and hope they remember. This is probably a totally different thread and Ill post it when I get there. I am just ranting now. The PHP/MySQL/XHTML/CSS combo is possible, no tables needed!


 6:12 pm on Aug 14, 2002 (gmt 0)

Knowles, did you read that ALA article? I might be missing what you're saying, but in my first project I'm going to have an application that lets people submit articles and stories as well.

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;)


 7:08 pm on Aug 14, 2002 (gmt 0)

Madcat I have looked over it, I havent had a chance to sit down and read it yet. I think I must be missing something, I am not seeing where it brings MySQL in at all? In my last post I was referring to was a CMS I am building. I am trying to figure out how to auto insert <p> tags instead of storing them in the DB thats why I said it for a different thread.


 1:31 am on Aug 15, 2002 (gmt 0)

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! :)


 6:45 am on Aug 15, 2002 (gmt 0)

xhtml + css (of course) + php + mysql?!? how about using a folder and a file only instead of mysql? i know it has some drawbacks ... but anyone here have some gud information on this? I am planning to use mysql but for a small site, a folder and a file would be enough for me ... and to complicate things up ... the file in the folder would be in xml?

insights on this?


 7:28 am on Aug 15, 2002 (gmt 0)

In regard to table-less php xml: I'm interning for a major business/tech magazine here in San Francisco precisely so I can learn their Content Management System as well as their ad serving stuff.

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.


 12:51 pm on Aug 15, 2002 (gmt 0)

Not to get too far off topic but doesn't Atomz use an intermediate step? They have their own servers which are what you actually use to do your page creations (using your templates or ones they design for you) and then their servers publish the pages to your website - wherever it may be. I've never looked into Blogger.

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.


 10:12 pm on Aug 15, 2002 (gmt 0)

I think a db will not be faster than a file (at least not always). Usually filesystem caching is better than the db caching. However, db is faster on searches and you can do complex queries.

On the other side... I'm no expert.


 12:53 am on Aug 16, 2002 (gmt 0)

Neither am I but in my mind, a query is much faster to pull and display data with than opening a file and parsing it to screen. Perhaps someone with more experience can fill us in.


 1:15 am on Aug 16, 2002 (gmt 0)

>Neither am I but in my mind, a query is much faster to pull and display data with than opening a file and parsing it to screen. Perhaps someone with more experience can fill us in.

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.


 8:12 pm on Aug 18, 2002 (gmt 0)

I first saw this thread today - I am also working on a site using PHP/MySQL/XHTML with CSS for layout. I have finally gotten all the technical parts done, I just need to add content now. As the basis for my site I used the content management example in the "PHP and MySQL Web Development" book by Welling and Thomson. I had to change some parts a bit, and add to it, but I was able to put my site together because of the information in that chapter. Their example uses tables for layout though, but it wasn't difficult to do it with CSS.

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.


 12:14 pm on Aug 19, 2002 (gmt 0)

You could make use of javascript Trisha. I saw it on some bulletin boards like [yabb.xnull.com...]


 1:26 pm on Aug 19, 2002 (gmt 0)

Aw Trisha,
You're so close to the elegant solution you should just go for it! :)

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.


 10:52 pm on Aug 20, 2002 (gmt 0)

matthias - javascript might work, but I've turned into a sort of anti-javascript person lately, maybe its not really all that bad, but I've been trying to avoid using any on this particular site.

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.



 11:09 pm on Aug 20, 2002 (gmt 0)

I try to avoid javascript on open sites to, but I use it on some admin-interfaces for the content editors.


 1:06 pm on Aug 21, 2002 (gmt 0)

...thought about getting that new O'Reilly book...

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.


 3:42 pm on Nov 4, 2002 (gmt 0)

I like lorax solution to the <p> - just gotta remember to terminate </p> as well.

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.



Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved