views:

71

answers:

4

I was planing to make two web pages (different domains) which deal with similar subject. On the first page there would be published articles and I would like to show those articles on the other page also (here would be displayed for example only last 10 articles). What is the best way to realize this?

EDIT: I use php/mysql

A: 

Sounds like you're not "linking" the two pages together, you're presenting two different views of the same data - the first page shows the full articles, the second page shows perhaps titles only of the last 10 articles.

Jeffrey Kemp
that's correct!!
ile
A: 

You should store your articles in a database which is available from both pages (are they on the same webserver?)

Then on one page you could do this:

SELECT title, summary FROM articles ORDER BY date DESC

and on the other:

SELECT title, fulltext FROM articles ORDER BY date DESC LIMIT 10

You can serve both web pages from the same webserver even if the domain names are different.

Mark Byers
They will be on the same hosting... I should check with my hosting provider is it possible that two websites share one database
ile
Have you tried giving the same connect string to both pages? If it's only username/password authentication, it might just work.
Mark Byers
Tried, not working...
ile
I think you need to contact your hosting provider. I can imagine that they may have restrictions that prevent one website from reading another's database (for security reasons).
Mark Byers
A: 

If both sites don't have access to the same database, you have to provide some kind of API for your first site that exports the last 10 articles in XML, JSON, whatever and include this into your second site.

Felix Kling
A: 

If you don't have the possibility to use the same database from the 2 different sites, you could also create a rss feed (or similar) of the 10 last articles, and use that to display the articles on the other site!

code-zoop
That's what I thought is best way... but is there possibility to use one database on two sites? (same hosting)
ile