
eazyGen
Members-
Posts
41 -
Joined
-
Last visited
Never
Everything posted by eazyGen
-
Project Directory Structures - Please pick holes
eazyGen replied to eazyGen's topic in Application Design
This is all good. What I have in mind is anything but a "general web site". However, I am a natural worrier and security plays on my mind. Are you able to point me at a good resource that covers the whole subject of security? Many thanks, S -
Project Directory Structures - Please pick holes
eazyGen replied to eazyGen's topic in Application Design
Ahh. You are right. I misunderstood root. I think I have it now. And I think your example also explains the reason why you separate the client and server side functions. Presumably, this is because users will request client side files (js scripts etc) and they MUST have access, otherwise we all fall down? I will need to have a re-think here. One last thing. For the sake of security, ought I to put all my config data in a "config" directory and allow read only access to that directory? Or is there a better technique? Thanks for your thoughts? S -
Project Directory Structures - Please pick holes
eazyGen replied to eazyGen's topic in Application Design
Thanks for you comments. S -
Thank you - this is helpful. As a consequence of this discussion I will build an example structure and place it on my web site. When I have it complete, I will post back and we can perhaps discuss the matter further? S
-
Project Directory Structures - Please pick holes
eazyGen replied to eazyGen's topic in Application Design
"Document root" - are you referring to the DOM? If so, that is further down on my learning path - and so I can bear what you say in mind when I come to that - thanks. Until then I cannot really make any sensible comments. The only other point is this - do you find my blatant disregard of the names of "Model" and "View" a problem? I tend to do things in my own way according to how I see things. That said, there is no point in altering this naming convention if it confuses the rest of the world. Thanks for your thoughts. S -
Hi guys. I am new to PHP, but experienced in other languages. My thoughts today centre on project directory structures. Here is what I have for my current (testing and learning) project. I would be grateful for any constructive criticism. I have a local container directory called "Development", which I periodically upload to the server. This can be thought of as root. Plus within that, I have a single PHP file (index.php) and I will, in time, move my .haccess file there, plus I have the following directory structure: Root ==>Controller ==>Data ==>Images ====>Decoration ====>Logos ======>Favicon ==>Includes ==>Javascript ==>UI ====>CSS ==>Work As you can see I am trying out an MVC type approach to my test project. The directory purposes are: Controller - Controller scripts Data - Object Classes that wrap the database tables - I don't call this "Model" as I equate a model with a model and not a db table. Images - Container for all images Decoration - Non essential decorative images (these could easily just be placed in the "Images" folder) Logos - Logos of varying size, branding etc (As above, could just be in "Images") Favicon - My Favicon (again could just be in "Images") Includes - Self explanatory I feel Javascript - Javascripts (I have not progressed much with JS so this is a place holder and subject to change as I learn) UI - This is usually called "View" from what I can see, but I don't like "View" in this context because I relate "View" to SQL. Plus, this really does contain UI files. CSS - CSS Work - This is just a dump of tests, mics files and anything else. It does not form part of the app. So, apart from the fact that I should be calling MVC (Model, View, Controller) DUC (Data, UI, Controller - and some people will no doubt dislike this immensely) and I could combine the image folders - where would you say the weaknesses are with this approach? The only other thing I guess would be to rename "Development" to the name of the project. Many thanks for any response. S
-
Thank you. S
-
Hi. My apologies. I did not make myself clear. I assume the above are for command line access. Is there a way I can see this via a URL, or perhaps from phpMyAdmin? Thanks S
-
Many thanks. I am using Apache and mySQL on my server and localhost. Is there any way I can see the number of open database connections on either or both? S
-
Hi guys. I am generally familiar with databases (mostly DB2), but I am a newbie when it comes to PHP and MySQL. I notice that in order to use a MySQL databases, a connection must first be made to the database and, somewhere along the line, that connection needs to be closed. I am thinking that to open a connection at the start of a script and then to close it at the end will work. However, if I do this for each and every script that accesses a database table, then there will be numerous open and close statements running through my application. I am wondering therefore is there is a generally accepted strategy for handling a database that minimises the amount of connection statements; or if the above is essential given the static state nature of a web page. Any assistance much appreciated. S
-
Many thanks. So you would create a class for each table (a model) and place in there, not only the data access code, but also as much of the validation that relates to the table as possible? S
-
Thank you for your thoughtful reply. A first impression question - would it be true to say that the controller scripts could get pretty large (in relation to the size of app) quite quickly? If so, would you try and separate out "related" control scripts into more than one controller? Thanks again, S
-
I made an error above but cannot seem see how to modify the text The error was that when the user clicks submit, a validation script will run and, if all ok, this will invoke the "createCustomer" method on the customer object. I think.
-
Thank you kindly. You explain things well. I am old friends with layered software. At present I wrap the data with classes and only ever access it via published, tested, and proven (OO) methods. If I don't have classes, I would do it with good old fashioned “programs” - in COBOL (a procedural only language) for example. I have been reading up on MVC and in many ways this seems to fall into line with what I have picked up over the years, which is encouraging. If I posit a concrete example, perhaps we could discuss it? (I hope this in no way breaches forum rules). I have a web form – “newcust.php”. The purpose of the form is to capture data so a new customer table row may be created. We have: Name Address Country The first two fields are text, and the “Country” field will be a drop down menu pre-populated with rows from the “Country” table. So, as things are with my current understanding, “newcust.php” can contain a mix of PHP and HTML or all PHP (which takes me back to the original question). It will also create a new “Country” object (from the class that wraps the “country” table) which has a “getAll” method. The output from this method is an array, which I use to populate the drop down. The user fills in the from and clicks Submit. I then create another new object (“Customer” - from the class that wraps the “Customer” table”), and invoke the “insertCustomer” method, which inserts the new customer row (let us say the key of the table is an auto-increment “id” field which means SQL will take care of it). This seems elegant enough and would work reasonable well. The question I have is: “Where does the 'Controller' part of MVC come in'. Apologies for the length of this reply and many thanks in advance for any response. Steve P.S. I have done a lot of web crawling thus far, but I do find forum discussion useful, over and above standard research.
-
Hi guys. This is my first post here - so HELLO. I am a very experienced software developer, but new to web work. I am building a software tool using PHP (primarily). As such, many of my questions will concern optimum solutions (in so far as they may be determined), best practices, and the unwritten standards that will surely have evolved through the PHP community over time. My first question concerns the mixing of HTML and PHP. My efforts so far contain a mix, but it doesn't "feel" right. I am using straight XHTML, PHP echo, and also heredoc. I can post the code if folk think it may help. But what is the general view as to whether "mixing" like this is a good and accepted practice, or is another approach preferred? Many thanks in advance for any replies. S