Jump to content

Some questions


The Praetorian

Recommended Posts

I'm working on converting most of my html pages to php to make for easier navigation and I have some questions.I'm going to be storing all the info that goes on each page in my sql tables. Can I enter raw html into the fields of an sql table? The reason I ask is because I'm going to be having large blocks of text which will need to be broken up. Can I put header tags and p tags? Or do I need to code the php so that it parses a line break for every time I hit enter?I'm also not quite sure how exactly to code this. I know how to put all the information in and I know how to write the connection string, but as for getting it to do what I want... I don't expect anyone to write it for me but if anyone knew a good tutorial on how to do what I had in mind I'd appreciate it.Basically I just want the base page (whatever.php) to have a summary and a row of links that will lead to other information when clicked. So clicking the links would basically just go to (whatever.php?something=info). That way I don't have to code a different page for each bit of information but I also don't have to cram everything onto a single page.Again, any info anyone has on this would be greatly appreciated.

Link to comment
Share on other sites

Hi,Don't try to put entire page content in database. Then you have to go into database every time you need to make a spelling correction or so. Instead divide the content into different php or html pages and include them dynamically. Put the common content in one page, and dynamic contents in different pages. Call them something like this.<html>..... some common code like headings, banners, ads etc...<?phpinclude($_REQUEST['info'].'.php');?><!-- Navigation --><a href="whatever.php?info=computers">Computers</a><a href="whatever.php?info=health">Health</a></body></html>Also database connections are precious as they effect the script execution time. So use database only for "mission critical" things like meta data, user id and passwords, forum messages etc.- Krishna Srikanthhttp://www.krishnasrikanth.com

Link to comment
Share on other sites

I think I'm gonna need more information. Heh.For one thing I'm not sure that that's exactly what I want to do. The only thing I want to have in the database is a lot of text, an h1 tag, and some p tags. (Either that or figure out how to output those on their own.) These pages will have a lot of information contained on them, and I'd prefer to be able to pull them out of a database everytime someone clicks the appropriate link rather than having to create a different page for each block of information, or cramming it all onto a single page.Would what your suggesting work the same as that? If so, I definitely need more info please.If it helps, here's a website where the person is doing basically what I want done. I'm just not sure how they did it since I can't see their php.http://terrawin.net/tech.php?id=explosives

Link to comment
Share on other sites

I would suggest, if you want to store the data in your database, to only store the text and not the markup. If there is an h1, put that data in a separate column (e.g. "Header"). For the paragraphs, you could simply store the text with CRLFs (\r\n) and then, when you load the data from the database, you can replace the new lines with <br />s or wrap it all in a paragraph tag.The reason I suggest this is because you might want to use different markup down the road and it would be much easier (as Krishna Srikanth mentioned) to make a change in a single file rather than changing each row in your database.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...