andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


XML

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Website Feedback
View previous topic :: View next topic  
Author Message
already_dead
Newbie


Joined: 21 Dec 2005
Posts: 11

PostPosted: Wed Dec 21, 2005 12:51 pm    Post subject: XML Reply with quote

General feedback: Most of your PHP has html tags in it, but I was thinking you might be wise to perhaps do some kind of preg replace on all the <br> and change them to <br /> to make it XML compat (everythings gotta have a closing tag). It would be wicked easy to do even by hand. Theres more tags that would need this, but they escape me at the moment.
Back to top
View user's profile Send private message Visit poster's website
already_dead
Newbie


Joined: 21 Dec 2005
Posts: 11

PostPosted: Thu Dec 22, 2005 3:17 am    Post subject: Reply with quote

Just another PHP coder:

I changed all the <br> to <br /> in all your scripts for you.

Check function trimStringToLength($string, $length, $more = true), it deals with <br> and I changed them to <br />

I tried to put them on the BBS but it got cropped. Check your email. Can I get a shoutout?

-John
Back to top
View user's profile Send private message Visit poster's website
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Thu Dec 22, 2005 7:32 am    Post subject: Reply with quote

Thanks for the file - I'll look through it during the Christmas holiday.

One thing though; what if someone is using the trimStringToLength function on code which is pre XHTML? Or is using the output for, say, HTML 4.01? Having <br> in those instances is perfectly valid, and the update would fail. (As much as it would trying to find <br> in an XHTML document, of course.)

Possibly it should have something more along the lines of:

PHP:
<?php $trimmed str_replace('<br />''... 'preg_replace('|(<br(\W+)?/?>)+|''<br />'$string)); ?>


which would detect <br>, <br/> and <br />.

The substituted '<br />' tag (first parameter of the str_replace and second parameter of the preg_replace) is actually fairly arbitrary as all I'm doing is replacing it with '...'. The code could be this and work just as well:

PHP:
<?php $trimmed str_replace('[--REPLACE ME--]''... '
                                    
preg_replace('|(<br(\W+)?/?>)+|''[--REPLACE ME--]'$string)); ?>


Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
already_dead
Newbie


Joined: 21 Dec 2005
Posts: 11

PostPosted: Thu Dec 22, 2005 7:38 am    Post subject: Reply with quote

Exactly. I wasn't really looking for instances like that, I just copied all the scripts to the same text file and did a find & replace <br> with <br />. Took about 5 minutes, but that function caught my eye. I'll leave it in your capable hands.
Back to top
View user's profile Send private message Visit poster's website
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Thu Dec 22, 2005 8:06 am    Post subject: Reply with quote

Cool. You've prompted me into looking over the scripts, which is a good thing... Life always seems to get in the way of playing around with some fun code, though. :-/

Btw; a very handy site you have there in your sig. I'm in the process right now of looking around for a new hosting company. Wanted something a little local, though (England), but it's good to see what's out there.

Cheers!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
already_dead
Newbie


Joined: 21 Dec 2005
Posts: 11

PostPosted: Thu Dec 22, 2005 8:21 am    Post subject: Reply with quote

Maybe I should add a field in the database to indicate where their datacenter (or centre, as you might say) is located, you think? I'm trying to make the links (cost, name, etc) more OOP. At the moment they are just static links to a new .php file with a different $sql SELECT... query on each one. It's a pain in the bum to change. I think if I study script like yours I'll get it done.

I thought for sure if I could get wwwcheckup working I could study how the vars passed in the URL and do that for the queries...
Cheers indeed!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Website Feedback All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group