Thaikhan Posted August 19, 2013 Share Posted August 19, 2013 Hey guys, I've built an AJAX/PHP user chat box within public_html/chat/... and what I would like to do is reference public_html/chat/index.php within the home page of my website and have it function as it does when you navigate to the index file itself. I've tried: include '../chat/index.php'; It will display the contents of the index file but it doesn't reference it's style sheet or function. What is the best way of going about doing something like this? Thank you in advance!! Link to comment https://forums.phpfreaks.com/topic/281361-including-ajaxphp-chat-app-files/ Share on other sites More sharing options...
AbraCadaver Posted August 19, 2013 Share Posted August 19, 2013 Post the stylesheet link and function (I assume JS) link. Most likely its a path problem. If you have something like this: <link rel='stylesheet' type='text/css' href='style.css' /> You probably need to change to this: 'chat/style.css' since the links are relative to the homepage from where you are doing the include. If it needs to be dynamic, then you can do something like this in the script for the chat app: $path = basename(dirname(__FILE__)); And then use the $path var in your links. Link to comment https://forums.phpfreaks.com/topic/281361-including-ajaxphp-chat-app-files/#findComment-1445820 Share on other sites More sharing options...
Thaikhan Posted August 19, 2013 Author Share Posted August 19, 2013 Awesome. Thank you Abra. Link to comment https://forums.phpfreaks.com/topic/281361-including-ajaxphp-chat-app-files/#findComment-1445830 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.