|
In theory, very similar to the first reply I got, in that you change the ".action" to the new page. But very slick. I also liked the idea one person, who wrote a message on the article's page, had about having a single function that takes a parameter that tells it which page to redirect to. Very nifty.
Thanks everyone.
|
|
|
|
|
Yes - the guy "Mr Picky" is a mate of mine who wrote just to let me know that my code was messy and unweildy (What are friends for, eh? )
cheers,
Chris Maunder
|
|
|
|
|
i need to detect carrige resturns, and replace them with < b r >, thet text will of couse be entered into a text area in a form.
the technolodies i have at my disposal, are Javasciprt and PHP, does anyone know if this is possible?
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
never mind people, i found a function in PHP, the nl2br() function.
to use it, simply do
nl2br("this\nstring\nhas\nreturns");
and it turns the \n into <br>
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Nnamdi Onyeyiri wrote:
and it turns the \n into <br>
Just an FYI...
\r\n = Windows (not in textareas, but in text files)
\n = Unix\Linux\Posix, etc.
\r = Macintosh
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
|
This information really depends on what you are doing, but I first came across this issue when developing a website on a PC using PHP for a client using mainly Macs.
I was using my own API; however, and not nl2br() because it didn't provide enough functionality. I'm not sure if nl2br() will handle carriage returns and line feeds instead of just line feeds. I'll have to check I guess.
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
whats the difference? it works with the text like this
bla\nbla\nbla
and it also worked when i made a text file in notepad, uploaded it, then use a php script to open it, parse it with the nl2br() function.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Nnamdi Onyeyiri wrote:
and it also worked when i made a text file in notepad, uploaded it, then use a php script to open it, parse it with the nl2br() function.
You're not using a Mac. The data in a textarea is processed on the client by the browser and sent to the server. Just searching for \n will also catch \r\n, but not \r by itself.
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
Hi:
I am right now developing an application that involves filing up a pretty big report which spans over 5 pages.Now Right now the application has been so designed that everytime a page is filled up the connection to the database is opened,data is updated and then its closed.
But then now slowly security is starting to worry us and i am not too happy about having my connection string out for grabs in all pages..
Can You Suggest some articles or information that will help me with the design of applications taking security point of view..
People suggest using COM Objects for each page to help me in updating data.
Why Need Parking lots in Bars when Drunken Driving is Prohibited
|
|
|
|
|
Just a couple hours ago I started writting my own forums front end and have pretty much finished and now it is time to move on to the database backend.
What kinda structure would best be suited for a forum like this one...???
I'm thinking
Table: Forum
[PKID][Date][Email][Username][Password][Subject][Content]
the one feature I admire the most about CP is the nested child nodes...something that really lacks in other message forums around the net...and something i've taken care of in my own...
Anyways...if anyone has any tips about the database backend of things please lemme know...like do I create a new table for each message thats started...??? Or should I keep all messages inside the one table and use fancier code to track which message get inserted where...???
Thanx
Cheers!
p.s-pardon me for sounding unclear, but I haven't slept for quite a while and it's starting to catch up with me...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
...like do I create a new table for each message thats started...??? Or should I keep all messages inside the one table and use fancier code to track which message get inserted where...???
Hockey wrote:
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
Well I am no expert but I can tell you definitley not to create a whole new Table for each Message. That would just be insane.
You can have one Table with each Message as a record/row in the Table. One way to link parent-child Messages is to have an Parent_ID field which contains the Parent Message ID of the current Message.
However saying all that, XML IMO is the way to go for Forums nowadays, mainly because XML is heirarchecal and that is exactly what a Forum is all about.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
Paul Watson wrote:
XML IMO is the way to go for Forums nowadays
I needed results tomorrow not today so unfortunately I had to stick w/ PHP/mySQL/HTML.
I'm really gonna have to pick up a book on xml
I thought it was just another markup language though? How would it connect to a database...and what happens then, does the browser render it or is it like php and executed on the server first???
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
I thought it was just another markup language though?
It is, but in essence it isn't because it can contain any kind of data on Earth which is unlike previous markup languages. It's still saved as a plain ol' ASCII text file (one of the benifits actually). And, text files don't execute.
Hockey wrote:
How would it connect to a database
It would be up to the DBMS or a program to handle things of such a nature. XML is just data. It's flexible data, but it's still data nonetheless.
Hockey wrote:
and what happens then, does the browser render it or is it like php and executed on the server first???
XML uses style sheets for this - mainly XSL. Think of CSS on steriods. It's the XSL that tells the brower what the XML looks like. The whole point of XML is the actual data stays indepedant. So, I could use the same XML file with two different XSL files - let's say one to display the data in IE and one for Pocket IE.
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
Hockey wrote:
I thought it was just another markup language though?
It is, essentially.
However it is what you do with it that counts, lol. When coupled with another XML related technology, XSL (eXtensible Stylesheet Language) you can do some impressive "tranformation" of XML data.
Basically I can take an XML file, run it through an XSL file and have HTML come out the other side. Or I can transform XML to a tab delimited text file, or even another dialect of XML.
So to use XML in your website, you would store your forum in an XML file and then have how you want it too look stored in the XSL file. You combine the two and send the resulting HTML to the browser.
You could then use ASP (or PHP) to write new entries to the XML data file. So in effect your XML file becomes your database and XSL is your query tool.
You can also get most modern databases to output records in XML format, which is useful when you want to present those records to a browser via XSL.
Also as browsers modernise more and more of the XML/XSL transform can happen on the client, and not on the server.
The possibilities are huge and exciting. Also XML is not meant as a replacement for your database, so don't compare the two as if they were competing technologies. They serve different purposes and work well together.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
What RDBMS are you using? In the meantine, think about this...
Table: Messages
[MessageID][ForumID][UserID][Subject][Data][Nesting][Date]
Table: Users
[UserID][Password][Email][...]
Table: Forums
[ForumID][Title][...] You want to normalize the database to at least level three, so you don't end up repeating information over and over again. Make sure that under the Messages table that MessageID ForumID and UserID combined make up the primary key, and set foregin keys to ForumID and UserID to their respective tables.
Oh, and take Paul's advice about using tables. And, a well-designed DB can have a heiarchy so you don't have to use XML for this. For performance's sake, I'd suggest an import/export to XML, but not using XML for the transactions.
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
mySQL
The normalization of the database wasn't exactly what i was after, sorry...I prolly didn't explain well enough.
CP message threads have a hierarchy like one child is the child of another, but I have looked at a few examples of other forums and each implements a forum with a tree type structure...i've never worked with trees except binary trees when tinkering around with Huffman compression algorithms.
Any ideas on how I would make a DB structure like this...??
Also is it possible to insert a new record between 2 existing records rather than append new records all the time...???
if so, can I also somehow recalculate the auto-pkid value so if I insert
pk-id 4 between 1 and 2 would the RDBMS recalculate 4 and 2 to 2 nd 3 instead and so on throught out the database...??
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Take a look at the Messages table I typed in earlier...
[MessageID][ForumID][UserID][Subject][Data][Nesting][Date]
The Nesting field could contain the MessageID of its parent. But, that was just for illustration. For something like CP, I'd personally add two fields, as this would also help speed up the displaying of the messages.
Like this...
[MessageID][ForumID][UserID][Subject][Data][Root][Parent][Date]
Root would contain the MessageID for the base of the thread and Parent would contain the MessageID of it's message's parent. For base messages you could set both Root and Parent to NULL.
Using the structure above, here's a pretend thread in the DB...
[1][1][jeremy]["guess what?"] ["I have toe cheese!"][NULL][NULL][2002-07-22]
[2][1][hockey]["Re: guess what?"] ["That's grose!"] [1] [1] [2002-07-22]
[3][1][jeremy]["Re: Re: guess what?"] ["No, it's cool."] [1] [2] [2002-07-23]
[4][1][hockey]["Re: Re: Re: guess what?"]["You're crazy."] [1] [3] [2002-07-23] When browsing the messages like CP's DHTML view, you could use a simple JOIN to retreive the data in that manner.
Hockey wrote:
if so, can I also somehow recalculate the auto-pkid value so if I insert
PHP has a mysql_insert_id() function that will return the id generated from the previous INSERT statement. Check it out.
Jeremy Falcon
Imputek
<nobr>"..." - Paul Watson 07-17
|
|
|
|
|
hi t want to change the attribut of a file to read only from asp page how can i do ...
|
|
|
|
|
mysterious_must wrote:
hi t want to change the attribut of a file to read only from asp page how can i do ...
Short answer is to look into the FileSystemObject in ASP. It has all the file handling methods you need.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
I have a DataGrid with a delete column. When the user clicks the delete link I would like to have a confirm dialog popup. I would like to use the standard LinkButton because of the CommandName and CommandArgument.
How does one assign a client side script to the OnClick of a LinkButton?
|
|
|
|
|
See if this fits...
http://www.dotnetbips.com/displayarticle.aspx?id=108
Mike Stanbrook
mstanbrook@yahoo.com
|
|
|
|
|
Just what I needed. Thanks
|
|
|
|
|
Situation:
Datagrid that allows editing of a record. Works fine.
Problem/Issue:
When a record is selected to be edited, the page refresh (post) causes
the entire page to be redrawn. This is a big pain if the list to be edited is long, and the item currently being edited is contained near the end of the list.
I realize that adding DataGrid Paging is one answer, but is there any other way to have the page automatically relocate to the current Datagrid row being edited?
(Something tells me this is either "way easy" and I should be embarassed for having not figured it out, or it's not possible.)
TIA.
Mike Stanbrook
mstanbrook@yahoo.com
|
|
|
|
|
You could set Page.SmartNavigation = true.
MAC IE has problems with though.
|
|
|
|