PDA

View Full Version : Quick way to edit this?


UKSBD
7th August 2009, 18:55
Does anyone know of a quick way of editing this,
http://www.uksmallbusinessdirectory.co.uk/post-towns.html

basically got to change

strTown=TownName"> Business Directory</a>

to

strTown=TownName">TownName Business Directory</a>

ie.
copy the town string in to the anchor text

Is it possible or is it a 3 hour+ copy n paste job

ozbon
7th August 2009, 19:07
Well, you could use a regular expression if your text-editor will handle it.

You'd be searching for something like
strTown=[A-Za-z*]">Business Directory

and replacing it with
strTown=$1">$1 Business Directory

Which will do it - although this is just a rough example and probably won't work.

For text editing like this, I use TextPad , but I'm sure Notepad++ or whatever will do it too. Hell, you might even find MS Word will do it, using Advanced tools in the Find/Replace

TotallySport
7th August 2009, 22:24
copy the bit of html into word or similar then use a replace on all the code, then copy and paste it back.

If you remove the code and do it else where it will product the code you don't want to change.

Should take 5 mins.

UKSBD
7th August 2009, 22:39
Replace and copy'n'paste what?

ozbon
8th August 2009, 13:06
Is this a manually generated page? It seems like one hell of a lot of work, to me.

Is it not possible to consider having a database table of place names plus postcodes, which you pull out in order of the postcodes?

That way your 3hrs+ of cut/paste or editing would be one change in the file that generates all these codes.

If you're not sure on this, drop me a PM and I'll see what I can do to help

Kev Jaques
8th August 2009, 13:22
I didn't bother replying to this thread either, thought this would be in the db and auto generated, otherwise it's just crazy (insert crazy googly eyed smiley here ;) )

ozbon
8th August 2009, 13:30
Other than that option, I assume you've got this as an HTML page.

If you open the HTML page with Word (or Textpad, Notepad++ - whatever) you'll be able to do a find/replace as described above using regular expressions

ozbon
8th August 2009, 13:34
OK, I've done that regular expression-based search/replace, and while I can't attach files on this, it's available here for you to get :

http://www.ozbon.com/documents/towns.html

Hope that helps- I'd definitely look at putting it into a DB, though.

UKSBD
8th August 2009, 20:16
Thanks,

I already have all the towns in a database so could have pulled from there
but the towns in my database aren't tied in with the postcode area
(plus I only wanted a list of postal towns)

I've now created a CSV file with 2 columns.
one with town, one with postcode area,
how do I mport it to my database though?
Iv'e googled for instructions, been trying all the ways said, but no joy :(

ozbon
9th August 2009, 13:29
What database are you using? That's the first important point.

If necessary, send me the file, I'll see what I can do with it

Kev Jaques
9th August 2009, 14:01
I have some import code for XML file to MSSQL, other than that MySql can import it straight in.

UKSBD
9th August 2009, 17:32
Thanks both, I managed to do it though :)
Now I have it in the database I can sort it in lots of different ways, and
have done it like this for now,
http://www.uksmallbusinessdirectory.co.uk/post-towns.asp

I've also made it a select value when people register a new business,
http://www.uksmallbusinessdirectory.co.uk/advertising/free.asp
Will hopefully rule out similar spellings of towns, small villages, etc.

Thanks again