...

View Full Version : styling atext



runnerjp
11-07-2008, 02:40 PM
ok im messing around with the css of some text within php...


"<p style=\"background: #e4ebeb; border: 1px solid #555555; padding: 6px;\"><span style=\"font: bold 10px Courier New;\"><div class=\"quote_header\">Quote by * :</div>
<div class=\"quote_body\">*</div></span><br/>" );


a few questions...

how would i make.. Quote by * : appear blue and have the * bold? i have tried adding <strong> and <b> at either side of the * and the php code just echos out <strong> or <b>

kryssy23
11-07-2008, 03:10 PM
"<p style=\"background: #e4ebeb; border: 1px solid #555555; padding: 6px;"><div class=\"quote_header\"><span style="color:#0000FF; font:'Courier New', Courier, mono; font-size:10px"> "Quote by</span><strong> *</strong> :</div>


try that out... all I did was moved the span style for the font just in front of the text... im not quite sure about the * for some reason if I used <b> or <strong> it comes out normal sized... I get rid of it and it goes bigger... so im not 100% sure but the colour should work fine

runnerjp
11-07-2008, 03:14 PM
as im using it within php do i need to add / or \ in it?


$this->vbbcodes =
array( "/\[size=(.+)\]/Ui" => "<font size=\"*\">", "/\[face=(.+)\]/U" => "<font face=\"*\">", "/\[color=(.+)\]/Ui" => "<font color=\"*\">", "/\[img\](.+)\[\/img\]/Ui" => "<img src=\"*\" />",
"/\[email\](.+)\[\/email\]/Ui" => "<a href=\"mailto:*\">*</a>", "/\[url\](.+)\[\/url\]/Ui" => "<a href=http://\*\>*</a>", "/\[email=(.+)\](.+)\[\/email\]/Ui" => "<a href=\"mailto:*\">~</a>",
"/\[url=(.+)\](.+)\[\/url\]/Ui" => "<a href=\"*\">~</a>", "/\[quote](.+)\[\/quote\]/is" => "<div class=\"quote_header\">Quote:</div><div class=\"quote_body\">*</div>", "/\[quote=(.*)\](.*)\[\/quote\]/is" => ""<p style=\"background: #e4ebeb; border: 1px solid #555555; padding: 6px;"><div class=\"quote_header\"><span style="color:#0000FF; font:'Courier New', Courier, mono; font-size:10px"> "Quote by</span><strong> *</strong> :</div>" );

kryssy23
11-07-2008, 03:18 PM
thats a good question... I honestly dont know... have you been using / and it hasnt been working? maybe try \ instead... I have never used span class inside php before

runnerjp
11-07-2008, 03:19 PM
hehe its ok maybe someone on here will know :P

gnomeontherun
11-07-2008, 03:23 PM
In PHP, you must escape all " with \ inside of a string. An unescaped " will tell PHP to stop the string, and throw an error.


$this->vbbcodes =
array( "/\[size=(.+)\]/Ui" => "<font size=\"*\">", "/\[face=(.+)\]/U" => "<font face=\"*\">", "/\[color=(.+)\]/Ui" => "<font color=\"*\">", "/\[img\](.+)\[\/img\]/Ui" => "<img src=\"*\" />",
"/\[email\](.+)\[\/email\]/Ui" => "<a href=\"mailto:*\">*</a>", "/\[url\](.+)\[\/url\]/Ui" => "<a href=http://\*\>*</a>", "/\[email=(.+)\](.+)\[\/email\]/Ui" => "<a href=\"mailto:*\">~</a>",
"/\[url=(.+)\](.+)\[\/url\]/Ui" => "<a href=\"*\">~</a>", "/\[quote](.+)\[\/quote\]/is" => "<div class=\"quote_header\">Quote:</div><div class=\"quote_body\">*</div>", "/\[quote=(.*)\](.*)\[\/quote\]/is" => "<p style=\"background: #e4ebeb; border: 1px solid #555555; padding: 6px;\"><div class=\"quote_header\"><span style=\"color:#0000FF; font:\'Courier New\', Courier, mono; font-size:10px\"> \"Quote by</span><strong> *</strong> :</div>" );

I think I got it right, its hard to tell for sure. Also I escaped the single quotes, just to be safe.

runnerjp
11-07-2008, 03:44 PM
humm ok for some reaosn the text does not aprear in the box and also the name is not in blue and the : is also bold even thought the </strong> tag was inplace before hand :S

gnomeontherun
11-07-2008, 03:49 PM
Well I don't really understand how this code is fitting inside of a larger page, but there appear to be missing tags (a closing </p> for example). I would get the HTML to work (outside of PHP) the way you want it, and then drop it into the PHP file.

itsallkizza
11-07-2008, 03:56 PM
Sorry if I'm missing something, but why not just use single quotes for your php strings and nested double quotes for your html output? This at least avoids having to escape your nested double quotes.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum