Ver Mensaje Individual
  #9 (permalink)  
Antiguo 05/05/2008, 12:59
Avatar de Capimaster
Capimaster
 
Fecha de Ingreso: agosto-2004
Mensajes: 494
Antigüedad: 19 años, 8 meses
Puntos: 2
Re: Consulta dentro del mismo archivo php sin cambiar de pagina

Ok miren les voy a enseñar el codigo del otro script que usaba antes... para ver si me pueden explicar con esto...
es lo que quiero que haga mi nuevo script pero yo aun no lo se hacer

Código PHP:
<?

$thisurl
="http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"];
$oSystem->setValue("news_tellfriendurl",$thisurl);

/* get values */
  
$news_listno=$oSystem->getValue("news_listno");
  
$display_style=$oSystem->getValue("news_displaylayout");
  
$linkfont=$oSystem->getValue("news_linkfont");
  
$linkcolor=$oSystem->getValue("news_linkcolor");
  
$linksize=$oSystem->getValue("news_linksize");
  
$linkbold=$oSystem->getValue("news_linkbold")=="yes"1:0
  
$linkitalic=$oSystem->getValue("news_linkitalic")=="yes"1:0
  
$linkunderline=$oSystem->getValue("news_linkunderline")=="yes"1:0;
  
$textfont=$oSystem->getValue("news_textfont");
  
$textcolor=$oSystem->getValue("news_textcolor");
  
$textsize=$oSystem->getValue("news_textsize");
  
$textbold=$oSystem->getValue("news_textbold")=="yes"1:0
  
$textitalic=$oSystem->getValue("news_textitalic")=="yes"1:0
  
$textunderline=$oSystem->getValue("news_textunderline")=="yes"1:0;     
  
$displaystyle=$oSystem->getValue("news_displaylayout");



/*****Main Page*****/
if($news_id==""){    

    echo 
"<style type=\"text/css\">" .
    
" .link {font-family: $linkfont; color: $linkcolor; font-size: {$linksize}px ; font-style: " . ($linkitalic?"italic":"normal") . "; font-weight: " . ($linkbold?"bold":"normal") . "; text-decoration:" . ($linkunderline?"underline":"none") . ";}" 
    
" .text {font-family: $textfont; color: $textcolor; font-size: {$textsize}px ; font-style: " . ($textitalic"italic":"normal") . "; font-weight: " . ($textbold"bold":"normal") . "; text-decoration: " . ($textunderline?"underline":"none") . ";}" .
    
" .description {font-family: arial; color: red; font-size: 10px ; font-style: normal; font-weight: bold; text-decoration: none;} " .
    
"</style>";
    
    echo 
"<table border=0 cellspacing=5 width=98% align=center>";
    
    
$currentdate date("Y-m-d");
    
$oNews_Announce->data = array("date_format(datepost,'%d-%m-%Y') as datepost""title""summary""content""newstype""visible""dateexpire""news_id");
    
$oNews_Announce->where "newstype='news' and visible='show' and (dateexpire='0000-00-00' or dateexpire>date_format('$currentdate', '%Y-%m-%d')) and datepost<=date_format('$currentdate', '%Y-%m-%d') ";
    
$oNews_Announce->order "datepost desc, title";
    
$result $oNews_Announce->getList();
    
    if (
mysql_num_rows($result)>0){
    
        if (
$displaystyle == "1"){
            while(
$myrow=mysql_fetch_row($result)){
                echo 
"<tr><td valign=top width=15%>$myrow[0]</td><td valign=top>";
                echo 
"<div class=\"link\"><a href=\"" $_SERVER["PHP_SELF"]. "?news_id=$myrow[7]" "\" ><span class=\"link\" >$myrow[1]</span></a></div>";
                echo 
"<div class=\"text\">" stripslashes($myrow[2]) . "</div></td></tr>";
            }
        }else{
            while(
$myrow=mysql_fetch_row($result)){
                echo 
"<tr><td width=99%>";
                echo 
"<div><span class=\"link\">
<a href=\"" 
$_SERVER["PHP_SELF"]. "?news_id=$myrow[7]" "\" ><span class=\"link\">$myrow[1]</span></a></span>";
                echo 
"<span>&nbsp;&nbsp;- Publicado el <i>$myrow[0]</i></span></div><div class=\"text\">" stripslashes($myrow[2]) . " <span class=\"link\"><a href=\"" $_SERVER["PHP_SELF"]. "?news_id=$myrow[7]" "\" ><span class=\"link\">Leer más...</span></a></span><hr /></div></td></tr>";
            }
        }
        
    }else{
        echo 
"<tr><td align=center><br><br>".$lang['newsannounce']['nonewsarticlefound']."<br><br></td></tr>";
    }

    echo 
"</table><br>";

}
    
/*****News Detail*****/
if($news_id!=""){    

    
/*****Navigation Link Calculation*****/
    
$currentdate date("Y-m-d");
    
$oNews_Announce->data=array("news_id");
    
$oNews_Announce->where "visible='show' and newstype='news' and (dateexpire='0000-00-00' or dateexpire>date_format('$currentdate', '%Y-%m-%d')) and datepost<=date_format('$currentdate', '%Y-%m-%d') ";
    
$oNews_Announce->order "datepost desc, title";    $result=$oNews_Announce->getList();
    
$count=0; while($myrow=mysql_fetch_row($result)){ if($myrow[0]==$news_id){ $curpos=$count; }    $count++; }        
    
$prevpos=$curpos-1$nextpos=$curpos+1;    $curpos=$curpos+1;    $total=mysql_num_rows($result);
    if(
$prevpos>=0){ mysql_data_seek($result,$prevpos);    if($myrow=mysql_fetch_row($result)){ $previd=$myrow[0]; }}
    if(
$nextpos<$total){ mysql_data_seek($result,$nextpos); if($myrow=mysql_fetch_row($result)){ $nextid=$myrow[0]; }}        
    
mysql_free_result($result);
    
    
/*****Begin Previous and Next Navigation Link. Modify To Match Your Display*****/    
    
if($previd!=""){ $prevlink="<a href=\"".$_SERVER["PHP_SELF"]."?news_id=$previd\" style=\"text-decoration:none\"><b>".$lang['newsannounce']['prev']."</b></a>";}        
    if(
$nextid!=""){ $nextlink="<a href=\"".$_SERVER["PHP_SELF"]."?news_id=$nextid\" style=\"text-decoration:none\"><b>".$lang['newsannounce']['next']."</b></a>";}        
    if(
$prevlink!="" && $nextlink!=""){    $navline="&nbsp;&nbsp;";    }

    
$oNews_Announce->data = array("title""content""datepost");
    
$result $oNews_Announce->getDetail($news_id);
    if(
$myrow=mysql_fetch_row($result)){
        
$news_title=$myrow[0];
        
$contentHTML stripslashes($myrow[1]);
        
$posted $myrow[2];
    }
    
mysql_free_result($result);


    echo 
"<style type=\"text/css\">" .
    
" .link {font-family: $linkfont; color: $linkcolor; font-size: {$linksize}px ; font-style: " . ($linkitalic?"italic":"normal") . "; font-weight: " . ($linkbold?"bold":"normal") . "; text-decoration:" . ($linkunderline?"underline":"none") . ";}" 
    
" .text {font-family: $textfont; color: $textcolor; font-size: {$textsize}px ; font-style: " . ($textitalic"italic":"normal") . "; font-weight: " . ($textbold"bold":"normal") . "; text-decoration: " . ($textunderline?"underline":"none") . ";}" .
    
" .description {font-family: arial; color: red; font-size: 10px ; font-style: normal; font-weight: bold; text-decoration: none;} " .
    
"</style>";
    
    echo 
"
    <table border=0 cellspacing=5 width=98% align=center>
    <tr><td width=25%><a href=\""
.$_SERVER["PHP_SELF"]."\" style=\"text-decoration:none\"><b>".$lang['newsannounce']['back2list']."</b></a></td>
        <td align=center><b>"
.$lang['newsannounce']['showing']." $curpos ".$lang['newsannounce']['of']." $total</b></td>
        <td align=right width=25%>$prevlink $navline $nextlink</td>
    </tr></table>
    <hr size=1 color=#000000 width=98%>    

    <table border=0 cellspacing=5 width=98% align=center>
        <tr><td><font size=4><b>$news_title</b></font><br><i>" 
. ($posted$lang['newsannounce']['poston']." $posted":"") . "</i></td></tr>
        <tr><td><br>$contentHTML<br><br></td></tr>
    </table>
    <hr size=1 color=#000000 width=98%>    
    
    <table border=0 cellspacing=5 width=98% align=center>
        <tr><td colspan=2><table border=0 cellpadding=2 cellspacing=0><tr><td><img src=\""
.$path["webroot"]."newsannounce/image/iconprint.gif\" border=0></td><td><a href=\"javascript:printNews($news_id)\" style=\"text-decoration:none\">".$lang['newsannounce']['printerfriendly']."</a></td></tr></table></td>
        <td colspan=2><table border=0 cellpadding=2 cellspacing=0><tr><td><img src=\""
.$path["webroot"]."newsannounce/image/icontell.gif\" border=0></td><td><a href=\"javascript:tellFriend($news_id,'$url')\" style=\"text-decoration:none\">".$lang['newsannounce']['tellfriend']."</a></td></tr></table></td></tr>
    </table><br>

    "
;
}
    
?>

<script language=javascript>
function printNews(id){
    window.open("<? echo $path["webroot"?>newsannounce/home.print.php?news_id="+id,"Popup","width=550,height=450,top=70,left=100,dependent=yes,titlebar=no,scrollbars=yes,resizable=yes");    
}

function tellFriend(id,url){
    window.open("<? echo $path["webroot"?>newsannounce/home.tell.php?news_id="+id,"Popup","width=400,height=300,top=170,left=250,dependent=yes,titlebar=no,scrollbars=yes");    
}
</script>
__________________
http://www.elcapitolio.com.mx - Ocotlán, Jalisco, México

Última edición por Capimaster; 05/05/2008 a las 13:00 Razón: agregar informacion