CSS question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NaughtyVisions
    Confirmed User
    • May 2008
    • 4204

    #1

    CSS question

    Ok, so I putting a page in an iframe from a completely different site. The content of this page is utilized on a bunch of different sites, so keeping it in one place so changes can be made once to apply to all domains is essential.

    I'm trying to get the content of the page within the iframe to match the site I'm putting it on as far as text/link colors, etc.

    So, I'm thinking I have to put the iframe in a div id, and in my css file, actually associate the page being pulled, so that way customization I apply in my css will actually affect the contents in the iframe.

    So here is what I'm thinking for the actual page on the domain:

    Code:
    <iframe scrolling="auto" allowtransparency="true" frameborder="0" height="225px" width="720px">
    <div id="whatever">
    </div>
     </iframe>
    My problem is how to actually pull the "pathtomycode.html" page in my css file.

    I know this is not right, but something like:

    Code:
    div#whatever {http://pathtomycode}
    Am I like way fucking off here? What's the easiest way to do this?

    I'm finally trying to get off of just basic html coding and on to stuff that was only outdated 5 years ago instead of 10.
    Online strip gaming with sexy gamer girls
    Best thing I ever signed up for: Quality Razors, Cheap Price
  • barcodes
    Confirmed User
    • Mar 2011
    • 2040

    #2
    just to verify, you have a page on your server that you would like to duplicate on other sites but change the colors, sizes etc via css right? or is it a page from another website?

    Edit: Can you modify the page in the iframe is what am trying to ask. sorry, a bit sleepy
    Last edited by barcodes; 12-30-2011, 09:56 PM.

    Comment

    • barcodes
      Confirmed User
      • Mar 2011
      • 2040

      #3
      Here is a very simple example. I would out the css in my main stylesheet but put it on the main page for simplicity.

      Lets say you have mainpage.php and textpage.php.

      Your mainpage.php could be something like this:
      Code:
      <html>
      <head>
      
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>test page</title>
      <style type="text/css">
      #frameStyle .titles {
      	font-weight:bold:
      	color: #F00;
      }
      #frameStyle .copy{
      	color: #cc0;
      }
      </style>
      </head>
      
      <body>
      
      <?php include 'test.php'?>
      
      </body>
      </html>
      And the textpage.php could be something like this:
      Code:
      <div id="frameStyle">
      <div class="titles">title for your page</div>
      <div class="copy">copy for the page</div>
      </div>
      If you dont want to make classes for everything you can do it by the format tags, #framestyle h1 or #framestyle p for example. The example is done on php but you could do it with coldfusion
      Code:
      <cfinclude template="textpage.cfm">
      asp
      Code:
      <!--#include file="textpage.inc"-->
      etc...

      This is assuming you can add the proper ids and classes to the content page you want to include in your various sites.
      Best of luck
      Last edited by barcodes; 12-30-2011, 10:07 PM.

      Comment

      • raymor
        Confirmed User
        • Oct 2002
        • 3745

        #4
        You're going to run into same origin issues trying to style the content of a page loaded from another domain. It may appear to work in some versions of some browsers, but the trend is toward stricter controls on cross domain access.

        You can use jquery to pull it into your domain:

        <html> <header> <script src="/js/jquery.js" type="text/javascript"> </header> <body> <div id='include-from-outside'></div> <script type='text/ javascript'> $('#include-from-outside').load('http:// example.com/included.html'); </script> </body> </html>

        In a noscript stanza you can put the unstyled iframe or iframe a copy pulled to your server periodically.
        Last edited by raymor; 12-30-2011, 10:11 PM.
        For historical display only. This information is not current:
        support&#64;bettercgi.com ICQ 7208627
        Strongbox - The next generation in site security
        Throttlebox - The next generation in bandwidth control
        Clonebox - Backup and disaster recovery on steroids

        Comment

        • NaughtyVisions
          Confirmed User
          • May 2008
          • 4204

          #5
          In a nutshell, it's a "warning blurb" that the person I'm doing some stuff for has on all of her sites. The warning itself is an html page that is hosted on one of her domains. She has it in a iframe on a bunch of her sites, but they all have the default color scheme from the site that the warning.html page is hosted on. I'm putting it on a site I re-vamped, and want the text/link colors in that file to match the site I re-vamped, not the one it's hosted on.

          I made the iframe transparant, but short of copying the file onto the domain I re-vamped and hosting it there, I was told by someone else to code it into the CSS file, which I'm at a loss for. I'd just put it on the domain I revamped and pull it from there, but should the master file get changed elsewhere, I won't get those changes on the new site.


          Edit: Just saw the replies...reading now...
          Last edited by NaughtyVisions; 12-30-2011, 10:08 PM.
          Online strip gaming with sexy gamer girls
          Best thing I ever signed up for: Quality Razors, Cheap Price

          Comment

          • raymor
            Confirmed User
            • Oct 2002
            • 3745

            #6
            Originally posted by NaughtyVisions
            The warning itself is an html page that is hosted on one of her domains. She has it in a iframe on a bunch of her sites, but they all have the default color scheme from the site that the warning.html page is hosted on. I'm putting it on a site I re-vamped, and want the text/link colors in that file to match the site I re-vamped, not the one it's hosted on.
            In that case what you need are symlinks, so foo.com/httpdocs/iframe.html is the same file as bar.com/httpdocs/iframe.html

            iframe.html can reference style.css and it'll use style.css from the current site.
            For historical display only. This information is not current:
            support&#64;bettercgi.com ICQ 7208627
            Strongbox - The next generation in site security
            Throttlebox - The next generation in bandwidth control
            Clonebox - Backup and disaster recovery on steroids

            Comment

            • barcodes
              Confirmed User
              • Mar 2011
              • 2040

              #7
              Ah, sorry. Without the details I may have misunderstood what you were going for.
              I am sure raymor knows more about the warning page stuf than I would =D

              good luck with it!
              Last edited by barcodes; 12-30-2011, 10:13 PM.

              Comment

              • raymor
                Confirmed User
                • Oct 2002
                • 3745

                #8
                Originally posted by barcodes
                Ah, sorry. Without the details I may have misunderstood what you were going for. I am sure raymor knows more about the warning page stuf than I would =D

                good luck with it!
                I think your PHP method is a good way to go. Assuming of course you're not using safe mode, which you should not so long as safe mode stupidly implies suexec. (That's so dumb that "safe" mode requires "stupidly dangerous mode".)

                Also assuming the pages use other PHP - at least until PHP 6.0 comes out I tend away from needlessly executing all documents as programs.
                For historical display only. This information is not current:
                support&#64;bettercgi.com ICQ 7208627
                Strongbox - The next generation in site security
                Throttlebox - The next generation in bandwidth control
                Clonebox - Backup and disaster recovery on steroids

                Comment

                • The Truth Hurts
                  Zph7YXfjMhg
                  • Nov 2002
                  • 15731

                  #9
                  you can't do what you're asking, the way you're asking.
                  even if you trick it into working with js/jquery it would raise security warnings in certain browsers because if cross frame scripting.

                  just make your own duplicate of the iframe on the same domain or take the content of the iframe and stick it inline.
                  then style it however the hell you want.

                  Comment

                  • Mr Pheer
                    So Fucking Banned
                    • Dec 2002
                    • 22083

                    #10
                    Try doing it as a php include.

                    Comment

                    • misterhhs
                      Confirmed User
                      • Oct 2005
                      • 165

                      #11
                      Read the file in php with fopen, filegetcontents...and print it out on your page. But I don't know if crossdomain is allowed.

                      Comment

                      Working...