Jump to content

mysteriousmonkey29

Members
  • Content count

    49
  • Joined

  • Last visited

Community Reputation

0 Neutral

About mysteriousmonkey29

  • Rank
    Newbie
  1. mysteriousmonkey29

    Interactive web comic aggregator general design?

    Sounds good, thanks again!
  2. mysteriousmonkey29

    Interactive web comic aggregator general design?

    Ok, that makes sense. So basically, ingolme is suggesting that I write it purely in php at first (using form submission or something similar), then once I get that to work, modify the controller to use javascript/jquery/ajax?
  3. mysteriousmonkey29

    Interactive web comic aggregator general design?

    Hey, sorry for the extremely late reply. I have some free time again, so am resuming work on this project. I was rereading this post, and noticed that I never replied to your last comment. What do you mean, exactly? I guess by "an approach that works without Javascript", you mean that I should write the controller in php, and then call it from the view using get and post, or something along those lines. But I am confused by what you mean when you say to add a layer of javascript on top. If it works without javascript, how would I integrate javascript into it "for convenience"?
  4. mysteriousmonkey29

    Good IDE for web development with built-in compilers/debuggers?

    Thanks, although it appears that PhpStorm and other jetbrains IDEs like IntelliJ require subscription fees, and that their community versions have very little language support. So I think they're out (which is too bad because I've heard good things).
  5. mysteriousmonkey29

    Good IDE for web development with built-in compilers/debuggers?

    Ok, thanks for the info. That's a very interesting point about front-end debugging. I guess I'll look more into built in browser debuggers/tools, and then let that inform my decision of which IDE to use. Thanks!
  6. Hello, I am looking for a new IDE. I am currently using netbeans to develop a website in php/mysql. I like a lot of things about netbeans, but I don't like that it doesn't come with built in compilers/debuggers. You have to manually go and add/link them on a language-by-language basis. This isn't too bad in theory, but sometimes it doesn't work like it should, which can cause a huge headache. I had a of a time getting a debugger to work for php. I am now adding javascript/jquery to the website, and discovered that the debugger I already set up doesn't work with them (only php). I don't want to go through the headache of finding/linking another one if I can avoid it. So I'm in the market for a new IDE. I also have previously used vim. I really like code coloring, and the ability to do everything from the keyboard with a million customizable shortcuts. However, I miss the real time error detection and debugger-integration in most IDEs. Here's what I care about: High priority features -can run on windows (currently running windows 7, and will update to 10 eventually) -can choose between mouse or keyboard as main input method (like gvim) -free, or at least only a one time fee (as opposed to a subscription fee) -black background, with automatic code coloring -works with PHP/MySQL, HTML/CSS, and Javascript/Jquery -comes with compilers/debuggers, or at least is easier than netbeans to link them Lower priority features (not necessary, but would be nice) -work with other languages--C,C++,Python,Java, etc. -code completion/automatic variable renaming, and that kind of thing -integration with version control software -code minimap (like in sublime text) -cross platform (linux as well as windows) I've looked at a few options, and here are the best I've found so far: good IDEs: visual studio, IntelliJ, Netbeans, Aptana Studio, CodeLobster good editors (if I give up on the IDE requirement): gvim, sublime text, emacs, github atom It also looks like it might be possible to do some kind of custom crossover. For example, I found this: https://code.google.com/archive/p/vivim/, which is apparently a plugin for visual studio that incorporates vim. Any thoughts/suggestions?
  7. mysteriousmonkey29

    Interactive web comic aggregator general design?

    For the reference of anyone reading this thread in the future, I think I figured out my general design for MVC. The model is a set of PHP/MySQL functions for creating/modifying a list of comic strip objects, each containing their own list of comic objects, as described earlier. The view is a PHP class with an output functions that loads a PHP/HTML template using require '…' as explained by foxy mod. The controller is a JavaScript/Jquery file that listens to button clicks and other user interactions, and then replaces the whole content of the website (which I surrounded with a div id="content" tag for this purpose) with an Ajax load call to the same file but with a corresponding action variable appended to the name of the URL. Then in my index file I have a simple loop that checks if an action is set, executes the corresponding model function, and then loads the view using tthe output function. A simplified version of my JavaScript model file is as follows: $(document).ready(function() { //$("button").click (function() { //replace all the content with what the main page returns on this action using a jquery ajax call $("#content").load("index.php?action=desiredMethodFunction"); }); }); And a simplified version of my index file is as follows: $model = new Model(); $view = new View($model); if (isset($_GET['action'])) { $model->{$_GET['action']}(); } echo $view->output(); Thanks for all the help!
  8. mysteriousmonkey29

    Proof of concept Ajax MVC?

    Actually, I solved it by replacing the regular JavaScript Ajax with jQuery Ajax load call. I added a div tag with the ID of "content" surrounding all the content, and replaced the script tags with: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script> $(document).ready(function() { $("button").click(function() { $("#content").load("index.php?action=changeText"); }); }); </script> Works like a charm!
  9. mysteriousmonkey29

    Proof of concept Ajax MVC?

    Hello, I am trying to create a proof of concept webpage that changes text in response to a button press using an MVC pattern (or at least as I understand it), and Ajax to avoid reloading the page. (I would like to implement Ajax in a larger MVC program I am working on but thought I would try to get it to work small-scale first). From playing around with examples here and here: https://www.sitepoint.com/the-mvc-pattern-and-php-1/ http://www.w3schools.com/php/php_ajax_php.asp I have the program working with each component individually (it works with the MVC pattern if I don't mind reloading the page to update the text, or it works without reloading the page if I don't mind essentially scrapping the MVC pattern). However, I'm trying to get both to work at once. I have combined the two examples so that the view uses Ajax to call the appropriate controller function, which successfully modifies the model (I'm sure this part works from debugging the program). However, when I try to refresh the content of the page using the output function of the view, nothing happens without reloading the page. Here is my code so far: <html> <head> <meta charset="UTF-8"> <!--ajax attempt--> <script> function callTextChange () { var xmlhttp = new XMLHttpRequest(); //if uncommented, this changes the text, but it doesn't fit with my MVC pattern /*xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("text").innerHTML = "changed with purely Ajax, without using MVC"; } };*/ xmlhttp.open("GET", "index.php?action=changeText", true); xmlhttp.send(); } </script> </head> <body> <?php class Model { public $text; public function __construct() { $this->text = 'default'; } function changeText () { $this->text = 'changed'; } } class View { private $model; public function __construct(Model $model) { $this->model = $model; } public function output() { //regular MVC method using button as a link //return $this->model->text.'<a href="?action=changeText"><button>change text</button></a>'; //attempted ajax method using button on click attribute to make an Ajax call return '<p id="text">'.$this->model->text.'</p>'.'<button onclick="callTextChange()">change text</button>'; } } class Controller { private $model; public function __construct(Model $model) { $this->model = $model; } function changeText() { $this->model->changeText(); } } $model = new Model(); $controller = new Controller($model); $view = new View($model); if (isset($_GET['action'])) { $controller->{$_GET['action']}(); } echo $view->output(); ?> </body> Any idea how to do what I'm trying to do? Is this even possible? Help would be much appreciated
  10. mysteriousmonkey29

    Interactive web comic aggregator general design?

    Okay, thanks for the info. I'll probably pursue the method Suggested by foxy mod, just because I don't think I'm trying to do anything that complicated. So when you include the PHP/HTML template, is it just like pasting in the code? So it can access the variables from the file is being included in
  11. mysteriousmonkey29

    Interactive web comic aggregator general design?

    Okay, I have yet another follow-up question (sorry to keep pestering you guys). I started looking into HTML templating, and realized I am not exactly sure what you guys mean by HTML templates, like in your comment here: Are you referring to HTML 5 template tags? Or do you mean I should create, for example, one HTML file titled comics_page_template.html, containing my generalized control panels and a placeholder tag for the comics list, then another HTML file titled comic_template.html, containing an individual control panel and a placeholder tag for the comic image, then load the parent template in the PHP view file, fill it with comic templates in a loop, and then use PHP to go in and fill in all the variables (such as comic strip title, and the actual image tags)? Or is there some way of passing arguments to an HTML file using PHP that I am missing? Thanks again
  12. mysteriousmonkey29

    Interactive web comic aggregator general design?

    Also, after thinking about it a little longer, I'm still a little confused about this point: It makes sense that a regular PHP process that just generates HTML gets destroyed after being used. However, most (if not all) explanations of MVC that I have found thus far hold that the model contains permanent data storage. I guessed before that I would write the model in PHP simply because it is the most ubiquitous language in my project, but now I'm not sure if this is the correct choice. Would writing the model in PHP nullify its ability to permanently store data? If so, what should I write it in? If not, then back to my original question about whether it makes sense to populate the model with an array of comic strip objects, each containing an array of comic objects. It seems weird to me to create these arrays using constructors and then go in and modify the attributes of each object from the controller according to user customization. However, it also seems weird to destroy all these objects and then re-create them each time, and if the model is indeed permanent storage for data (or at least permanent until you go to another website or reload), then i don't see a third option and am still confused. Thanks again
  13. mysteriousmonkey29

    Interactive web comic aggregator general design?

    Hmmm, I've read a lot of posts that contradict that. Upon further googling, the main problem seems to be that no one can agree on how MVC works. Here are a few similar but markedly different flowcharts that I found on Google images: https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/MVC-Process.svg/2000px-MVC-Process.svg.png https://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/ModelViewControllerDiagram2.svg/350px-ModelViewControllerDiagram2.svg.png http://www.moock.org/lectures/mvc/images/mvc-02.jpg http://help.sap.com/static/saphelp_hanaplatform/en/91/f233476f4d1014b6dd926db0e91070/loio1eb216151b1b41f1979b7b6c969670df_LowRes.png The last 2 seem to make the most sense to me, but in the first of these (third image on the list), I don't get the distinction between the model updating the view and the controller modifying the view. The second part seems redundant. And in the very last one on the list, I don't understand exactly how I would implement whatever they mean by the "data binding" arrow. Very confused
  14. mysteriousmonkey29

    Interactive web comic aggregator general design?

    Okay, I have formulated a few more questions, this time specifically implementing an MVC pattern. First, in my case, would it be the controller that reads data from the database using PHP/MySQL, or with the controller tell the model to read data from the database upon being called into action by buttons on the view? Second, does the controller tell the view to refresh? I have read that a common misconception about the MVC pattern is that the controller passes data directly to the view, so I am pretty sure that the view is supposed to be getting data from the model. However, I am not sure what is supposed to initiate the refresh of the view.
  15. mysteriousmonkey29

    Interactive web comic aggregator general design?

    Okay, that was very helpful, thank you. I think I mostly get what you are saying about the recursive population/stuffing ttemplates inside each other, and the explanation about PHP memory definitely makes sense. I think I will proceed with this design and see if I run into any more unexpected issues.
×