Hi there,
I have edited some php-source (a Stringychat 'shoutbox' on the webpage)
By default, all the text was not marked up at all.
I have tried to markup the text, and succeeded partly.
Can somebody help me applying my last changes?
This is the source:
printf("<font face=\"Verdana, Arial, Helvetica, sans-serif\"
size=\"-2\" color=\"#888888\">%s\n", date("H:i - d/m/y",
$myrow["StringyChat_time"]));
printf("<font face=\"Verdana, Arial, Helvetica, sans-serif\"
size=\"-2\" color=\"#888888\"><div class=\"StringyChatItem\">%s\n",
$myrow["StringyChat_name"]);
printf("%s<font face=\"Verdana, Arial, Helvetica, sans-serif\"
size=\"-1\" color=\"#ff0000\"></div>\n", $msg);
StringyChat_time = 22:18 - 05/01/05 ,
StringyChat_name = My name
msg = This is the message
the output on the screen is like this:
22:18 - 05/01/05
My name This is the message
It is all in gray, and all the same (good) font.
What I would like is that the time is same gray, same font
after that on a new row (like it is now) the name in bold black, behind that
a "-" and then the message in red (same font)
Could some PHP-expert please assist me with this?
Thanks, Jan K. 4 3435
Hello Jan,
I think you need to close the <font>-tag on each line, like:
printf("<font face=\"Verdana, Arial, Helvetica, sans-serif\"
size=\"-2\" color=\"#888888\">%s\n", date("H:i - d/m/y",
$myrow["StringyChat_time"])</font>" );
I do not have php available at this moment, so I have not tested it but I am
pretty sure.
Regards,
Stefan
Jan K. wrote: Hi there,
I have edited some php-source (a Stringychat 'shoutbox' on the webpage) By default, all the text was not marked up at all. I have tried to markup the text, and succeeded partly.
Can somebody help me applying my last changes? This is the source:
printf("<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"-2\" color=\"#888888\">%s\n", date("H:i - d/m/y", $myrow["StringyChat_time"])); printf("<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"-2\" color=\"#888888\"><div class=\"StringyChatItem\">%s\n", $myrow["StringyChat_name"]); printf("%s<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"-1\" color=\"#ff0000\"></div>\n", $msg);
StringyChat_time = 22:18 - 05/01/05 , StringyChat_name = My name msg = This is the message
the output on the screen is like this:
22:18 - 05/01/05 My name This is the message
It is all in gray, and all the same (good) font. What I would like is that the time is same gray, same font after that on a new row (like it is now) the name in bold black, behind that a "-" and then the message in red (same font)
Could some PHP-expert please assist me with this?
Thanks, Jan K.
ugh.. what a mess
you don't need a php expert...
how about:
echo '<font face="Verdana, Arial, Helvetica, sans-serif" size="-2"
color="#888888">'
..date('H:i - d/m/y',$myrow['StringyChat_time'])
..'<div class="StringyChatItem">'.$myrow["StringyChat_name"]
..' - <FONT color="red">'.msg.'</FONT></div>'
..'</FONT>';
toss all that printf mess... use single quotes so you don't have to
escape the double-quotes and php doesn't try to parse what's inside...
I have no idea how "StringChatItem" has been defined in the StyleSheet,
so that could change fonts/ colors, etc..
Your question is not about PHP, but about HTML (and CSS).
First define your otput HTML like:
<html>
<head>
<style type="text/css">
.base {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 80%;
color: #888888;
}
.StringyChatItem {
color: Black;
font-weight: bold;
}
</style>
</head>
<body>
<span class="base">
22:18 - 05/01/05<br />
<span class="StringyChatItem">My name -</span>
<span style="color: Red;">This is the message</span>
</span>
</body>
</html>
Then use PHP in it like:
<?php
$myrow['StringyChat_time'] = mktime( 22, 18, 0, 1, 5, 2005 );
$myrow['StringyChat_name'] = 'My name';
$msg = 'This is the message';
?>
<html>
<head>
<style type="text/css">
.base {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 80%;
color: #888888;
}
.StringyChatItem {
color: Black;
font-weight: bold;
}
</style>
</head>
<body>
<span class="base">
<?php echo date( "H:i - d/m/y", $myrow['StringyChat_time'] ); ?><br />
<span class="StringyChatItem"><?php echo htmlspecialchars( $myrow['StringyChat_name'] ); ?> -</span>
<span style="color: Red;"><?php echo htmlspecialchars( $msg ); ?></span>
</base>
</body>
</html>
Do not use <font> tags if you do not have to (use "class" and "style" attributes).
Remember that if you do not close tags ("font" or "div" etc.) then it'll "bleed"
styles to the rest of the document. So if you change font style, then close the tag
right after the text ending, to which the style applies. If you nest style modifying tags,
then remember that outer tag style may (in most cases will) influence inner tag style.
Hilarion
Hilarion wrote: Your question is not about PHP, but about HTML (and CSS). First define your otput HTML like:
<html> <head> <style type="text/css"> .base { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 80%; color: #888888; } .StringyChatItem { color: Black; font-weight: bold; } </style> </head> <body> <span class="base"> 22:18 - 05/01/05<br /> <span class="StringyChatItem">My name -</span> <span style="color: Red;">This is the message</span> </span> </body> </html> Then use PHP in it like:
<?php $myrow['StringyChat_time'] = mktime( 22, 18, 0, 1, 5, 2005 ); $myrow['StringyChat_name'] = 'My name'; $msg = 'This is the message'; <html> <head> <style type="text/css"> .base { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 80%; color: #888888; } .StringyChatItem { color: Black; font-weight: bold; } </style> </head> <body> <span class="base"> <?php echo date( "H:i - d/m/y", $myrow['StringyChat_time'] ); ?><br /> <span class="StringyChatItem"><?php echo htmlspecialchars( $myrow['StringyChat_name'] ); ?> -</span> <span style="color: Red;"><?php echo htmlspecialchars( $msg ); ?></span> </base> </body> </html> Do not use <font> tags if you do not have to (use "class" and "style" attributes). Remember that if you do not close tags ("font" or "div" etc.) then it'll "bleed" styles to the rest of the document. So if you change font style, then close the tag right after the text ending, to which the style applies. If you nest style modifying tags, then remember that outer tag style may (in most cases will) influence inner tag style. Hilarion
Thanks, I'll take your tips into account.
Someone already helped me (in alt.php) but he/she did not crosspost, so you
did not see that reply.
We (in Holland) do not have a PHP-group, but I am trying to distinguis which
php-group is the best for me.
I have so little experience with PHP, but sometimes need to edit/change some
code for my webpage (PHP/MySQL).
So thanks for your help!
Jan K. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mark |
last post by:
I have a website with an increasing amount of articles and news reports and
so I am thinking of moving away from storing each article as a seperate page
to having a single page and storing articles...
|
by: Isaac Councill |
last post by:
Hello,
This seems like a newbie question, but I couldn't find the answer on
google.
I've been using xsl to transform rdf files into runnable
programs in another (non-markup) language. It's...
|
by: Dimitre Novatchev |
last post by:
You seem to be unaware of the xslt processing which uses the built-in
rules in the absence of templates that match some selected node.
http://www.w3.org/TR/xslt#built-in-rule
According to the...
|
by: Lisa |
last post by:
I need to apply the HTML formatting tags and the French accented
characters in a XML document. The XML is generated from a database
that has HTML tags and French accented characters in the records....
|
by: Hawk |
last post by:
I have a custom menu control that I am creating using C#. I am rendering
HTML from a StringBuilder in my control to add the needed JavaScript to the
HTML output. I need to have the JavaScript...
|
by: Michael Bulatovich |
last post by:
Is there a way to use CSS to format "plain" text in an html document. By
plain I mean text which is not contained by <por <h#tags.
Is there no way to control how this stuff is rendered?
tia
|
by: MatsL |
last post by:
Hi,
This is seriously driving me crazy, could anyone explain to me why
neither of these doesn't produce XHTML compliant output (it is being
called in Render() btw):
output.WriteLine("<img...
|
by: eastcoastguyz |
last post by:
I'm a newbie to CSS, so be kind. :-)
I have looked at examples of CSS and have not seen this yet. How can
you change the colors of the text in the same word in CSS? For example,
when how can you...
|
by: linhardt |
last post by:
I am wondering how to make ASP.NET output XML instead of HTML.
Here is my situation:
I am using IE as a front-end to browse company documents. Let's say,
a user wants a Word document called...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |