SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    to colour html tag in php

    Code:
    <html>
    <head>
    <title>Sayfa Başlığı</title>
    </head>
    <body>
    Bu benim ilk sayfam 
    </body>
    </html>
    I want to colour the html tag above. Actually , there is highlight_string function do it but i didnt it. İs there a function colouring all html tag. if there it, i want to use the function.

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    didn't it
    Didn't what? Didn't like it? If so, why?

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No. i liked really it. Can you show me small html tag example that coloured hlightlight_string?
    can i use to colour html codes highlight.html function?
    Last edited by kavram; Feb 9, 2009 at 07:18.

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <?php
    $find = array(" &lt;html&gt; "," &lt;head&gt; ");
    $replace = array("<span style='color:#0000FF;' >&lt;html&gt;</font>", "<span style='color:#0000FF;' >&lt;head&gt;</font>");
    $bas=" &lt;head&gt; ";
    echo str_replace($find,$replace,$bas);
    ?>
    The code above is working but it is not working when i located a form that like:

    Code:
    <?php
    $find = array(" &lt;html&gt; "," &lt;head&gt; ");
    $replace = array("<span style='color:#0000FF;' >&lt;html&gt;</font>", "<span style='color:#0000FF;' >&lt;head&gt;</font>");
    $bas=$_POST['word'];
    echo str_replace($find,$replace,$bas);
    
    ?>
    
    
    <form action='color.php' method='POST' >
    <input type='text' name='word'>
    <input type='submit' value='submit ></form>
    How i can solve the problem?

  5. #5
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  6. #6
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    Didn't what? Didn't like it? If so, why?
    Sorry! I meant that "i couldnt it".


Bookmarks

Posting Permissions

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