Jump to content

HTML TITLE


exadus

Recommended Posts

Hello my friends;

 

I need your help.My problem is how to put selectable title of header.php then class.php..

Req.page codes at below.

 

Ex(query/print) function main_category ->$title = 'MAIN CAT';

function get_category  -> $title = $row['cat_name'];

 

HEADER.PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<title>How to </title>
<link rel="stylesheet" href="./demo/dialog.css" media="screen" />
<style type="text/css">
/* basic formatting */
body {background-color: #414141;}
h1 {font-size: 12px; color: #ffffff; font-weight:bold; font-family:arial; display:block; padding: 5px 10px 5px 10px;}
p {font-size: 9px; color: #ffffff; font-weight:bold; font-family:arial; padding: 5px 10px 5px 10px; display:block; line-height:1.6em;}
</style>
</head>

 

 

CATEGORYclass.PHP

<?php

class category {

     var $host;
     var $username;
     var $password;
     var $db;

    
    
function connect() {    
     $con = mysql_connect($this->host, $this->username, $this->password)or die(mysql_error());
     mysql_select_db($this->db, $con)or die(mysql_error());
}     

function main_category(){
   
   $sql = "SELECT * FROM category"  ;
   $res = mysql_query($sql) or die(mysql_error());
   while($row = mysql_fetch_assoc($res)){
       echo '<a href ="./category.php?id=' . $row['cat_id'] . '"><img src="./demo/images/' . $row['cat_image'] . '"></a>';
      
   }

   
   }
      




function get_category($id = ''){
     
    if($id !=""):
    $id = mysql_real_escape_string($id); 
    $sql = "SELECT id, article_name, article_sdesc, article_desc, cat_image, article_cat, cat_id FROM articles join category on articles.article_cat = category.cat_id where cat_id='$id' "; 
   else:
  $sql = "SELECT * FROM articles limit 12";  
   endif;
    $res = mysql_query($sql) or die(mysql_error()); 
  if(mysql_num_rows($res) !=0)  :
      
     while($row = mysql_fetch_assoc($res)){
         echo '<div class="dialog1"><div class="content">
<div class="t"></div>
<div class="floatbox">
<img border="0" src="imaj.jpg" width="55" height="55" />
</div>';
         echo '<h1><a href="article.php?id=' . $row[id] . '">' . $row['article_name'] . '</a></h1>' ;
         echo '<p>' . $row['article_sdesc'] . '</p>' ;
         echo '</div>
<div class="b"><div></div> </div></div></div>';

}
$cat_title = $row['cat_name']; 
else: 
echo 'XXX !';
endif;  

}


    


} 





?>

 

 

 

 

 

 

CATEGORY.PHP

<?php
include 'class/category_class.php';

$obj = new category();

$obj->host = 'localhost';
$obj->username = 'demo';
$obj->password = 'demo';
$obj->db = 'phpfreaks';
$obj->connect();

?>
<?php
include 'includes/header.php';
?>
<table width="833" border="1" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>



<?php

if(isset($_GET['id'])):
$obj->get_category($_GET['id']);
else:
$obj->main_category();


endif;


?></td>
  </tr></table>
  
  
  <?php
include 'includes/footer.php';
?>

 

 

THANKS.Best wishes;

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.