Click to See Complete Forum and Search --> : Clips from news page to appear on home page, iFrame?


rodd1000
03-29-2010, 06:32 AM
Hi Guys, could anyone point me in the right direction here.
I'm working on a site with a news page that can be updated using cushy cms online. I would like to mirror the news text from the news page on the homepage without having to update both pages.

I have created a box on the homepage specific for the news to appear, i just need to work out how to include the content from the news page.

Could this be done using an iFrame somehow?

Any ideas much appreciated

Thanks,

Rod

tirna
03-29-2010, 07:17 AM
To do it client side you could do something like this.

Put the news text in javascript function and then call the function wherever you want the text to appear on the web page. In practice you would put the js function in an external js file.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
<!--
function getContent() {
document.write("news text");
}
//-->
</script>

</head>
<body>
<h1>Page Title</h1>
<div>
<script type="text/javascript">
<!--
getContent();
//-->
</script>
</div>
<p>More content</p>
</body>
</html>


To do it on the server side, you could put the news text in a php include file and then call that include file using the include() wherever you want the text to appear.

rodd1000
03-29-2010, 08:08 AM
Hi and thanks for the reply,

Only problem is if the news text is placed in a Javascript i don't think the guy will be able to edit it in Cushy Cms, as i think you can only edit text placed within a div. The php method might work better, any idea what code i could use.

Thanks again,

Rodd

6StringGeek
03-29-2010, 09:51 AM
Put your news (html formatting and all) in a file named whateveryouwant.php

Then call that file from the news and home page like this:

<?php include("whateveryouwant.php"); ?>

Your news and home page will also have to have the .php extension for this to work properly.

rodd1000
03-30-2010, 03:58 AM
@6stringgeek,

Ok, just tried this but for some reason adding the php include either moves another div out of position and upsets the css? i'm really confused why this should be happening?

It seems ok in Firefox but IE, Chrome and Safari have weird scroll bars appear around the section titles?


you can see here (http://www.cnsdemo2.co.uk/zenco/)

Any ideas guys?

Thanks for the help, much appreciated.

rodd1000
03-30-2010, 06:52 AM
Problem Solved,

Thanks for your efforts guys, i replaced the tables for divs.

Thanks again.