Jump to content

DeX

Members
  • Posts

    258
  • Joined

  • Last visited

Everything posted by DeX

  1. I wasn't necessarily going to build setters and getters for every single database column. For example, if I have a quote I need to display on the page, I would build a customer object and set all the customer details in that so the getters can retrieve it to display on the page, it's only name, address and phone number. Then I would have a quote object which would set things like the quote price, the quote expiry date and a list of all the upgrade options to show on the quote, along with their attributes like width, height and quantity. Then when doing purchase orders, I would build a bill of materials (BOM) object that would contain all individual building products and their attributes. Is this wrong? I'm mostly wondering how to separate the model into multiple models because I mainly just have one right now with all the methods in it.
  2. I've been working with what I thought was MVC for quite a while but now after researching it some more, it appears I may have been wrong all along. I think I have been using the model incorrectly. Is my new way of thinking now correct? Model: These are like objects that hold data during the session (page load). It can also dump the data to the database but is mainly used to hold data related to a specific object for use throughout the current page load. Controller: There will usually only be one as it is like a gatekeeper that directs requests to the proper model. View: These will usually be the .php pages themselves but for views that are reused, it can be an isolated class which generates HTML code (like loading a select element with user names). I have built a program where a quote is requested by the user and the program has to go to the database in order to get the details of the quote to display them on screen. Right now my view is making the request through the controller to the model and the model is fetching each piece of requested information from the database, then passing it back through to the view as needed. Because the page can show the same information in various places, the same database call by the model can be made more than once for that specific information. Should I be making a request for the entire quote, building a quote object with the model and then passing that entire object back to the view to be used instead? This will introduce a lot of getter/setts methods of which I currently have none. I'm assuming I would have a customer model which would build a customer object and return that. Then a quote model would build a quote object and return that. Same for purchase orders and users, all which will have information appearing on the quote or purchase order. Thanks a lot, I'm really trying to research this as much as I can and get it correct.
  3. At times, yes. Some SELECT elements will be duplicated on more than one screen, like the list of users. That can be used to assign a quote to a salesman or it can be used on the user management screen in the admin section.
  4. Does this mean I should just have the foreach loop in the webpage itself and build the option elements right there? This would mean I can avoid having a view class file at all, the view would simply be the webpage.
  5. Currently I have a page where a select element resides and it shows a list of all users in the system. Here is my logic for populating the select box: 1. That page makes a call to the view to be populated. 2. The view runs a foreach loop and builds a string containing a lot of options elements holding the user names, then returns the long string back to the page to be displayed. 3. The foreach from the view makes a call to the controller to get all the names. 4. The controller passes the request straight through to the model. 5. The model gets all the names from the database, adds them to an array and returns them back to the controller. 6. The controller passes them back to the view. 7. The view iterates through them and builds the list (in step 2 above). 8. Element with all options is displayed on page. I'm confused if the view is for building objects which contain HTML coding, or if the view is the actual webpage being displayed, and the building should be handed off to the controller. Basically I'm wondering if the view should be pages or classes.
  6. By repairing the schema, do you mean adding default data values to all those columns?
  7. I upgraded my server to Ubuntu 16.04 which also installed MySQL 5.7 with it and now every time I run an insert statement, it errors and tells me there is no default data specified for that column. If I go into PHPMyAdmin and specify default data for all columns, the insert will run without error. How do I turn this off? It's affecting my production sites, I just want it to go back the way it was of inserting empty strings or zeroes (or null) for any column I don't specify.
  8. You were right, that worked perfectly. Thank you!
  9. Wow that worked perfectly, thanks! I wonder why it does that.
  10. 7. I have other websites running on the same webserver and their code can find their respective javascript folders fine. 8. I didn't customize Apache2 at all, I just installed the default setup.
  11. I have an Amazon web server which I host maybe 5 websites on and one of them is a portal I'm building for a client. Everything works great except when I load a page that uses JavaScript files, the console complains that it can't find any of the files, so therefore none of the JavaScript code on the page works. Here is a comprehensive list of things I have tried: 1. I put a test.html file in the JavaScript directory and tried to load it in my browser. My browser told me it didn't exist, 404 error. 2. I created a javascript2 folder and put the test.html file in there, it loaded no problem. 3. I moved all of my JavaScript files out into the javascript2 folder and changed all the reference links in the HTML to point to the new folder. The page and all JavaScript functions worked perfectly. 4. I did a "locate .htaccess" on my server (Linux) and it didn't return anything inside the /var/www/X directory for the website. There were 1 or 2 inside some other /var/www/X2 or /var/www/X3 directories but none of them specified anything for a javascript directory. 5. I restarted Apache2 and restarted the server many times. 6. When I visit X/javascript/test.html in my browser, watch it fail, then check my Apache2 logs, nothing was added. For some reason my web server can find every file except for anything inside that javascript directory, I have no idea why.
  12. I have a job management portal which I built and it allows my client to create PDF files of quotes for their customers. They send their customer a link (token based URL) so their customers can click the link and view the quote. I want to serve up the PDF file on screen for their customer to view, how can I do this? Each time I attempt it, Chrome asks me if I would like to download the file. I just want to view it without the customer having a direct link to it.
  13. Great ideas, guys, I'm going to do this for sure, the other added benefit of your suggestions is that Google can no longer spider the PDF and show them to anyone Googling a name. I think I already avoided this with my robots.txt but it has been a problem in the past. I think I will still move the PDF folder outside the web directory just to make it easier to roll out updates, I no longer have to skip the PDF folder when moving all folders into production. I can just use a symlink to get the same functionality or just serve it up with PHP like someone suggested.
  14. I have a portal system I built that allows users to generate a quote PDF and save it onto the server so they can send the link to a customer for review. Is it common practice to leave the PDF directory web accessible or should it be one level above the web directory? These quotes do need to be viewed by the public since the salesmen simply send the URL to the customer for review but I've seen it done both ways. Thanks.
  15. I've been using Workbench in Ubuntu for years without any problems at all, it hasn't crashed once. Another alternative you can try is Squirrel SQL, I know that also works for Microsoft SQL databases as well. I used it on a previous Microsoft project and it worked great but I still prefer Workbench for non-Microsoft databases.
×
×
  • 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.