Welcome Guest, Not a member yet? Register   Sign In
Simple chat facility - if file exists not working
#1

(This post was last modified: 07-04-2020, 06:58 AM by christaliise.)

We are trying to build a simple chat facility without using a database & have got the basic facility to work between 2 uses.

However, we want to first search to see if there is already a previous chat session in existence, but cant get that to work.

This is what we have tried;

PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

class 
Chat extends CI_Controller
{

public function 
index()
    {

        if(
file_exists("C:xampp/htdocs/application/views/john/chris/chat"))  // Also tried if(is_dir(
        
{
        
redirect('chris/john/chat');  // Also tried $this->load->view('chris/john/chat');
        
}
        else  
// This is always rejected
        


If the file does not exist then the Controller Files & View Files are created. That part works OK but needs further work.

Can anybody guide us as to what we are doing wrong?

UPDATE

Ive got the system working but I need to learn how to get the scroll bar at the bottom.

I want to get the scroll bar at the bottom when the page is opened, instead of the top by default. From my research CSS does not facilitate that. The following is my current coding;

PHP Code:
<style type="text/css"> .mem positionfixedwidth53%; left46%; top30%; font-familyarialfont-size100%; colorBlackbottom3.7%; overflowauto; } </style>
<
div class="mem"

I would like a simple instruction like in the following, but that does not work;

PHP Code:
<style type="text/css"> .mem positionfixedwidth53%; left46%; top30%; font-familyarialfont-size100%; colorBlackbottom3.7%; overflowautoscrollToBottom; } </style

From my research it is only achievable by Javascript.

Ive searched the following & acquired the coding below but they dont work;
https://stackoverflow.com/questions/1861...scrolls-up

PHP Code:
var element document.getElementById("yourDivID");
element.scrollTop element.scrollHeight;
<
script> var element document.getElementById("mem"); element.scrollTop element.scrollHeight; </script

https://stackoverflow.com/questions/7063...-to-bottom
The Javascript code below should keep your div's scrollbar positioned at the bottom like you described:

PHP Code:
var objDiv document.getElementById("divExample");
objDiv.scrollTop objDiv.scrollHeight;
<
script> var objDiv document.getElementById("mem"); objDiv.scrollTop objDiv.scrollHeight; </script
Reply


Messages In This Thread
Simple chat facility - if file exists not working - by christaliise - 06-21-2020, 07:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB