Hello all of you .
I'll try to explain what I want as clear as possible and if there will be some type of things that yo are unclear with please let me know . I built a live chat using PHP and MySQL (It's a chat programme where when you enter your name and hit submit you immediately are taken to the page where other members are chatting. So saying live chat I mean a type of programme when you enter a message and hit "send" all other members will see it almost instantly ..Like skype's text chat ...I think you already got the idea ). So as I already told you I build it AND applied Db class for the MySQL CRUD . It was a bit procedural . So now I am going to adjust it to be fully OO and most importantly apply MVC . In the project to be honest I kinda applied applied MVC but it didnt satisfy the person who has given me this task . So I am given to do this task in this way . Whatever happens to the page (I mean a person just enters my website OR sends a message OR has entered a username to enter the chat OR I am retreiving the new messages via setTimeout()(Please I know that there are some bandwith related problems but its ok I am supposed to go with this function and please I dont need you to suggest a better way of solving the problem related to new messages output) ) via GET method I will come to the index.php page (where I have Front_Controller.php instantiated) I will choose which controller to choose: for retreiving new messages , for inserting new message ,for inserting the username and outputing the messagesfrom the database . One of many resaons that still make me feel that I am undone with that project because I still have some doubts about javascript beeing as VIEW in MVC . Please you would do me a favour suggesting me to post the code for the livechat that I have done and taking a look at that bloody JavaScript part . So that was the way I handled it.
So my problem is that I am given to do that this way. So I need from index.php file get 2 values $_GET["controller"] and $_GET["action"] (action=view) . So please could you suggest any method that I can accomplish this just getting two values in the index.php file ? I dont need you write the whole code just need you to put me on the right path .
And please could you explain to me how basically squeeze that bloody JavaScript in your views ?

I appreciate your help . Thank you really much in advance!!!

6 Years
Discussion Span
Last Post by qazplm114477

I'll try to answer what I can. your post was a bit long so... essentially you want to load certain js depending on your views? You seem to understand the idea behind MVC so I'll skip over that.

So I need from index.php file get 2 values $_GET["controller"] and $_GET["action"] (action=view) . So please could you suggest any method that I can accomplish this just getting two values in the index.php file

if your URL is like this http://example.com/?controller=foo&action=view $_GET will have those values.

The view's job is to load javascript files into the markup to be served to the user. I would suggest using a script loader either in PHP or javascript. Wordpress uses a pretty nice script loader here. I personally use mordernizr, it's a really good script loader built in javascript and it also helps test for browser support for html5.

if you could give a list or summary of what you need help in. we could help you a bit more.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.