Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

CodeIgniter 3x Embed Issue [solved]

donovanbdonovanb
edited May 2017 in Vanilla 2.0 - 2.8

Hello, I'm trying to embed vanilla 2.3

http://dev.sunshineartist.com/forum/
auth:
sadev:dbrooke

Seems like it wants to work.. but doesn't show the forum.

The forum is located here:
http://dev.sunshineartist.com/daforum/

The embed code in the codeigniter view is:
<script type="text/javascript" src="http://dev.sunshineartist.com/daforum/js/embed.js"></script> <noscript>Please enable JavaScript to view the <a href="http://vanillaforums.com/?ref_noscript">discussions powered by Vanilla.</a></noscript> <div class="vanilla-credit"><a class="vanilla-anchor" href="http://vanillaforums.com">Discussions by <span class="vanilla-logo">Vanilla</span></a></div>

Any idears?

Thx.

Comments

  • Developer tools is showing a 404 on a request to
    http://dev.sunshineartist.com/daforum/index.php?p=/&amp;remote=http://dev.sunshineartist.com/forum/&amp;locale=

    Note that index.php is following dev.sunshineartist.com/daforum/
    Which does not look right for a CI based site.

  • Hi, I was just going to post that.. the problem in my view is that the query string produced by the Vanilla javascript embed is not in the form of "Pretty URL"... and unfortunately my codeigniter site requires it. I don't think there is an option in the embed feature to format that call.

    It appears my only solution is to install the forum outside of codeigniter and then embed it into the CI site.
    I did not do that at first because I thought it might help with the single sign on, when I get to that.

  • @dafriend said:
    Note that index.php is following dev.sunshineartist.com/daforum/
    Which does not look right for a CI based site.

    Never mind. I get that it's the index.php for the forum.

  • Yeah, it seams to me its as simple as CI doesn't like the ?= part.

    http://dev.sunshineartist.com/daforum/index.php

    Works fine.

    I guess it would be nice in this case if the code generated by the embed javascript had the option of using Pretty URL's.. just like the core forum does. As for now I have question out to the CI community to see if I can create a workaround.. such as enabling the query string for just that directory, or doing something in routes.php.

  • One option is to manually code the iframe in your view.

    Put the Vanilla files in a folder (I cleverly named it 'vanilla') at the site's root level - the same level as CI's applications folder. The CI controller loads a view that creates the Iframe.

     class Discussion extends CI_Controller
     {
        public function __construct()
        {
            parent::__construct();
         }
    
         public function index()
         {
            $data['vanilla'] =  base_url('vanilla/index.php');
            $this->load->view('vanilla_view', $data);
         }
    }
    

    Obviously not a complete solution because it doesn't address loading the elements that surround the iframe. But you get the idea.

    The vanilla_view.php file contains this markup.

    <iframe src='<?php echo $forum; ?>' style='width: 100%; padding: 0px; margin: 0; 
    border: none; display: block; overflow: hidden;' onload='resizeIframe(this)'></iframe>
    

    The "onload" attribute calls some js that auto sizes the iframe. There are lots of solutions for that in the wild. I didn't test any autosize solution though.

    A quick proof-of-concept test seemed to work just fine.

  • FYI, this turned out to be the vanilla forum .htaccess file.

    I had to comment out the two lines:

    # RewriteCond %{QUERY_STRING} ^p=/?([^&]+)(&([^?]+))?$
    # RewriteRule ^index\.php %1?%3 [E=X_REWRITE:1,L]
    

    Seems to work now.

    http://dev.sunshineartist.com/forum/

  • I'd like to add a [solved] prefix to the subject line, or mark this as answered.. can't seem to figure out how to do that. :-)

  • R_JR_J Admin

    @donovanb said:
    I'd like to add a [solved] prefix to the subject line, or mark this as answered.. can't seem to figure out how to do that. :-)

    You cannot and normally it is not needed, but since you've asked for it... ;)

Sign In or Register to comment.