1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Replacing class ID with ID contents

Discussion in 'Web Design & Development' started by IanArcher, Nov 7, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. IanArcher

    IanArcher Thread Starter

    Joined:
    Oct 24, 2011
    Messages:
    6
    Hi, i am new to PHP but i have some common knowledge to recognizing commands and such.



    in my page i have code like this



    Code:
    <div  class="page_column page_column_first" id="page_column_1" style="width:  499px;"><div class="page_block_container"  id="page_block_759"><div class="disignBoxFirst">
        <div class="boxFirstHeader"><div class="dbTitle">Up and Coming</div></div>
    
         <div class="boxContent"><div  class="dbContentHtml"><p>This is a placeholder for up and  coming news to be edited at News  Time.</p></div></div>


    So whatever class it is linked to say "boxContent" which is the name of a section on a .css file on the server, i want it take the information under that header and place it on that same line and doing something like
    Code:
    preg_replace
    class="boxContent with style="border: 0px;
    background-color: transparent;
    margin:10px auto 5px;"



    Can somebody write something like that for me please or help me with it? It's basically taking the css rule and converting it to inline Thanks
     
  2. dukevyner

    dukevyner

    Joined:
    Nov 4, 2011
    Messages:
    787
    i'm a little confused ...your trying to change a css rule?
     
  3. IanArcher

    IanArcher Thread Starter

    Joined:
    Oct 24, 2011
    Messages:
    6
    not change it, just get that rule and replace it with the class text and class name for example

    <div class ="sys_top_menu">

    capture it and get it and display it as

    <div style ="what the css rule was on the css file(s)>
     
  4. dukevyner

    dukevyner

    Joined:
    Nov 4, 2011
    Messages:
    787
    like this
    Code:
    preg_replace('/<div class ="sys_top_menu">/', '<div style ="what the css rule was on the css file(s)>', $variable)
    changing "what the css rule was on the css file(s)" to what ever it is you want? and changing $variable to the php variable you have the code in
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1025849

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice