View Single Post
Old 05-05-2008, 05:07   #1 (permalink)
hollywooood
I know nothing!
 
hollywooood's Avatar
 
Join Date: Jan 2008
Location: Bali, Indonesia
Posts: 92
if and if else....

This may seem just like a replay from my last switch statement post but I have tried to apply the same principals to my coding. A bit of a back story--I run a small web design company in Bali Indonesia and until I am capable of programming these things myself I hired a programmer. Though the Indonesians are quite smart they seem to take some unnecessary steps to getting the job done. Here is some coding I am trying to figure out at the moment as to how to make it work in PHP5. It all works fine in 4 but not 5. I have a feeling that I need to use the $_GET in here somewhere but where?

Thanks for any help on this!

PHP Code:
<?php
div
('isinya');
if(
$page=="")
$page="Home";
//====================== home and who are we ???
if($page=="Home" || $page=="Who are we")
    {
    
$dpt=mysql_query("select * from fnf_content
    where fnftitle='$page' and fnftype ='page'
    order by fnftitle"
);
    while(
$baris=mysql_fetch_array($dpt))
        {
        
$isi=$baris[fnfcontent];
        
$pic=substr($isi,0,strpos($isi,"|"));
        
$text=substr($isi,strpos($isi,"|")+1);
        if(
$page=="Home")
            {
            
div('home');
            
ee("<img src=\"img/upload/".$pic."\" border=\"0px\" alt=\"".$baris[fnftitle]."\">");
            
div();
            }
        elseif(
$page=="Who are we")
            {
        
div('page_pic');
        
ee("<img src=\"img/upload/".$pic."\" border=\"0px\" alt=\"".$baris[fnftitle]."\">");
        
div();
        
div('page_text');
        
ee($text);
            }
        
div();
        }
    }
//====================== product
elseif($page=="Product")
    {
    
div('product');
        
div('select_type');
        
$shirt=="Man" ?    to('','Man'):to("?page=$page&shirt=Man",'Man');
        
ee('&nbsp;|&nbsp;');
        
$shirt=="Ladies" ?    to('','Ladies'):to("?page=$page&shirt=Ladies",'Ladies');
        
ee('&nbsp;|&nbsp;');
        
$shirt=="Toddler" ?    to('','Toddler'):to("?page=$page&shirt=Toddler",'Toddler');
        
ee('&nbsp;|&nbsp;');
        
$shirt=="Hat" ?    to('','Hat'):to("?page=$page&shirt=Hat",'Hat');
        
div();
        
$dpt=mysql_query("select * from fnf_content
        where fnftype='product' and fnfcategory='$shirt' and fnfstatus='Publish'
        order by fnftitle"
);
        while(
$baris=mysql_fetch_array($dpt))
            {
            
$isi=$baris[fnfcontent];
            
$pic[]=substr($isi,0,strpos($isi,"|"));
            
$text[]=substr($isi,strpos($isi,"|")+1);
            }
        
$jml=sizeof($pic);
        
$pro=="" $pro=$pro=$pro;
        
//== count for page
        
if($jml>2)
            {
            
$next=$pro+2;
            
$back=$pro-2;
            if(
$next<$jml)
                
$maju="<a href=\"?page=$page&shirt=$shirt&pro=$next\">Next</a>";
            else
                
$maju="Next";
            if(
$back>=0)
                
$mundur="<a href=\"?page=$page&shirt=$shirt&pro=$back\">Back</a>";
            else
                
$mundur="Back";
            }        
        if (
$jml=="0")
            {
            
div('gbrsatu');
            
ee('<br /><br /><br />We currently have no product for this category<br /><br />Visit us soon...');
            
div();
            }
        else
            {
            
//== echo pos 1 for content
            
div('gbrsatu');
            if(
$pic[$pro]=="")
                
$gbr="";
            else
                
ee("<img src=\"img/upload/$pic[$pro]\" border=\"0px\" alt=\"$text[$pro]\">");
            
div();
            
div('textsatu');
            
ee($text[$pro]);
            
div();
            
//== echo pos 2 for content
            
$y=$pro+1;
            
div('gbrdua');
            if(
$pic[$y]=="")
                
$gbr="";
            else
            
ee("<img src=\"img/upload/$pic[$y]\" border=\"0px\" alt=\"$text[$y]\">");
            
div();
            if(
$shirt=="Hat")
                {
                
div('textsatu');
                
div();
                }
            
div('textdua');
            
ee($text[$y]);
            
div();
            }
    
//== echo page
    
if ($jml>2)
        {
        
div('next_back');
        
ee("&laquo; ".$mundur." | ".$maju." &raquo;");
        
div();
        }
    
div();
    }
//====================== display form
elseif($page=="Contact us")
    include 
"adon/contact.php";
//====================== newsletter
elseif($page=="Newsletter")
    {
    
$dpt=mysql_query("select * from fnf_content
    where fnftype='newsletter' and fnfstatus='Publish'
    order by fnfdate asc"
);
    while(
$baris=mysql_fetch_array($dpt))
        {
        
$idn[]=$baris[ID];
        
$jdl[]=$baris[fnftitle];
        
$tgl[]=$baris[fnfdate];
        
$isi=$baris[fnfcontent];
        
$pic[]=substr($isi,0,strpos($isi,"|"));
        
$text[]=substr($isi,strpos($isi,"|")+1);
        }
    
$jml=sizeof($pic);
    
div('news_letter');//== start div newsletter
    
if($idn[0]=="")
    
ee('we currently have no news...<br /> comming soon...');
        
ee("<a name=\"top_news\"></a>");//== bookmark newsletter
        
div('menuisinews');//== start div menu news
            
ee('<hr />');
        for (
$i=$i<$jml $i++)
            {
            
to("?page=Newsletter#$idn[$i]","$jdl[$i]");
            
ee('<br />'.$tgl[$i]);
            
ee('<hr />');
            }
        
div();
        for (
$i=$i<$jml $i++)
            {
            if(
$pic[$i]=="")
                
$gbr="";
            else
                
$gbr="<img src=\"img/upload/$pic[$i]\" border=\"0px\" alt=\"$jdl[$i]\">";
            
div('title_news');//==title
                
ee("<a name=\"$idn[$i]\"></a>".$jdl[$i]);
            
div();
            
div('date_news');//==date
                
ee($tgl[$i]);
            
div();
            
div('gbr');//==image
                
ee($gbr);
            
div();
            
div('content_news');//==text
                
ee($text[$i]);
            
div();
            
div('backtotopp');
                
to("?page=Newsletter#top_news","Back to top");
                
ee('<hr />');
            
div();
            }
    
div();
    }
div();
?>

Last edited by hollywooood : 06-05-2008 at 02:17.
  Reply With Quote