Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: styling atext

  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts

    styling atext

    ok im messing around with the css of some text within php...

    Code:
    "<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>

  • #2
    New Coder
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Code:
    "<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

  • #3
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    as im using it within php do i need to add / or \ in it?

    PHP Code:
            $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>" ); 

  • #4
    New Coder
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    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

  • #5
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    hehe its ok maybe someone on here will know :P

  • #6
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    In PHP, you must escape all " with \ inside of a string. An unescaped " will tell PHP to stop the string, and throw an error.

    PHP Code:
            $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.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #7
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    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

  • #8
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #9
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    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.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •