haku87 Posted February 25, 2007 Share Posted February 25, 2007 Hi, I am a newbie in php. I was attempting to create an dynamic driven website using mySQL. I saw people using things like ....test.php?id=7 & ... May I know how does it work? Let say I want to dynamically loaded the content from the database using a template. Let say when i clicked on About Us. It load the same test.php?site=aboutus? How do I tell the server which content to load. Second Qns. Does people store large amount of text in mySQL database or there are other means of doing it. If have, any typical example? Thanks in Advance Andy Quote Link to comment Share on other sites More sharing options...
Orio Posted February 25, 2007 Share Posted February 25, 2007 Question 1- These values are passed through HTTP GET. Read here more. Question 2- You can store it in a column that it's type is text or blob. (more info here). You can also store the data in text files if you want. Orio. Quote Link to comment Share on other sites More sharing options...
haku87 Posted February 25, 2007 Author Share Posted February 25, 2007 Ok.. Thanks. Let say I store it into a database. I want to create an editor which can edit the content which can include space and new paragraph. Can it contain paragraph? Let say in my database, there is a field called test of boob type. I create a textbox in php and update it to the field. Would it display correctly in php page? Thanks for ur help Quote Link to comment Share on other sites More sharing options...
Archadian Posted February 25, 2007 Share Posted February 25, 2007 as far as your test.php?di=7 question i put up an example for someone else, it might help you better understand the concept http://www.phpfreaks.com/forums/index.php/topic,128580.0.html Quote Link to comment Share on other sites More sharing options...
dswain Posted February 25, 2007 Share Posted February 25, 2007 Yes you can do exactly that with PHP and HTML. That's probably how this forum works here. Basically, you write the script so that if you tell it to execute a certain function, then it will give you a form and you can enter your text and whatever and the submit it. Then, you write another function in the script which will go grab that data you inserted into the database and output it as regular HTML. It basically looks like any other site, it's just getting the info from that database instead of a hardcoded webpage. It's tough at first, but it's well worth your time. I hate to spam, but if you want an example: http://swainnet.zapto.org/ is my site. That front page is MySQL/PHP/HTML running. I have another page where I can add/edit/remove entries from the database and this page gets the updates automatically. Quote Link to comment Share on other sites More sharing options...
haku87 Posted February 26, 2007 Author Share Posted February 26, 2007 oh.. Erm.. I think you misunderstand what i meant. It is something similar to the post reply. How am i going to create things like this? Have a bold button, change color and those.. How does the preview button work. Why it can display everything in html? Another question I understand that table border like this forum are created using css style. But I cannot find any nice table border like this forum. Any Links? how am I going to include in my php page? Andy Quote Link to comment Share on other sites More sharing options...
nloding Posted February 26, 2007 Share Posted February 26, 2007 Best thing to understand how the editors work is to look at the code for one. They are pretty Javascript heavy. In fact, hit Reply at the bottom of this thread, then view the source code. SMF is open-source, so take a look at how they use their bold, italic, underline, etc using Javascript. I think you need to start more basic though. If you don't know how to use XHTML, CSS, and PHP together, then you need to start there. I don't know exactly what table borders you're referring to, but yes, all styling on modern sites is done with CSS. No one here is just going to tell you how to do it -- 1) you'll never learn, 2) you're not paying us to write your code Start working on it, Google for answers, and if you really can't find anything, come back, post your code here, and we'll help. Quote Link to comment Share on other sites More sharing options...
haku87 Posted February 26, 2007 Author Share Posted February 26, 2007 ya.. I already google through the internet. My question is that javascript html editor give things like "" but html tag are <b></b> how does they(ie. like this forum) store them in database and change it to html tags Quote Link to comment Share on other sites More sharing options...
nloding Posted February 26, 2007 Share Posted February 26, 2007 Seriously, go to www.simplemachines.org and check out the code for this forum. It's well-written, pretty easy to follow. If you'll notice, the tags when you hit "B" for bold, or "I" for italic are in brackets: This is bold: [b][/b] This is italic: [i][/i] That is how it is stored in the database. When it is parsed when displaying the topic, I assume they use preg_replace() to replace everything matching the [b ] code with <strong> or something similar. That would be the safest route so they can strip all HTML tags from the text box to prevent any sort injection. I'm honestly not sure about paragraphs -- I'm learning that part myself, but what I said above is one way to do it. Quote Link to comment Share on other sites More sharing options...
haku87 Posted February 26, 2007 Author Share Posted February 26, 2007 Ok thanks, I will look into it.. Another question.. If I store those html code inside the boob field in the database, will it be too huge.. does fetching from the database required alot of time (ie loading time). Andy Quote Link to comment Share on other sites More sharing options...
nloding Posted February 26, 2007 Share Posted February 26, 2007 The more there is the longer it takes to parse. The longer the book the longer it takes you to read it. Fortunately, people are used to a small page load wait on the internet ... even on a high-speed connection, it takes a few seconds to load a page on database heavy sites, and people understand that. It shouldn't take so long that you're wasting someone's time. Provided that your server has the hardware capable of handling it. Dual-Opteron with RAID 0+1 and lots of RAM type of thing. Quote Link to comment Share on other sites More sharing options...
haku87 Posted February 26, 2007 Author Share Posted February 26, 2007 Erm.. I really getting struck in this.. So hope that u can help.. I trying to create an css style border with table looking something like this table. I attempted to cut them into six piece.. but I am struck in writing the CSS script. I already attempted looking for tutorials but failed. Thanks. Btw, Really Thanks alot for ur help.. I really appreciate it.. Thanks.. [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
nloding Posted February 26, 2007 Share Posted February 26, 2007 First, I doubt you looked very hard because there are thousands of tutorials on creating borders in CSS. Second, this is the PHP forum ... repost your question in the CSS forum. Third, when you do that, you'll have to be more descriptive ... because the borders around these forums are "border: 1px solid gray" (gray may not be the exact color, but close). So you'll have to show an example or be very, very descriptive with what you want to accomplish. Quote Link to comment Share on other sites More sharing options...
haku87 Posted February 26, 2007 Author Share Posted February 26, 2007 Sorry that I posted in the wrong forum. Yes.. I know.. Those tutorial only teaches people how to table with standard border. MOST! I managed to find one.. But it was very complicated. Hope there is a tutorial to help me out in this. This is the link to the tutorial that I want to do. However, I did not understand what they are trying to say. http://www.456bereastreet.com/archive/200505/transparent_custom_corners_and_borders/ Quote Link to comment Share on other sites More sharing options...
nloding Posted February 26, 2007 Share Posted February 26, 2007 Go to a bookstore and pick up a book on CSS -- I recommend the CSS books from Wrox. Then you'll understand what he's talking about (except maybe PNG alpha-transparency, with something completely different). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.