bean420 Posted February 9, 2007 Share Posted February 9, 2007 I have a really simple problem problem with what seems to be a complicated awnser I am trying to change a font on a website that uses PHP with CSS and and javascript. The website is built from a templete and i dont want to change the font on the template . The index.php uses a function that gets the links from a mysql database. I cant find the location of the code that gives the links there font I have searched everywhere including the "styles.css" index.php, and functions.php i have found the function , but i see nothing about fonts or formating the data. any help is GREATLY appreciated Quote Link to comment Share on other sites More sharing options...
only one Posted February 9, 2007 Share Posted February 9, 2007 you do something with <span class=the number>infront of the text Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 9, 2007 Share Posted February 9, 2007 If you show us some of the code or a link to the site we can help better. Quote Link to comment Share on other sites More sharing options...
offsprg01 Posted February 9, 2007 Share Posted February 9, 2007 code would be nice be here's a quick and dirty way to do it put this in html where you would like to change the font <span class="thisclass" <?php echo $stylechange; ?>> use php to do the following <?php if (what ever condition) { $stylechange = 'style="font:arial"'; } if else { $stylechange = "" ; } ?> better way would be somehting like this you could do something similar to the above in the css file by making the .css file a .php file so you can do the following <?php $fontchange = "helvetica"; if (some contition) {$fontchange = "arial";} ?> .thisclass { text-align:left; font: <?php echo $fontchange; ?> } that shoiuld work but if you post you code we could give a much clearer answere. Quote Link to comment Share on other sites More sharing options...
bean420 Posted February 9, 2007 Author Share Posted February 9, 2007 This is the code for the location of the home page that has the links. If the problem code is in another file i will repost it also my css is in a file names style.css and there is also a style.php already so i cant change the name like it was suggested ------------------------------navbar.php <? echo $_nav; if ($_POST['mode'] == "setcss" ){ $pattern = "/^(#)?([0-9|A|B|C|D|E|F]{6})$/"; if (preg_match($pattern,$_POST['val'])) { $query = "UPDATE css SET val = '".$_POST['val']."' WHERE id = ".$_POST['id']; mysql_query($query, $_link); if ( mysql_affected_rows($_link) == 1 ){ echo '<br/><div class="box_err" align="center">Color set</div>'; } else{ echo '<br/><div class="box_err" align="center">Error! - Color not set</div>'; } } else{ echo '<br/><div class="box_err" align="center">Error! - Invalid color hex code</div>'; } } $colors = Array("#330000", "#333300", "#336600", "#339900", "#33CC00", "#33FF00", "#66FF00", "#66CC00", "#669900", "#666600", "#663300", "#660000", "#FF0000", "#FF3300", "#FF6600", "#FF9900", "#FFCC00", "#FFFF00", "#330033", "#333333", "#336633", "#339933", "#33CC33", "#33FF33", "#66FF33", "#66CC33", "#669933", "#666633", "#663333", "#660033", "#FF0033", "#FF3333", "#FF6633", "#FF9933", "#FFCC33", "#FFFF33", "#330066", "#333366", "#336666", "#339966", "#33CC66", "#33FF66", "#66FF66", "#66CC66", "#669966", "#666666", "#663366", "#660066", "#FF0066", "#FF3366", "#FF6666", "#FF9966", "#FFCC66", "#FFFF66", "#330099", "#333399", "#336699", "#339999", "#33CC99", "#33FF99", "#66FF99", "#66CC99", "#669999", "#666699", "#663399", "#660099", "#FF0099", "#FF3399", "#FF6699", "#FF9999", "#FFCC99", "#FFFF99", "#3300CC", "#3333CC", "#3366CC", "#3399CC", "#33CCCC", "#33FFCC", "#66FFCC", "#66CCCC", "#6699CC", "#6666CC", "#6633CC", "#6600CC", "#FF00CC", "#FF33CC", "#FF66CC", "#FF99CC", "#FFCCCC", "#FFFFCC", "#3300FF", "#3333FF", "#3366FF", "#3399FF", "#33CCFF", "#33FFFF", "#66FFFF", "#66CCFF", "#6699FF", "#6666FF", "#6633FF", "#6600FF", "#FF00FF", "#FF33FF", "#FF66FF", "#FF99FF", "#FFCCFF", "#FFFFFF", "#0000FF", "#0033FF", "#0066FF", "#0099FF", "#00CCFF", "#00FFFF", "#99FFFF", "#99CCFF", "#9999FF", "#9966FF", "#9933FF", "#9900FF", "#CC00FF", "#CC33FF", "#CC66FF", "#CC99FF", "#CCCCFF", "#CCFFFF", "#0000CC", "#0033CC", "#0066CC", "#0099CC", "#00CCCC", "#00FFCC", "#99FFCC", "#99CCCC", "#9999CC", "#9966CC", "#9933CC", "#9900CC", "#CC00CC", "#CC33CC", "#CC66CC", "#CC99CC", "#CCCCCC", "#CCFFCC", "#000099", "#003399", "#006699", "#009999", "#00CC99", "#00FF99", "#99FF99", "#99CC99", "#999999", "#996699", "#993399", "#990099", "#CC0099", "#CC3399", "#CC6699", "#CC9999", "#CCCC99", "#CCFF99", "#000066", "#003366", "#006666", "#009966", "#00CC66", "#00FF66", "#99FF66", "#99CC66", "#999966", "#996666", "#993366", "#990066", "#CC0066", "#CC3366", "#CC6666", "#CC9966", "#CCCC66", "#CCFF66", "#000033", "#003333", "#006633", "#009933", "#00CC33", "#00FF33", "#99FF33", "#99CC33", "#999933", "#996633", "#993333", "#990033", "#CC0033", "#CC3333", "#CC6633", "#CC9933", "#CCCC33", "#CCFF33", "#000000", "#003300", "#006600", "#009900", "#00CC00", "#00FF00", "#99FF00", "#99CC00", "#999900", "#996600", "#993300", "#990000", "#CC0000", "#CC3300", "#CC6600", "#CC9900", "#CCCC00", "#CCFF00", "#000000", "#111111", "#222222", "#333333", "#444444", "#555555", "#666666", "#777777", "#888888", "#999999", "#AAAAAA", "#BBBBBB", "#CCCCCC", "#DDDDDD", "#EEEEEE", "#FFFFFF", "#FFFFFF", "#FFFFFF"); $css['link'] = @mysql_result(mysql_query("SELECT val FROM css WHERE class = 'a.navlinks:link' AND ele = 'color' AND skinid = ".$skinid, $_link),0); $cssid['link'] = @mysql_result(mysql_query("SELECT id FROM css WHERE class = 'a.navlinks:link' AND ele = 'color' AND skinid = ".$skinid, $_link),0); $css['visited'] = @mysql_result(mysql_query("SELECT val FROM css WHERE class = 'a.navlinks:visited' AND ele = 'color' AND skinid = ".$skinid, $_link),0); $cssid['visited'] = @mysql_result(mysql_query("SELECT id FROM css WHERE class = 'a.navlinks:visited' AND ele = 'color' AND skinid = ".$skinid, $_link),0); $css['hover'] = @mysql_result(mysql_query("SELECT val FROM css WHERE class = 'a.navlinks:hover' AND ele = 'color' AND skinid = ".$skinid, $_link),0); $cssid['hover'] = @mysql_result(mysql_query("SELECT id FROM css WHERE class = 'a.navlinks:hover' AND ele = 'color' AND skinid = ".$skinid, $_link),0); $css['active'] = @mysql_result(mysql_query("SELECT val FROM css WHERE class = 'a.navlinks:active' AND ele = 'color' AND skinid = ".$skinid, $_link),0); $cssid['active'] = @mysql_result(mysql_query("SELECT id FROM css WHERE class = 'a.navlinks:active' AND ele = 'color' AND skinid = ".$skinid, $_link),0); $css['navbar'] = @mysql_result(mysql_query("SELECT val FROM css WHERE class = '.navbar' AND ele = 'background' AND skinid = ".$skinid, $_link),0); $cssid['navbar'] = @mysql_result(mysql_query("SELECT id FROM css WHERE class = '.navbar' AND ele = 'background' AND skinid = ".$skinid, $_link),0); echo ' <div align="center" style="margin-top:12px;"> <form name="navcolors" style="margin:0px;"> <table width="180" border="0" cellspacing="0" cellpadding="0"> <tr> <td><input type="radio" name="type" onClick="document.getElementById(\'navlinks\').style.color = document.navcolors.color_link.value;" checked></td> <td><div class="box_text" style="width:104;margin-left:4px;">a:link</div></td> <td><input type="text" id="color_link" name="color_link" class="box" style="width:60;" size="6" value="'.$css['link'].'"></td> <td><img src="../images/box_setbutton.gif" border="0" onclick="sendPostRequest(\'navbar&mode=setcss&id='.$cssid['link'].'&val=\' + document.navcolors.color_link.value, \'boxbody\');"></td> </tr> <tr> <td><input type="radio" name="type" onClick="document.getElementById(\'navlinks\').style.color = document.navcolors.color_visited.value;"></td> <td><div class="box_text" style="width:104;margin-left:4px;">a:visited</div></td> <td><input type="text" id="color_visited" name="color_visited" class="box" style="width:60;" size="6" value="'.$css['visited'].'"></td> <td><img src="../images/box_setbutton.gif" border="0" onclick="sendPostRequest(\'navbar&mode=setcss&id='.$cssid['visited'].'&val=\' + document.navcolors.color_visited.value, \'boxbody\');"></td> </tr> <tr> <td><input type="radio" name="type" onClick="document.getElementById(\'navlinks\').style.color = document.navcolors.color_hover.value;"></td> <td><div class="box_text" style="width:104;margin-left:4px;">a:hover</div></td> <td><input type="text" id="color_hover" name="color_hover" class="box" style="width:60;" size="6" value="'.$css['hover'].'"></td> <td><img src="../images/box_setbutton.gif" border="0" onclick="sendPostRequest(\'navbar&mode=setcss&id='.$cssid['hover'].'&val=\' + document.navcolors.color_hover.value, \'boxbody\');"></td> </tr> <tr> <td><input type="radio" name="type" onClick="document.getElementById(\'navlinks\').style.color = document.navcolors.color_active.value;"></td> <td><div class="box_text" style="width:104;margin-left:4px;">a:active</div></td> <td><input type="text" id="color_active" name="color_active" class="box" style="width:60;" size="6" value="'.$css['active'].'"></td> <td><img src="../images/box_setbutton.gif" border="0" onclick="sendPostRequest(\'navbar&mode=setcss&id='.$cssid['active'].'&val=\' + document.navcolors.color_active.value, \'boxbody\');"></td> </tr> <tr> <td><input type="radio" name="type" onClick="document.getElementById(\'navbar\').style.color = document.navcolors.color_navbar.value;"></td> <td><div class="box_text" style="width:104;margin-left:4px;">background</div></td> <td><input type="text" id="color_navbar" name="color_navbar" class="box" style="width:60;" size="6" value="'.$css['navbar'].'"></td> <td><img src="../images/box_setbutton.gif" border="0" onclick="sendPostRequest(\'navbar&mode=setcss&id='.$cssid['navbar'].'&val=\' + document.navcolors.color_navbar.value, \'boxbody\');"></td> </tr> </table> <table width="180" border="0" cellspacing="0" cellpadding="0"><tr> <td> <table width="180" border="1" cellspacing="0" cellpadding="0"></tr>'; foreach ( $colors as $no=>$color){ echo '<td bgcolor="'.$color.'" width="10"><img src="images/clear_pixel.gif" width="10" height="10" onClick="setLinkColor(\''.$color.'\')"></td>'; if ( is_int(($no+1)/18) ){ echo '</tr><tr>'; } } echo ' </tr></table> </form> </div> '; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.