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
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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.