Joomla! Discussion Forums



It is currently Wed Nov 25, 2009 4:15 am (All times are UTC )

 


Forum rules

Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
Posted: Wed Jan 24, 2007 1:20 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Wed Sep 06, 2006 1:14 pm
Posts: 112
Location: St Louis, MO
In setting up a new Joomla site, I would like to import a large number of sections and categories without tediously entering them one by one manually via the GUI. Ideally, the solution would be to import a csv file into the database in such a way the the IDs automatically increment. In searching the forum, I have been unable to locate a solution. Does anyone know how to do this?

_________________
Pastor Dan
http://www.pastordanwalker.org
http://www.topchurchwebsites.com


Last edited by Pastor Dan on Fri Feb 09, 2007 11:19 pm, edited 1 time in total.

Top
  E-mail  
 
Posted: Wed Jan 24, 2007 2:19 pm 
User avatar
Joomla! Master
Joomla! Master
Offline

Joined: Thu Aug 18, 2005 8:55 pm
Posts: 12899
Location: Nijmegen, The Netherlands
The ID is autoincrement, isn't it? Could you give all the section records that you are about to import a 0 as ID?

Another method: export the current jos_sections as CSV, import that in a spreadsheet.
Add the new records and make sure that the fields do correspondent with the original ones.
Copy the empty fields with the values of the original fields.
& fill the IDs with new (increasing) values.
Import the new records as CSV.

_________________
Kind Regards,
Peter Martin, Global Moderator - Community & Leadership Team
www.db8.nl - Joomla specialist, Nijmegen, Nederland
Joomla 1.5 Quick Reference Guide: www.db8.nl/en/downloads/misc-downloads/ ... glish.html


Top
   
 
Posted: Wed Jan 24, 2007 5:36 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Wed Sep 06, 2006 1:14 pm
Posts: 112
Location: St Louis, MO
Thanks for the info. I now realize this is very simple if you know what to do. Here's what I did to get it to work for those who don't know much about MySQL, like me.

1. Export the table jos_sections from the database using phpMyAdmin. I exported it with the options csv for Excel and include field names (so I knew what was going on).
2. Open the file in Excel and based on the structure add new lines setting id as zero. The basic elements to change are of course the title, name and possibly a description. Remove the previously existing sections and the field names row and save as csv file.
3. Back in phpMyAdmin, import your csv file into the jos_sections table with format csv and fields terminated by comma. Leave other settings the same.
4. This adds your new sections and auto increments the id.
5. Repeat the process for jos_categories, making sure that you put the correct section numbers in for your new categories.

You should be able to add a very large number of sections and categories relatively painlessly this way.

_________________
Pastor Dan
http://www.pastordanwalker.org
http://www.topchurchwebsites.com


Last edited by Pastor Dan on Wed Jan 24, 2007 5:38 pm, edited 1 time in total.

Top
  E-mail  
 
Posted: Fri Feb 09, 2007 8:18 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Wed Sep 06, 2006 1:14 pm
Posts: 112
Location: St Louis, MO
The above procedure also works to import content items from an Excel csv file directly into the database as well, except when you have double quotes in the content (from html code for example). Even though the double quotes are correctly escaped by another double quote in the Excel csv file, you get an error when trying to import with phpMyAdmin. I think this must be a bug in the importer.

Here is the simple solution. Import your csv file with format "csv using LOAD DATA" rather than format "csv" as indicated above, leaving all other instructions the same. The content with double quotes is correctly imported. I am using PHPmyadmin 2.8.2.4.

_________________
Pastor Dan
http://www.pastordanwalker.org
http://www.topchurchwebsites.com


Top
  E-mail  
 
Posted: Fri Feb 09, 2007 8:37 pm 
User avatar
Joomla! Master
Joomla! Master
Offline

Joined: Thu Aug 18, 2005 8:55 pm
Posts: 12899
Location: Nijmegen, The Netherlands
Thanks for sharing that usefull info!

PS: Could you please mark your first message in this thread as "solved" ?
(Modify the first message and choose the Message Icon [solved]).
This way the list of messages shows that the question was solved, and other users can benefit from it.

_________________
Kind Regards,
Peter Martin, Global Moderator - Community & Leadership Team
www.db8.nl - Joomla specialist, Nijmegen, Nederland
Joomla 1.5 Quick Reference Guide: www.db8.nl/en/downloads/misc-downloads/ ... glish.html


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 5 guests


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 post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group