Forum Moderators: coopster

Message Too Old, No Replies

Very Very Hard Question!

concerning include tag

         

aliop1

11:17 pm on Jun 27, 2005 (gmt 0)

10+ Year Member



well i shuold say its not easy but well i try to ask

i have 2 websites i wanna use content of my first website in second website but i dont want all content i need some part of content is it possible using the include tag?

Blackie

8:02 am on Jun 28, 2005 (gmt 0)

10+ Year Member



If both websites uses same scripting language (php, asp, etc) of cause you can use include to use some script-files on both websites.

If the backend is different still you can find ways of reusing the content, but this will require additional programming and not just include.

Hope I understood your question correctly.

aliop1

8:42 am on Jun 28, 2005 (gmt 0)

10+ Year Member



thanks for reply

but is there any ready script for it i am not so good with php scripting.
no my first is a ready script wich use php the other i made myself using shtml :(

Blackie

8:49 am on Jun 28, 2005 (gmt 0)

10+ Year Member



What is it actually you want to reuse? Text? Pictures? Or something else? Where do you store this information? Database or files?

Try to describe better what you want to achieve.

aliop1

9:09 am on Jun 28, 2005 (gmt 0)

10+ Year Member



Text+Pictures i wanna use them in a file .

my first website is a music website with music content and photos of musiciens i wanna use just the latest musics i added there i dont wanna get my other website header or footer i just want some clip from center of it if you want i can pm you he addresses :D

Blackie

11:03 am on Jun 28, 2005 (gmt 0)

10+ Year Member



you can drop me a sticky :-)

Blackie

1:27 pm on Jun 28, 2005 (gmt 0)

10+ Year Member



Does this information stored in a database?

aliop1

2:09 pm on Jun 28, 2005 (gmt 0)

10+ Year Member



no it dosent have anykinda database if you want i can send the script copy to you so can give a look

defanjos

2:17 pm on Jun 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I already do something very similar with ASP.

This is what I do:
On site 1, I have an include file (lets say common.asp) with the information that will be used in both sites.
Then I create a page on site 1 and include in it common.asp, plus anything else I want.

One site 2, I create a page and use ASPtear to get the information from common.asp

Works like a charm.

ADDED:
Oops, just noticed this is the PHP forum.
Anyway, I will leave the above info, it might be helpful.

StupidScript

11:47 pm on Jun 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It sounds like the hard part will be isolating the stuff you want to include. Including files is very simple.

For example, say you have a page:
"domain1.com/eric_clapton.html"

<html>

<head><title>Eric Clapton</title></head>

<body>

<h1>Eric Clapton</h1>

Eric Clapton has played guitar for a looong time ...

</body>

</html>

Now you want "domain2.net/e_clapton.php" using stuff from the original page ... but you've got a complete original page with the title tag and everything.

It could be as simple as:
"domain2.net/e_clapton.php"

<?php

include "http://domain1.com/eric_clapton.html";

?>

but that would give you two identical pages.

Depending on how big the original site is, it might be a good time to restructure it so you can include stuff easily on another site, like defanjos does in ASP. You need to separate the content from the page structure code, either by physically separating it:

<?php

$thispage="eric_clapton";

?>

<html>

<head><title><?php include $thispage."_title.html";?></title></head>

<body>

<?php

include $thispage.".html";

?>

</body>

</html>

That's your template ... have different "_title.html" pages that just hold the title, and different ".html" pages that hold the page content for each musician.

Then on your new domain, just include the content, as above, wherever you want it in your new code.

It's much tougher without having separate content, but you could do it. The above method of separating the content out in advance will pay off in the long run.