• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to put a file in controller or view but have it render as a fully pathed URL?

#1
[eluser]electromute[/eluser]
I am working on a Facebook connect integration with CodeIgniter. I have everything working, but just not exactly the way I want it.

Here's the problem:

I want my callback URL in my Facebook Connect app to be http://mydomain.com/callbackdir/

The facebook connect relies on a file called xc_receiver.htm to deal with cross-domain authentication issues. Because of the way things are configured, Facebook wants to see this file at:

http://mydomain.com/callbackdir/xd_receiver.htm

I have my controllers set up with home.php as the default and divided into subdirectories for cleanliness like so:

--controllers
--home.php
-----callbackdir
-----home.php
-----anotherdir
-----home.php


Is there any way for me to put my xd_receiver.htm file somewhere and have it look like it's under the directory of my controller, callbackdir?

I have everything working fine if I leave FB connect stuff at root. I can leave it there if this is not possible, I just would rather organize things as noted above. Thanks!

#2
[eluser]onejaguar[/eluser]
I know squat about Facebook apps but it sounds like you can do a rewrite in your .htaccess file; e.g.:

Code:
RewriteEngine on
RewriteRule ^callbackdir/xd_receiver.htm$ /home.php/callbackdir/xd_reveiver [L]

#3
[eluser]electromute[/eluser]
Ah, of course! That is a very simple solution. So, here's what it looks like:

In my .htaccess file, I have:

Code:
RewriteEngine on
RewriteRule ^fbconnect/xd_receiver.htm$ /fbconnect/home/xd_receiver [L]

In my fbconnect/home.php controller, I have:
Code:
function xd_receiver(){
        $this->load->view('fbconnect/xd_receiver.htm');
    }

So far, so good. Thanks for your help!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.