Jump to content

alexweber15

Members
  • Posts

    238
  • Joined

  • Last visited

Everything posted by alexweber15

  1. I'm all for building it yourself! I've been in a similar situation in the past, where using a CMS seemed like overkill. That said, depending on your experience, some frameworks might be a bit intimidating at first (took me a while to get used to Zend Framework for example). Cake looks nice and I've been wanting to try it, I say go ahead and try some of the available tutorials to see if you feel comfortable with it. One thing you want to keep in mind when building it yourself is planning... try to figure out exactly what you need and how it will come together before diving in so you don't end up having to redo something or even worse create kludges that will bite you in the ass down the road! On the other hand, with a CMS you can be really experimental and reorganize things a lot along the way.
  2. If you make your own autoloading function, there will not be used any fallback. So basically if I have no autoloader expilcitly defined but I define spl_autoload_extensions() then the fallback will look in my include_path for corresponding files with the defined extensions?
  3. I realize that! I've changed it to use: <class name in lowercase>.class.php and <class name in lowercase>.php But in my include statement in my autoloader i still end up having to manually specify the extension if not it doesnt find my classes....
  4. I realized this will be an issue I could potentially have in other parts of my application so I decided to include Zend_Registry and use it to share object instances between classes in my application
  5. I'm trying to figure out what's the point of this function!! I registered the extensions I'm using ('.class.php,.php') and correctly set up my include path but the I get warnings saying that "path/to/file" can't be found. (even though the class is located in path/to/file.class.php) I also use some 3rd party components that are named "file.php" so I've got to account for both. Now, I've figured it out and my autoloader works fine, but I'm really just wondering what's the point of spl_autoload_extensions if I have to manually specify the extensions myself?? The more intuitive approach would be that you could leave out the extensions and it would automatically search for both types right?
  6. Hey DjKat thanks for the feedback! I totally agree with you and personally I don't use Smarty at all but, at the end of the day, I don't have much of a choice in this department! The rest of the developers on the team are very enthusiastic about it and all the templates are ready to begin with! So really whether I like it or not we're using it! I'll read up on Zend_Layout and hopefully it will point me in the right direction!
  7. We're in the process of rewriting our biggest app MVC-style. The code is a complete mess but the one solid thing is the templating done with Smarty, so we want to stick with it. I don't really have any Smarty experience and I'm not sure how to properly implement it in the MVC context; what's better? - Instantiate the class every time its needed (ie the controllers)? - Instantiate the class once during the bootstrap process and pass it as a parameter to the controllers? (right now its a global variable, which afaik isn't ideal) thanks!
  8. Thanks for the reply Garethp, that's pretty much what I'm doing. And to avoid out of bounds errors: I was hoping someone out there already had this problem and created an awesome class so I wouldn't have to do it myself!
  9. Hi, I'm working on a project with data that is represented as a n*n matrix. Its easy enough to do this using a multidimensional array but the catch is that I need to be able to check adjacent squares and other grid-like functionality. Again, I've managed to bypass this using arrays but its kind of annoying. So I ask: Is there some kind of grid data structure that anyone can recommend? With native implementation of stuff like checking squares above, below, etc? Thanks!
  10. hey wow you really dug this one from outta the grave eh! lemme catch up and ill reply in a bit!
  11. I've beta testing a website using htpasswd to protect the directory but I rely on 3rd party tools to generate user & password combinations and I don't like that. Some places say it's md5, others crypt() and others say its a specific apache md5 version but at the end of the day I haven't been able to emulate it... Can anyone shed some light please so that I can generate my own username & password combinations without relying on a third-party website? Thanks! Alex
  12. thats pretty sweet oh and Roadside looks nice too thanks!
  13. thanks for the replies and that's kind of what I was expecting to hear! I've read up on Smarty in the past and done a few small things but there was always a lot of business logic going on specially when passing objects to the view...
  14. I don't see how databases relate to web servers. Database servers or even simple database engines like sqlite in no way depend on a http server being present. what I mean for mysql for example it would require the client to have a local mysql server, which isn't that common outside of the developer world so unless you use a flatfile or sqlite which can be bundled easily it would be a problem afaik
  15. Here's how I see it: Use a Singleton if you want to have at maximum 1 instance of the class at any given moment. If your Singleton's constructor is empty then you really don't need the class to be instantiated at all, in which case you would use a static class (just remove the getInstance method) Abstract classes are a whole different thing. You would use an Abstract class if your class is part of a class hierarchy and you have an abstract parent and concrete children that have similar properties and methods but may also have different implementations of a certain method. If there is no defined hierarchy then you should use interfaces instead. Hope I helped instead of confusing more! Alex
  16. I guess using GTK, but how real is this? Would it be viable to create software using PHP and how would databases work without a web-server involved? (or am I missing something?) Also, can javascript be used? Just curious! Alex
  17. I noticed Smarty hadn't received an update in a few months dating back to last year (up until recently) and with a lot of talk I've been hearing recently about PHP as its own templating language being the best option I turn to you guys: Is Smarty still a good choice and in what cases? For example: How well does Smarty + MVC Framework (Zend, Yii, etc) perform? I realize that Smarty is probably the best templating engine for PHP out there but I've become slightly discouraged recently... how many of you actually use it on a regular basis? Thanks! Alex
  18. Thanks for the reply! Yeah I'm curious to see it if you wouldn't mind sharing... Alex
  19. thanks for the reply, gotcha, that's what I've been doing it but I just always figured there was a better way to do it... guess not! Since I seem to have your attention mind taking a look at my original question about submitting forms? In a nutshell: When programming with classes I usually end up having a handful of classes and the regular PHP/HTML pages that take care of user interactions and I always end up creating a file called 'submit.php' that's a central place to direct all form submissions, route them to the appropriate classes/objects and then return flow back to the user (which is where I would output JSON in the case of AJAX stuff) I never liked the whole 'submit.php' thing but can't think of a better way to do it... is there any? thanks Alex
  20. sorry i meant conVention!! and yeah I know, I do use json_encode() but then I end up doing a die() with the encoded values in order to send them back to my javascript and that just doesn't seem that elegant but maybe its the way. I figured doing something like Header('Content-type: application/json') would be more approriate but it doesn't seem to work. Alex
  21. i guess this subject must be taboo or something (last bump)
  22. try encoding the special characters using utf8_encode/decode functions before sending to mysql
  23. sup all, lately I've been to use OOP in my PHP work and it's definitely made my code more reusable and elegant but there's one thing that I still do the same as before and it kinda bugs me... submitting forms. I always end up having a file called "submit.php" that collects POST data and redirects the script flow to the correct class/method combination. And when I use AJAX, all the file does is: die($_SESSION['myObj']->myMethod($_POST[...]); (the functions all return JSON objects) All this doesn't seem too OOP and elegant at all to me. What's the convention for handling form submits with OOP? And also is there a more elegant way to return JSON objects ? (can you do like content-type="text/json"?") thanks
×
×
  • 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.