最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

database - Automatically generate pages from SQL

programmeradmin8浏览0评论

I'm building a biodiversity database and am looking for the easiest way to display all the information online. I know I can do this without a CMS, but I have too tight a deadline to waste time designing something fancy from scratch (easier to slap a quick theme).

I'm struggling between choosing Wordpress (experience in it) and Drupal (it will definitely work, but much more time-consuming to make it look nice). I'd love to choose Wordpress, but I'm wondering if it can handle the main aspect.

Namely, can I automatically generate pages for every row in my main SQL table? Say I have a table with this structure:

ID | Rank | Parent | Name

This table will have 6000+ rows, and each Name must have its own dynamically-generated page. Populating each page is simple with custom templates which I already have.

My problem is having to manually make 6000+ pages, one for every name, and then making new ones every time a new species is added. Is there some function or plugin that will generate pages dynamically, with the custom template, and even with a nice permalink?

I can do this in Drupal, but don't know how I can do it in Wordpress.

I'm building a biodiversity database and am looking for the easiest way to display all the information online. I know I can do this without a CMS, but I have too tight a deadline to waste time designing something fancy from scratch (easier to slap a quick theme).

I'm struggling between choosing Wordpress (experience in it) and Drupal (it will definitely work, but much more time-consuming to make it look nice). I'd love to choose Wordpress, but I'm wondering if it can handle the main aspect.

Namely, can I automatically generate pages for every row in my main SQL table? Say I have a table with this structure:

ID | Rank | Parent | Name

This table will have 6000+ rows, and each Name must have its own dynamically-generated page. Populating each page is simple with custom templates which I already have.

My problem is having to manually make 6000+ pages, one for every name, and then making new ones every time a new species is added. Is there some function or plugin that will generate pages dynamically, with the custom template, and even with a nice permalink?

I can do this in Drupal, but don't know how I can do it in Wordpress.

Share Improve this question asked Oct 16, 2015 at 10:57 trilobutttrilobutt 11 silver badge1 bronze badge 4
  • Will you need to reimport these records into WP periodically, or is it a one-time import? – Aric Watson Commented Oct 16, 2015 at 13:53
  • The table will be continuously updated, so I'm hoping to write a php script flexible enough to query the table. Otherwise, no problem manually reimporting. – trilobutt Commented Oct 16, 2015 at 13:59
  • Your data doesn't really match up with WordPress post data. It isn't clear how things are supposed to work. It is relatively easy to import posts with wp_insert_post() by the way, but as I said, I wouldn't be sure where to put the pieces. – s_ha_dum Commented Oct 16, 2015 at 14:55
  • I was afraid of that :) I didn't know about wp_insert_post(), thanks for the heads-up. I'm not looking for an elegant back-end for now, so hopefully there's a quick-and-dirty solution I can hack together with it. – trilobutt Commented Oct 16, 2015 at 19:32
Add a comment  | 

1 Answer 1

Reset to default 1

Use a shell script and WP-CLI in your SSH console. Your shell script has to fetch each element of your table and launch the function of WP-CLI that creates a post in Wordpress. You can even provide a sort of template in the call of the function. WP-CLI is a useful tool, but you can also do it your own way by using Wordpress cli scripts (see documentation).

发布评论

评论列表(0)

  1. 暂无评论