1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP / iframes

Discussion in 'XenForo Pre-Sales Questions' started by Ingenious, Apr 9, 2011.

  1. Ingenious

    Ingenious Well-Known Member

    One of the critical mods to my vB forum I'd need to find a solution to is my advert banners. Because I sell direct I use my own PHP script to randomly select a banner from x number of banners, with each page load.

    It took me about four weeks and 481 cups of coffee to get my head around the vB plugin system. XenForo seems to be light years ahead and terms like handles and listeners really frighten me :)

    So, I will probably take the short cut and use an iframe, as suggested in this post: http://xenforo.com/community/threads/php-in-sidebar.12591/#post-166152

    Looking at that members site I think they did use iframes in the end and it looks like they work.

    As I will never be using external pages within the iframe, am I right in assuming there is no risk involved?

    If I put the iframe in the sidebar, I'd create a new place for it by ripping off the Staff Online or Members Online, changing the title to "Advertisement" and then putting the iframe in that. My last question is, would that automatically pad out to the height of the iframe, or do I need to do any CSS trickery to make sure the "Advertisement" box matched the iframe?

    As you can gather I have never used iframes before :)
  2. Brogan

    Brogan XenForo Moderator Staff Member

    An iframe is just a means of embedding content, usually another site, on a page.
    As you will be defining the iframe content yourself in the templates, the only risk involved is the content you embed.

    You will need to wrap the iframe in the appropriate code to make it match other sidebar elements.
    This can be copied quite easily from the other templates though.

    It will be something like this:
    <div class="section">
    <div class="secondaryContent">
    Ingenious likes this.
  3. Ingenious

    Ingenious Well-Known Member

    Many thanks (looks worryingly easy, there must be a catch!)
  4. Brogan

    Brogan XenForo Moderator Staff Member


    I used to use iframe BB Code on my old forum for embedding weather forecasts in posts.
    It really is that easy.

    Here's a generic BB Code I did for someone who wanted to embed any page in a post: http://xenforo.com/community/threads/bb-code-manager-bb-code-xml-repository.8470/page-4#post-189633
    Of course you can't download it but it shows that it's possible.

    That one does have a risk associated with it though as it allows anyone to embed any code as it's generic.
    On my old site the BB Code was limited to weather forecasts only so there was no risk.
    Ingenious likes this.

Share This Page