Jump to content

Including AJAX/PHP Chat App Files


Thaikhan

Recommended Posts

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

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.