Generate Wordpress posts - database

Is there any way to generate posts/pages for Wordpress? I have a seperate database with information I would like to use. For example, I would like to create the posts with the ID from my own database as link in Wordpress.
I think this is the way: http://codex.wordpress.org/Function_Reference/wp_insert_post although I have no idea where to put this. functions.php or post.php? And is it possible to call it on intervals? Maybe through a cronjob.
If anyone can point me in the right direction/confirm that I am on the right path that would be very helpfull.
Thanks!

Yes, wp_insert_post is the correct function, but the code should be in your own Plugin.
And then set up a WP Cron Job with wp_schedule_event

Related

How do websites use information on a database to create pages?

Sorry about the broad question. I'm just curious if someone could point me in the right direction.
Say there's a database of contact information, and there's a site where you can input a persons name and it brings you to a page with all of their information on that database. How does this happen exactly? The server would have to dynamically create this page, but does it have a generic format that it just fills with the information? And how does this happen?
Like you said, this is a an extremely broad question. It could be either way. The server could generate the entire contents dinamically, or it could be "filling the blanks" into a preformatted layout.
Google some PHP basic tutorials. That should give you a good idea about how this "dynamism" works. Sorry but your question is too broad to ellaborate more.
The server would dynamically create the page using PHP and SQL. There is a quick tutorial at http://www.mysqltutorial.org/php-querying-data-from-mysql-table/ that shows how it would be setup.
If I understood your question right, you are asking things like how this page was created, for example, in which case it can be as simple as a basic PHP and SQL combination. You can check an example on the w3sschools website:
Try it yourself example
There would be special place holders for the data and a query will extract the data and put it into the given place holders, please note, you can also use loops to add things like tables, fetch through multiple rows and so on.

Where to get an updated list of video games?

I am currently designing a reviews site for video games similar to gamespot am wondering where and if there is an online database that contains information such as name, publisher, release date etc with an API. I dont really want to have to enter each title manually or let users enter the title manually.
Where do these large sites get information like this? I wouldn't think it would be manually. I know for movies IMDB exists.
How would I go about adding it to my database?
Thanks
May I point you to web scraping?
Be sure to read the section legal issues and on well-behaved bots.
There's always Amazon and their product advertising API. Some older, but interesting code snippets can be found on this page.
If you know Perl, there is an amzing module called WWW::Mechanize
Pretty much you can write a script to get to any website and grab any data you need.
So for example you can go to www.gamespot.com, get list like the one below and put them in your database.
http://www.gamespot.com/games.html?platform=1029&mode=all&sort=views&dlx_type=all&sortdir=asc&official=all&tag=games%3Bfooter%3Bmore

Receiving / retrieving email in CakePHP

I am developing a basic yet highly customized CRM for a small training centre which has the ability to store student records and also send emails to them. I'm using SwiftMailer following this excellent tutorial in CakePHP to accomplish the sending part.
Of course, students are sometimes going to reply to emails and I'd like to retrieve them within my CRM and store them along with the student record.
However, I cannot find a single reference to doing this. I've tried the following Google searches: "receiving email cakephp" , "retrieving email cakephp" and even "email client cakephp" but all of these queries give results relating to sending mail rather than receiving it -- very frustrating!
Finally, I broadened my search to non-cake solutions and found someone recommending a library called ezComponents. It doesn't seem to have had any active development for about a year, but it includes an email receiving class which is exactly what I want. Unfortunately, I have no idea how to add this to CakePHP and the only post I've been able to find on the entire web on the matter doesn't exactly go into much detail. It's certainly not a step-by-step tutorial on using ezComponents on CakePHP like the SwiftMailer tutorial I mentioned above.
I also found a class on Google Code called php-imap which looks like it would do the job but, again, I haven't the slightest clue how to get it working happily in Cake like SwiftMailer is.
I realize that I may have to learn how to package classes for use in Cake by myself but I'm asking this question first on the off-chance that there is already a Cake-friendly solution to this problem that I just haven't realized :-)
Joseph
Thanks to everyone for your answers, but I've been doing some more searching and it looks like the solution is actually incredibly simple.
Basically, with the help of a plugin, I can set up the mail server in databases.php as a datasource and then write a Model and Controller to interact with it.
Here's the example I found: https://github.com/kvz/cakephp-emails-plugin
Edit: the repo has been deprecated and is now available at https://github.com/kvz/deprecated/tree/cakephp-emails-plugin
You will want to pipe your email to PHP and use stdin:// to read the contents of the email and add the e-mail to your database.
I've done this with cake and the simplest way is to make a Cake console application to handle the parsing. Also using cpanel's account level filtering to generate the pipe is really simple.
http://forums.cpanel.net/f5/piping-mail-php-scripts-howto-checklist-50985.html
http://www.evolt.org/incoming_mail_and_php
Sounds like you want to include SwiftMailer as a Cake plugin, amirite?
http://book.cakephp.org/view/1111/Plugins
-- if you want to package it yourself. Otherwise, a cursory search of the Bakery yielded this result:
http://bakery.cakephp.org/articles/sky_l3ppard/2009/11/07/updated-swiftmailer-4-xx-component-with-attachments-and-plugins
Hopefully it will at least get you pointed in the right direction. HTH. :)

Can we create table for wordpress?

I am very new to wordress. I have a appointment form. While submitting a form i need to save those information from the form to the database. I created a table of my own lets say wp_appointment and saved the information to this table. Now what i want to know is that is this a good way to do so or is there any solution to this. And i need to display those information in admin section and update. Is it possible? Please do suggest me if i can do or not.
Thanks in advance
Now what i want to know is that is
this a good way to do so or is there
any solution to this.
Yes, this is the ideal way to doing this. Besides, there is something to consider:
For ease of use and compatability, you can use wordpress's built-in database functions. Check this one: wpdb Class
And i need to display those
information in admin section and
update. Is it possible?
Sure. You can create a custom admin page and show/make editable them in there. As a start point check this link: Adding Administration Menus. You can apply the instructions told there to your function.php file to have custom pages without create an "external plugin".
To answer your questions: Yes, it's possible. And what you described is being done by current calendar plugins.
Here is one:
http://wordpress.org/extend/plugins/events-calendar/
I would take a look at their code to see how they implement something similar to your idea.

Access to facebook data

I want to access facebook's database.
I want to have some SQL-like access, let's like this:
"select name from facebook-big-database-table where location='France' and city='Paris' and age
between 30 and 40;"
But, it need not to be SQL, PHP or JAVA would also be nice to use to me.
Does anybody know where to start?
To be honest, I got a little bit lost in all the tutorials Facebook offers.
Is it the so called "Connect" program which offers me what I want or something different?
Facebook does have a bunch of API's, one of which actually looks like SQL. They call it FQL. Check it out here. Maybe it can help you some part of the way at least.
Note that it won't give you raw access to the underlying tables. But still, better than nothing I guess.
Facebook isn't going to let you mine their database in that way. Not possible.
You wont be able to access facebook's database. The most you'd be able to do is to get information of users who previously have consented your application to access their data.
Therefore answering your question, what you want can't be done, period.

Resources