PDA

View Full Version : Making a cutenews link go into a PHP include? +REP



myke
30-05-2008, 10:34 AM
Heyyyy!

I've made a template which has
[full-link]TITLE[/full-link]
and it's in a php include, to the right
so the layouts like this:
The box on the right has a PHP include in, which is including the latest.php file which has the cutenews item in, when they click TITLE
I want it to go into the PHP include in the center, any idea?
I know I could do the ?get function but the thing is, it's more BB code than HTML because it's cutenews -.-''
Any idea? +REP

[______________] [_________]
[______________] [_________]
[______________] [_________]
[______________]
[______________]
[______________]

Jackboy
30-05-2008, 10:42 AM
Wait so you want the news to appear in the middle without the title?

myke
30-05-2008, 10:43 AM
Noooo

Right, i have a box on the right which will show the latest posted articles, yes?

I want it so they can click the title of the article in that box and it appear in the other box.

Jackboy
30-05-2008, 10:44 AM
use frames?

myke
30-05-2008, 11:09 AM
You can't put target="main" into a cutenews link because to link it you use [full-link]TEXT[/full-link]

Jahova
30-05-2008, 11:15 AM
Yeah, I'm having this problem with AJAX.
It's well hard to do.

myke
30-05-2008, 01:11 PM
No need to worry about this any more, I sorted it.

Bonxy
30-05-2008, 05:26 PM
how did you sort it ?

myke
30-05-2008, 07:36 PM
Downloaded a script, but it's ok now because I'm no longer part of the project. (:

Decode
30-05-2008, 08:55 PM
You can't put target="main" into a cutenews link because to link it you use [full-link]TEXT[/full-link]
Just add <base frame="frame name here"> to your template and the full news will go into an iframe.

chrisgocrazyH
31-05-2008, 12:12 PM
Its easy

This is remote headlines

<?PHP
// ************************************************** ******************************
// Remote Show Headlines by Georgi Avramov
// ----------------------------------------
// How to use this module:
// | put this code: <SCRIPT language=javascript src="http://mysite.com/cutenews/remote_headlines"></SCRIPT>
// | on the page where you want to display the headlines
// | you can use and http://mysite.com/cutenews/remote_headlines.php?number=NUMBER_OF_NEWS
// | you can use and http://mysite.com/cutenews/remote_headlines.php?number=NUMBER_OF_NEWS&category=CAT_ID
// | to show exact number of news
// ************************************************** ******************************
//----------------------
// CONFIGURATION
//----------------------
$template = "{title}<br>Posted On: {date}<br>"; //: you can use {date}, {title}, {author} and
$date_format = "d M Y"; //: for help on date format go here: http://www.php.net/manual/en/function.date.php
$local_news_page = "http://simplyhabbo.com/news/show_news.php"; //: URL to page where you include your news eg. http://mysite.com/index.php
$remote_target = "_self"; //: _blank = open in new window; _top = open in same window;
//----------------------
// END CONFIGURATION
//----------------------
if(!$PHP_SELF){
if($HTTP_POST_VARS) {extract($HTTP_POST_VARS, EXTR_PREFIX_SAME, "post_");}
if($HTTP_GET_VARS) {extract($HTTP_GET_VARS, EXTR_PREFIX_SAME, "get_");}
if($HTTP_COOKIE_VARS) {extract($HTTP_COOKIE_VARS, EXTR_PREFIX_SAME, "cookie_");}
if($HTTP_ENV_VARS) {extract($HTTP_ENV_VARS, EXTR_PREFIX_SAME, "env_");}
}
if($PHP_SELF == ""){ $PHP_SELF = $HTTP_SERVER_VARS[PHP_SELF]; }

$all_news = file("./data/news.txt");
$i = 0;

echo"<!-----\n";
echo"//News powered by CuteNews: http://cutephp.com\n";
foreach($all_news as $single_news){
$news_arr = explode("|", $single_news);
if($category != "" and $category != $news_arr[6]){ continue; }
$output = $template;
$output = str_replace("{title}", "$news_arr[2]", $output);
$output = str_replace("", "<a href='http://www.simplyhabbo.com/news/show_news.php?subaction=showfull&id=$news_arr[0]' target='$remote_target'>", $output);
$output = str_replace("", "</a>", $output);
$output = str_replace("{author}", "$news_arr[1]", $output);
$output = str_replace("{date}", date($date_format ,"$news_arr[0]"), $output);
echo"document.write(\"$output\");\n";
$i++;
if($number != "" and $i == $number){ break; }
}
echo"//----->\n";

?>Now see were

$output = str_replace("[link]", "<a href='http://www.simplyhabbo.com/news/show_news.php?subaction=showfull&id=$news_arr[0]' I replaced that to

$output = str_replace("[link]", "<a href='http://www.simplyhabbo.com/MYPHPFILENAME.php?subaction=showfull&id=$news_arr[0]' and in myphpfilename.php i have:


"Template"
<?
include("news/show_news.php");
?>So basicly just make a Habbo template and put that include in where u want the news to show xd


Then we end up with (myphpfilename.php)

<table width="552" height="50" border="0" cellspacing="1" bgcolor="#000000">
<tr>
<td height="14" background="head.gif"><div align="center">
<font color="#FFFFFF" face="Verdana" size="1">News</font></div></td>
</tr>
<tr>
<td bgcolor="#598CC5"><div align="center"><?
include("news/show_news.php");
?></div></td>
</tr>
</table>

Want to hide these adverts? Register an account for free!