Changing Font in PHP

Discussion in 'PHP' started by ac1324, Jan 4, 2008.

  1. #1
    Hi

    I was wondering if anyone can help. I have integrated a blog into a website using some code from another webste. Everything works but I do not know how to change the font type and colour for the text when it is on the website. The code is:

    <?php



    include "common.php";



    $sql = "select * from blog order by added desc";



    $link = mysql_query($sql,$cn);



    while($data = mysql_fetch_row($link))



    {
    //print_r($data);


    echo "<hr class=\"c\"><h5>";



    $tdate=strtotime($data[0]);
    if($data[0]!='')
    echo date('m-d-y | h:i a',$tdate);



    echo "</h5>


    <h4 class=\"gold\">



    $data[1]



    </h4><br>



    $data[2]



    <p><div id=\"grey\">



    $data[3]



    </div>";



    }







    ?>



    If you need any more code please let me know.

    Many thanks in advance for your help.

    AC
     
    ac1324, Jan 4, 2008 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need some css to declare what fonts to use in different classes.
     
    matthewrobertbell, Jan 4, 2008 IP
  3. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #3

    You are going to want to add additional css classes for color.

    Paste your current CSS

    We could then build ana rray of options.

    Basically dropdown with "Tahoma, Times New Roman etc"

    ANd we drop that into your "class" with $class

    This will allow your users choose form the font styles you want.
     
    LittleJonSupportSite, Jan 4, 2008 IP
  4. ac1324

    ac1324 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks...the current CSS I have set up is below. This has been generated by Dreamweaver. Say I wanted style 22 (from below) for all the posts how would I do this?



    body {
    margin-left: 4px;
    margin-top: 4px;
    }
    .style6 {color: #FFFFFF; font-family: "Century Gothic"; }
    .style13 {font-family: Century Gothic}
    #Layer1 {
    position:absolute;
    width:661px;
    height:39px;
    z-index:1;
    left: 225px;
    top: 563px;
    background-color: #000066;
    }
    #Layer2 {
    position:absolute;
    width:255px;
    height:169px;
    z-index:1;
    left: 300px;
    top: 180px;
    }
    #Layer3 {
    position:absolute;
    width:293px;
    height:15px;
    z-index:1;
    left: 213px;
    top: 743px;
    }
    .style22 {
    font-size: 10px;
    font-family: "Century Gothic";
    color: #003366;
    }
    .style23 {font-family: "Century Gothic"; font-size: 13px; }
    .style14 {font-family: "Century Gothic"; color: #003366; }
    .style24 {
    font-family: "Century Gothic";
    font-style: italic;
    font-size: 14px;
    font-weight: bold;
    color: #003366;
    }
    .style25 {color: #FFFFFF}
    .style29 {font-family: "Century Gothic"; font-size: 12px; }
    .style26 {
    font-family: "Century Gothic";
    font-size: 14px;
    color: #003366;
    font-weight: bold;
    }
    .style27 {font-family: "Century Gothic"; font-size: 12px; color: #003366; }
    .style31 {font-family: "Century Gothic"; font-size: 13px; color: #003366; }
    .style32 {font-family: "Century Gothic"; font-size: 15px; color: #003366; font-weight: bold; }
    .style33 {color: #993333}
    .style34 {color: #003366}
    -->
    </style>
     
    ac1324, Jan 4, 2008 IP
  5. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #5
    This is a very crude example but here:

    
    
    <FORM METHOD="POST">
    <SELECT NAME="font_class">
    <OPTION VALUE="style6">Default
    <OPTION VALUE="style22">Style 22
    </SELECT>
    <INPUT TYPE=SUBMIT VALUE="Go">
    </FORM>
    
    Code (markup):
    Now Where you have

    
    <h4 class=\"gold\">
    
    Code (markup):
    Change this to:

    
    <h4 class=\"$font_class\">
    
    Code (markup):
    I am sure you understand what I am doing there.

    You could toss all styles in a drop down or just links like:

    
    <a href="index.php?font_class=style22">Other Font</a>
    
    Code (markup):
     
    LittleJonSupportSite, Jan 4, 2008 IP