ztealmax Posted December 25, 2006 Share Posted December 25, 2006 hi having some trouble with this targeted includes...This is part of the code what it does is that this line [code]<?php print($value["name"]);?>[/code] gets the names needed a flat text file now i want to open that in the targeted table below..How do i do that the correct way? :)[code]get the file to open![/code][code] <?phpif(isset($_GET['target'])){include($_GET['target'].".php?text=news/".print($value['name']));} else {echo " ";}?>[/code]//CHeers*Im as noob as it gets* Link to comment https://forums.phpfreaks.com/topic/31807-having-problem-with-table-targeting-thingy/ Share on other sites More sharing options...
ztealmax Posted December 25, 2006 Author Share Posted December 25, 2006 If you cant understand my question , please tell me and i try explaining in some other way ;)//Cheers Link to comment https://forums.phpfreaks.com/topic/31807-having-problem-with-table-targeting-thingy/#findComment-147510 Share on other sites More sharing options...
ztealmax Posted December 25, 2006 Author Share Posted December 25, 2006 Anyone? :) Link to comment https://forums.phpfreaks.com/topic/31807-having-problem-with-table-targeting-thingy/#findComment-147638 Share on other sites More sharing options...
ztealmax Posted December 25, 2006 Author Share Posted December 25, 2006 To try and explain better:at my index i have this:[b]index.php[/b][code]<?phpif(isset($_GET['target'])){include($_GET['target'].".php");} else {echo " ";}?>[/code]and here is the file that lists all news:[b]news.php[/b][code]<?php $this = $PHP_SELF; $dir = $DOCUMENT_ROOT."news/"; $files = opendir($dir); $file_list = array(); $file_sort = array(); if(empty($sort))$sort="date"; if(empty($r)) $r=1; $cnt = 1; while ($file = readdir($files)) { $full_path = $dir."/".$file; if(!is_dir($full_path)) { $ext = explode(".",$file); $i=count($ext); if($i>1)$file_details["ext"] = strtolower($ext[$i-1]); $file_details["name"] = $ext[0]; $file_details["date"] = filectime($full_path); $file_list[$cnt] = $file_details; $key = strtolower($file_details[$sort]); $file_sort[$cnt] = $key; $cnt++; } } if($r)arsort($file_sort); else asort($file_sort); ?><table width="465" border="0" cellpadding="3" cellspacing="0" class="smallblacktext"> <tr> <td width="174"><?php print($this);?><?php print(!$r);?><? echo lan_11 ?></td> <td width="141"><?php print($this);?><?php print(!$r);?><? echo lan_12 ?></td> </tr> <tr bgcolor="#0033CC"> <td height="3" colspan="5"> </td> </tr><?php while(list($key, $value)=each($file_sort)){ $value = $file_list[$key];?> <tr> <td width="174"><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=read"><?php print($value["name"]);?></a></td> <td width="141"><?php print(date("Y/m/d H:i",$value["date"]));?></td> </tr><?php}?></table>[/code]Now what i want to happend is i want this line to open selected document in the targeted area:[code]><a href="<?=$_SERVER['PHP_SELF']?>?target=read"><?php print($value["name"]);?></a>[/code]as i do with my menu code:[b]menu.php[/b][code]<table><tr><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=welcome"><? echo lan_2 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=news"><? echo lan_3 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=links"><? echo lan_4 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=forum"><? echo lan_5 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=downloads"><? echo lan_6 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=members"><? echo lan_7 ?></a></td></tr></table>[/code]Is this possible? if so how i tried some variants but cant get it to work!Any help is much helpfull :)Thank you//Martin Link to comment https://forums.phpfreaks.com/topic/31807-having-problem-with-table-targeting-thingy/#findComment-147662 Share on other sites More sharing options...
ztealmax Posted December 25, 2006 Author Share Posted December 25, 2006 I tried thisin index.php[code]<?php if(isset($_GET['target'])){include($_GET['target'].".php?text=news/".print($value["name"]));} else {echo " ";}?>[/code]and this on news.php[code]<?php $this = $PHP_SELF; $dir = $DOCUMENT_ROOT."news/"; $files = opendir($dir); $file_list = array(); $file_sort = array(); if(empty($sort))$sort="date"; if(empty($r)) $r=1; $cnt = 1; while ($file = readdir($files)) { $full_path = $dir."/".$file; if(!is_dir($full_path)) { $ext = explode(".",$file); $i=count($ext); if($i>1)$file_details["ext"] = strtolower($ext[$i-1]); $file_details["name"] = $ext[0]; $file_details["date"] = filectime($full_path); $file_list[$cnt] = $file_details; $key = strtolower($file_details[$sort]); $file_sort[$cnt] = $key; $cnt++; } } if($r)arsort($file_sort); else asort($file_sort); ?><table width="465" border="0" cellpadding="3" cellspacing="0" class="smallblacktext"> <tr> <td width="174"><?php print($this);?><?php print(!$r);?><? echo lan_11 ?></td> <td width="141"><?php print($this);?><?php print(!$r);?><? echo lan_12 ?></td> </tr> <tr bgcolor="#0033CC"> <td height="3" colspan="5"> </td> </tr><?php while(list($key, $value)=each($file_sort)){ $value = $file_list[$key];?> <tr> <td width="174"><img src='<? echo BULLET ?>' /> <a href="<?=$_SERVER['PHP_SELF']?>?target=read"><?php print($value["name"]);?></a></td> <td width="141"><?php print(date("Y/m/d H:i",$value["date"]));?></td> </tr><?php}?></table>[/code]Cant see what im doing wrong with this code... :(guess its this row im having problems on:[code]<a href="<?=$_SERVER['PHP_SELF']?>?target=read"><?php print($value["name"]);?></a></td>[/code] Link to comment https://forums.phpfreaks.com/topic/31807-having-problem-with-table-targeting-thingy/#findComment-147689 Share on other sites More sharing options...
ztealmax Posted December 26, 2006 Author Share Posted December 26, 2006 Im sorry but doesnt anything here make any sence? ;) Link to comment https://forums.phpfreaks.com/topic/31807-having-problem-with-table-targeting-thingy/#findComment-147865 Share on other sites More sharing options...
trq Posted December 26, 2006 Share Posted December 26, 2006 You havent exactly asked a question. Link to comment https://forums.phpfreaks.com/topic/31807-having-problem-with-table-targeting-thingy/#findComment-147866 Share on other sites More sharing options...
ztealmax Posted December 26, 2006 Author Share Posted December 26, 2006 well i have , check all the posting ;)anyways this:[code]<a href="<?=$_SERVER['PHP_SELF']?>?target=read"><?php print($value["name"]);?></a>[/code]i would want to use with:[code]<?php if(isset($_GET['target'])){include($_GET['target'].".php?text=news/".print($value["name"]));} else {echo " ";}?>[/code]as i use this menu system:[code]<table><tr><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=welcome"><? echo lan_2 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=news"><? echo lan_3 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=links"><? echo lan_4 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=forum"><? echo lan_5 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=downloads"><? echo lan_6 ?></a></td><td><img src='<? echo BULLET ?>' /><a href="<?=$_SERVER['PHP_SELF']?>?target=members"><? echo lan_7 ?></a></td></tr></table>[/code]but i cant get it to work Link to comment https://forums.phpfreaks.com/topic/31807-having-problem-with-table-targeting-thingy/#findComment-147867 Share on other sites More sharing options...
ztealmax Posted December 26, 2006 Author Share Posted December 26, 2006 somebody must know something? :o Link to comment https://forums.phpfreaks.com/topic/31807-having-problem-with-table-targeting-thingy/#findComment-148084 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.