Jump to content

devbanana

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Everything posted by devbanana

  1. [quote author=steelmanronald06 link=topic=105698.msg423288#msg423288 date=1156768849] SMARTY [/quote] Hi, Thanks for the reply. However, as I mentioned in my first post, I'm not looking for existing templating systems, but what features you would look for in a templating system. I don't like Smarty, because the logic is too imparative. If you're going to use Smarty, you may as well just use PHP for presentation logic, because they're both just as imparative.
  2. Great to see this is generating such an enthusiastic response. ::) Well, in spite the fear of talking to myself... I have been checking out XSLT, and it seems like it'd be a very nice tool to use for templating. A bit complicated, but at least it is a standard, and it can output various formats, so it doesn't necessarily need to be bound to outputting HTML/XHTML.
  3. Kind of depends how fast you learn things. It can be anywhere from fairly simple to magnificently comjplicated, depending on what you need to do. XPath really isn't all that hard; it is XSLT that gets difficult.
  4. This is a classic case for XSL. All I can suggest is to parse it in XSL to get the desired output, then assign the string to Smarty. Here is a starting resource on XSLT: http://www.w3schools.com/xsl/
  5. What results do you want to display? What do you want to parse the XML for? Why not simply use an XSL stylesheet to do your transformation, if that is indeed what you are doing? That's more standard than Smarty, anyway. :)
  6. Hello, I am creating a framework, and for the templating, I decided to use XML and XSLT. The thing is, I've heard that XSLT can be a bit intensive for larger documents, and it might hurt performance. So, I was thinking of detecting if the user's browser supported XSLT, and if so, just have the browser do the transform. Otherwise, PHP could do the transform. Here's the question: [list] [*]Is XSL an accepted standard so much so that it would be safe to assume the browser has XSLT support? it has been around since 1999, anyway. [*]If not, then how would you detect this in PHP? I'm thinking if I just check the HTTP_USER_AGENT, I might then be able to compare that to known user agents that do support it. [/list] Thanks, Brandon
  7. [quote author=thorpe link=topic=105694.msg422309#msg422309 date=1156591296] Im no OOP wizard but Im quite sure the application contoller sits further down in your application layer. Your front controller should not have direct access to business logic, rather it delegates to the application controller which would then envoke your commands and views. I cant really point you to any guides on the subject as Im reading most of my OOP stuff from a book (PHP% Objects, Patterns and Practice), however, [url=http://www.corej2eepatterns.com/Patterns2ndEd/ApplicationController.htm]this[/url] may help describe it better. [/quote] Thanks for the link; I've read that page a couple of times already, plus other pages, like the [url=http://www.martinfowler.com/eaaCatalog/index.html]catalog of P of EAA[/url]. So, it seems that the front controller would receive the request, and would perhaps parse it into some other form the application controller would understand, to map to a handler and view(s)? So something like: [code=php:0]<?php class FrontController { public function run() { $page = 'Home'; // Provide default // Would normally take the default out of a configuration file if (array_key_exists('page', $_REQUEST)) { $page = $_REQUEST['page']; // Do other processing to make sure it maps to a valid page } $appController = new ApplicationController($page); $appController->execute(); } }[/code] There are only a few things I wonder about with this. [list] [*]If I wanted to implement intercepting filters, would this be in the front, or application, controller? [*]I'm trying to think of a way to allow parameters to be passed as well. I was going to use pathinfo so that it could be like index.php/page/param1/param2, but IIS seems not to support pathinfo, and I am trying to make it work with both Apache and IIS. The only other thing I could think of is that after the page is retrieved and validated from $_REQUEST, delete $_REQUEST['page'], and pass what's left of $_REQUEST to the constructor of ApplicationController so it can get all the parameters that might be needed. I don't think it'd be a good idea for ApplicationController to use $_REQUEST specifically, unless it is passed $_REQUEST in the constructor, because I'm trying to limit access to $_REQUEST and the like to the front controller, which should handle the HTTP request. [/list]
  8. What, in your opinion, would the perfect templating system be like? I'm not looking for systems that have been already made, but features that you would want to see in a good templating system. Please be realistic. :) I know some people just like to have PHP intermingled with HTML, such as: [code]Hello <?php echo $user?>.[/code] But I don't really like this. It would be too tempting to do some processing in the presentation layer that does not belong in the presentation layer, plus I think it is too messy, as far as syntax is concerned. I'm thinking of, perhaps, a declarative syntax, that would mostly look like regular HTML, but would be parsed by the template system and replaced.
  9. Hi, There seem to be several different types of controllers when it comes to the MVC pattern. I've been reading a bit about both the front controller and the application controller, but I'm failing to see what the difference is. I know the role of the front controller, but am unsure of where the application controller, if used, would play into this. Found absolutely nothing when doing a search around these forums. :(
  10. Not bad ideas, though they seem a little too generic. Also, the names with "studio" in it, makes me think of an IDE instead of a framework. The dev library idea isn't bad, but to me, anyway, it is a true framework, not just a library of tools which that name might suggest. [me=devbanana]is confused[/me] I kinda think it should be fairly unique, and catchy. Thanks again. :)
  11. True. So what kind of name would you suggest then? Thanks for the suggestions. :D
  12. Well, if you subtract them, the difference will be in seconds. If you divide by 3600, you should have the difference in hours. [code=php:0]$diff = $date2 - $date1; $hours = floor($diff / 3600);[/code]
  13. Use [url=http://php.net/strtotime]strtotime()[/url] on both dates, then compare the resulting timestamps.
  14. Oh oh oh...I could name it bananaphp, spinning off the name devbanana, which will one of these days be my programming community type web site... [me=devbanana]ponders[/me]
  15. You need a way for each page to specify what kind of permissions a user requires to access that page. If it is the same for the entire application, you could have a central authentication/authorization class, which would be called for every page, to check if the user is logged in or not. I think you could use a front controller for this type of thing. After the user is authenticated, you could have a principal object with their username and role(s). If they aren't authenticated, just assign a principal object specifying a role of anonymous. The authorization component then could check that they have sufficient privileges to access the system. Role definitions: [code=php:0]define('ROLE_ANONYMOUS', 0); define('ROLE_EMPLOYEE', 1); define('ROLE_MANAGER', 2);[/code] Authorization could do something like: [code=php:0]// Ensure user is at least an employee or manager if ($principal->Role & (ROLE_EMPLOYEE | ROLE_MANAGER)) {     // Allow access } else {     // Disallow access }[/code]
  16. Hi, Anyone know of any good PHP IDEs? Something perhaps with autocomplete, perhaps parameter information for functions, ability to view the documentation for a given function easily, etc. By autocomplete, I mean more that when you start typing a name of a variable or function, it could give a list of possible completions for it, and you could maybe just press enter on the one you want to have it complete it. I've been using Visual Studio for a while for C# development, and now I'd like to find some of that functionality in a PHP IDE. Something free preferably. :)
  17. [quote author=Corona4456 link=topic=105571.msg421771#msg421771 date=1156483551] How about PHP.NET? lol...[/quote] Lol, I had already thought of that, but PHP's own web site is php.net, plus I don't want to make it seem it is exclusively inspired by .NET, or have an expectation that it will be a copy of .NET, because that will not be so. Plus, I'm afraid that association will scare away some developers who don't like anything remotely related to Microsoft. [quote]The framework would quite possibly be useful, however, I think an important aspect of your framework would be good documentation.  A heavily documented framework will get more people interested in your product than anything else.  That's what draws me to using certain tools is their documentation which therefore provides an ease of use for the tool. [/quote] Oh believe me, I agree 100% there. I hate frameworks that provide hardly any documentation whatsoever, and leave it up to you to figure out, with maybe just a couple sample scripts made with it or something. I've previously looked extensively for good frameworks, and so I know personally what draws me to one and not another. :) Thanks for the suggestions.
  18. Hi, Before I start, please move this if it is not in the right area. I wasn't sure where to post it. I am thinking about making a PHP framework. It'd be mostly for my own use, but I figure I may as well make it open source (possibly) and allow others to use it as well, especially if it has a lot of useful functionality and helps with development time, as I want it to. I'll be using it for my future projects. This framework would be based on PHP5. It'll have its own templating syntax, which would probably be more declarative than imparative. It'd be inspired off of ASP.NET's template syntax, probably, unless people give me other ideas. It would have very good AJAX support, plus a JavaScript library to make scripting JavaScript a lot easier. It would have a database layer, with a database factory to allow use of various types of databases, including MySQL, PostgreSQL, and MS SQL. It would make extensive use of the features in PHP5, including iterators, interfaces, object orientation, and exceptions. The error handling would be very robust. It would offer an easy way to validate posted data, some of which may be declarative, or might be in validation classes that would encapsolate validation rules. I'm not sure how I would be implementing this yet. Also, the entire reason I am making this is to have it support a service-oriented architecture, if desired. You wouldn't necessarily need to use that I don't think, but the option would be there, and there might even be existing services that you could reuse. This would be implemented, of course, using SOAP in PHP5. It would offer an easy way to integrate a service, and specify what type of messages this service would receive. Ideally, you shouldn't have to worry about the raw XML requests and responses, but of course you could if you wanted to. It would probably have some tools like a WSDL generator for example, and probably some other code-generator tools. It would have built-in logging and auditing components. it would have robust authentication, authorization, and other security mechanisms, which would have a default implementation and database design, but would be flexible enough to plug into existing authentication/authorization mechanisms, or user stores. Those are the features I have thought of so far. My goal with the framework is to have it be light-weight enough for personal web sites, but powerful, scalable, and flexible enough for large-scale, distributed web applications. In this framework, I'm looking to implement a lot of the functionality that I like about the .NET framework, including ASP.NET, but keep the flexibility and ease of PHP, and also add my own features and improve any features I include from other platforms/frameworks. Do you think people would be interested in such a framework? Also, what would be a good name for it? I was thinking of something simple like PHPSOA, but I'm up for other suggestions as well. 
×
×
  • 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.