Forum Moderators: coopster
I need your help for below php code.
This code is connecting to internet online news.
It is going to a new page when you click to any news after then it is opening as blank when you click to any news.
Now I am wishing to change and it must be open as blank in first page.
Could you help me please which command / commands I can add in this php code.
I am giving al details and thanks advance your kind help.
Best regards
armator
++++++
<html>
<title>:: Internet Haber Son Dakika ::</title>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-9">
<meta http-equiv="refresh" content="100">
<script language="Javascript">
<!--
function openWin( windowURL, windowName, windowFeatures ) {
window.open( windowURL, windowName, windowFeatures ) ;
}
//-->
</script>
<body>
<table width=100%>
<?
if (!$kategori_haber) $kategori_haber = array("haber");
$satir = file("http://www.example.com/mays/hotnews_focus.php?") or die("Serverla ileti?im sa?lanamady!");
print "${'$yazi'}";
for ($x = 0; $x < sizeof($kategori_haber); $x++) {
for ($i = 0; $i < sizeof($satir); $i++) {
if (trim($satir[$i]) == "+$kategori_haber[$x]") {
$bas = $i;
break;
}
}
for ($i = $bas; $i < sizeof($satir); $i++) {
if (substr($satir[$i], 0, 1) == "+" ¦¦ $i == sizeof($satir) -1) {
$son = $i;
break;
}
}
for ($i = $bas; $i < $son; $i++) {
$yazi = trim($satir [$i] );
$yazi = ereg_replace ("http://www.example.com/mays/article_view.php?","http://www.example.com/mays/article_view.php?",$yazi);
$yazi = ereg_replace ("target=_blank","http://www.example.com/mays/hotnews_focus.php?/",$yazi);
if ($yazi!= " " &&!eregi("$kategori_haber[$x] Ön Sayfa", $yazi)) {
$yazi = str_replace("http://www.example.com/mays/hotnews_focus.php?article_view.php?/"," http://www.example.com/mays/hotnews_focus.php?article_view.php?/", $yazi);
$haber_e = explode(" ¦",$yazi);
$haber_e = explode("table", $yazi);
print " <a target=blank href='http://www.example.com/mays/hotnews_focus.php?'/$haber_e[0]<br> </a>";
}
}
}
?>
</table>
</body>
</html>
++++++
[edited by: coopster at 3:14 pm (utc) on May 30, 2005]
[edit reason] no urls per TOS [webmasterworld.com] [/edit]
it must be open as blank in first page.?
Do you want the news to open in the same window in which you are now? Then just get rid of target=blank from your <a href.
If you mean something else, then please explain.
BTW you don't use your javascript anywhere, so what is it there for? Moreover this javascript function is not needed, as you can do:
<a href="#" onclick="window.open('http://www.domain.com/mays/hotnews_focus.php?haber=<? echo $haber_e[0];?>', 'Window Name')">Click here to see the news</a>
Best regards
Michal Cibor
PS. You are not supposed to put here company urls.
Thanks your kind help.
It means , you have to open wihth first click.
but this address is opening twice , after then it is opening as blank with second click.
Thanks advance your kind help.
Best Regards
armator
[edited by: coopster at 3:15 pm (utc) on May 30, 2005]
[edit reason] no urls per TOS [webmasterworld.com] [/edit]
It seems to me, that because you have such mess, the browser may not know what to do. Tell me just, why do you change the code you read from the other url? Is it really necessary?
What I would do is read the url and post is as such, with no change at all (without any eregi or str_replace). Moreover you have many mistakes in your php. Eg you print the $yazi out which is never defined. The same is with $kategori_haber. What really does the whole code do?.
What you can do is this:
<?php
$file = fopen("http://www.example.com/mays/hotnews_focus.php?", "r") or die("Serverla ileti?im sa?lanamady!");
while(!feof($file)){
$line = trim(fgets($file));
$line = str_replace("<a", "<a target=\"_blank\"", $line);
$text .= $line;
}
fclose($file);
echo $text;
?>
[edited by: coopster at 3:15 pm (utc) on May 30, 2005]
[edit reason] examplified url [/edit]
Thanks your kind helps.
You are the best.
You are asking me why I am thinking to open as blank that I have alot of news php in my main web address those are opening as blank.
Now your code is very good and it is opening directly
as blank.
Thanks again your kind helps.
Best Regards
armator
Metin Mentes