Jump to content

how does this work?


haku87

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.