Latest Register Log In

+ Advanced Search

Flat-file databases

Flat-file databases
By
10/05/06 (Edited 03/11/14)

If you're importing from Gossamer Threads Links 2.0 or Duncan Carver's Link Management, you can do this directly and simply... see scripts.webmastersite.net/w...ndex.php?section=resources to download the importers for those.

To import from any other sort of flat file database, go to Admin Panel -> Listings -> Add Listings and select the flat-file import option. You will need to specify the format of the file where it asks. Open the file in a text editor and deduce what the file is using to separate links from each other, and fields within the link. Then take note of what order the fields are in, starting with the number 0, and type the numbers where your admin panel asks.

The most common flat-file import may be CSV or TSV (fields separated by commas or tabs, records by newlines) -- you're better off using the specialized CSV importer option for a CSV or TSV though, don't use the flat-file import for thatrather than the flat-file import option, if you want to do a CSV.

For importing tags, separate each tag with a pipe (the | character). You can change this separator to something else with the $tagssplitchar tweak, but it needs to be unique, so you can't use a comma in CSV where commas are separating fields.

You can include custom fields in your import by modifying the import template (Admin Panel -> Themes -> Manage Templates -> Admin CP Templates -> Add Listings). Find
<br>Type: <input type="text" name="typeloc" size="5" value="{TYPELOC}">
in there. Copy that line, but change "type" to the name of your custom field in the name and value attributes. For example if you want to handle a field named "company" you should add this to that spot in the template:
<br>Company: <input type="text" name="companyloc" size="5" value="{COMPANYLOC}">
. Repeat for as many custom fields as you want.

To import file attachments, first upload the files to the /attachments/ directory. The standard importer template has spots to specify up to two files, if you need more than two files per listing you'll have to add lines to the template for fields named filefield3, filefield4, and so on for as many as you need. Your flat-file database will need to contain the filenames at this location. If you want to specify captions and sort orders for the file attachments you'll use filefield1caption and filefield1sortorder for those.

Alternatively, instead of uploading files to the /attachments/ directory you can specify a URL instead of a filename and WSN will automatically import the file from that URL. This, however, will make your import extremely slow and could lead to timeout errors or memory errors while it downloads many files.

If you're importing a very large number of items you may find that the page times out. If so you'll need to cut your file into parts and do one part at a time.

Be sure to regenerate counters at Admin Panel -> Maintenance -> Regenerate after you finish importing.




Description Importing from a text file of data.
Rating
Views 1857 views. Averaging 0 views per day.