Jump to content
xisto Community
Sign in to follow this  
HmmZ

Html Font Tags In Php editing fonts using html?

Recommended Posts

I have a php script thats is fully written in php (no html at all). Now for my question, how can i edit the fonts?

Ill make it easier to understand, the following is a data script (found the script):

<?$mese[0]="-";$mese[1]="January";$mese[2]="February";$mese[3]="March";$mese[4]="April";$mese[5]="May";$mese[6]="June";$mese[7]="July";$mese[8]="August";$mese[9]="September";$mese[10]="Octobre";$mese[11]="November";$mese[12]="December";$giorno[0]="Sunday";$giorno[1]="Monday";$giorno[2]="Tuesday";$giorno[3]="Wednesday";$giorno[4]="Thursday";$giorno[5]="Friday";$giorno[6]="Saturday";$gisett=(int)date("w");$mesnum=(int)date("m");echo $giorno[$gisett]." ".$mese[$mesnum]." ".date("d");?>

Id like to edit the font that will come out of the echo, right now its a normal font, while I want to keep the same font i use on my sites tables, is it possible?:D

Share this post


Link to post
Share on other sites

I don't really know in what context you are printing the output, but assuming it is in a html page somewhere you could do something like this:

<?echo "<span class="mystyle"".$giorno[$gisett]." ".$mese[$mesnum]." ".date("d")."</span>";?>
And replace "mystyle" with the class you use for your tables, or add a .mystyle class to your css file. Or you could replace class="mystyle" with style="font-family: sans-serif" or whatever font you are using in your tables.

Share this post


Link to post
Share on other sites
echo "<span class="stats">".$giorno[$gisett]." ".$mese[$mesnum]." ".date("d")."</span>";

is not working :D. Must be some stupid typo somewhere :D

Share this post


Link to post
Share on other sites

Oh, yeah, sorry. You of course have to escape the quotes:

echo "<span class=\"mystyle\">".$giorno[$gisett]." ".$mese[$mesnum]." ".date("d")."</span>";

Share this post


Link to post
Share on other sites

lol, it's pretty funy people make scripts like these then isn't it?:D. Anywayz, its installed and showing correctly, not going to edit that part anymore :D

Share this post


Link to post
Share on other sites

It doesn't really matter that there is a built-in function for it, at least you've learned some more PHP and what you have now is working. :angry:But if you are going to use date things some other time I recommend the date() function, it's really nice, and you can also give a timestamp as argument, so if you have a guestbook you can store the text and date in a database and then when you show it on a page you can use the date() function to format the timestamp the way you like.

Share this post


Link to post
Share on other sites
echo "<span class=\"mystyle\">".$giorno[$gisett]." ".$mese[$mesnum]." ".date("d")."</span>";
Why not just use single quotes? They parse faster, are easier and faster to type, and allow you to type double-quotes without escaping them.

echo '<span class="mystyle">'.$giorno[$gisett].' '.$mese[$mesnum].' '.date('d').'</span>';

Share this post


Link to post
Share on other sites

well in single quotes, you also have to escape '. it's just the same as in double quotes you have to escape ". but the advantage of a double quote is that it can escape many special characters such as new lines and line feeds. and about the the single quotes being parsed faster, i really have no idea about it since they are just considered as a single character.

Share this post


Link to post
Share on other sites

Single quotes are parsed faster than double quotes because the PHP parser doesn't expect anything to be escaped or any special characters to be added in by single quotes. It just expects a plain string. Also, double quotes are used more often than single in HTML (unless you're one of those freaks that surrounds tag attributes with single quotes :)), and even in normal speech. So it would make more sense to use single quotes than to escape 10 double quotes in your string, and also sacrifice speed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.