Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Create Categories

Quote Reply
Create Categories
Is there a way to create several hundred categories at one time, i.e. create a text file an import into links in this format:

category1
category1/subcategory
category2
category2/subcategory/subsub

etc...

</not a clue>
Quote Reply
Re: [Kilroy] Create Categories In reply to
The way I do it is to write a PHP/Perl script to grab the list, and do a 'foreach' to add the new listings to the database....Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Create Categories In reply to
Do you have that script?Cool

Thanks,
sve
Quote Reply
Re: [vensub71] Create Categories In reply to
Not currently, as it varies for different clients. Its not hard to write though Wink

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Create Categories In reply to
Can you give us an example, or a start point to write a script like this???
Thanks,

</not a clue>
Quote Reply
Re: [Kilroy] Create Categories In reply to
Code:
#!/usr/bin/perl

open(FILE_CATS, "/path/to/file.txt") or die "Cant open: reason: $!";
@input = <FILE_CATS>;
close(FILE_CATS);

foreach (@input) {
chomp;
# dop stuff here....
}

Short enough for you Laugh I couldn't really write any more without giving away my entier script :p

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Create Categories In reply to
You should get into the habit of using while loops instead of putting everything into an array and then looping, it wastes memory.