Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. That took long for you to notice I was already worried I had to reply that they had to drop $output = "header(\"Content-type: image/svg+xml\")"; for it to work
  2. Don't ask, do. Facta, non verba.
  3. for ($i=0; $i = $row['qty']; ..) ?
  4. If you want a 304 Not Modified reponse you need to write it otherwise it returns a 200 OK response. header('HTTP/1.0 304 Not Modified');
  5. Load the images into an array and pass them to a paginator.
  6. Figure out the IP-addresses Start > Run > cmd /k ipconfig > Start > Computer > Address-Bar: \\a.b.c.d
  7. Indeed it does. $directory = rtrim($directory, '\/') . DIRECTORY_SEPARATOR; rtrim first removes the trailing slash if any and adds a trailing slash. This code makes sure that $directory contains a trailing slash before proceeding.
  8. Let me first start off by saying that MVC is not OO-specific. In simple applications you enter http://domain/about-us.html as a URL in your browser (request) and you get the contents of the about-us.html page returned (response). You made a request to view about-us.html it was handled on the server and the contents of the about-us.html page were returned. In an OO-context you want to map this request to an object (Controller) so that it can take the necessary actions (Models) and return a proper reponse (View). This is all nice and dandy but how do I initialize a Controller upon receiving a request? I can't map a URL directly to it so I need some other means.. the FrontController is born:
  9. Most likely you won't need JS, they use it for convenience towards developers. But yes you would need XSLT.
  10. This is not good as you mix application logic with presentation logic. However what you address is a common problem and has already been solved by Martin Fowler and is called the Two-Step View and goes like this: abstract class ViewAbstract { abstract public function render($script); } class DefaultView extends ViewAbstract { public function render($script) { include('views/' . basename($script)); } } class TwoStepView extends ViewAbstract { private $view; private $content; public function render($script) { $this->content = $this->view->render($script); include('two-step-view-templates/some-template.html'); } } You would specify TwoStepView as your new view somewhere in your front-controller. All your code in the controller's remain the same they have no idea they are even using a Two-Step View eg: before TwoStepView: public function indexAction() { $this->view->data = $modelService->load($stuff); $this->view->render('something.phtml'); } after TwoStepView: public function indexAction() { $this->view->data = $modelService->load($stuff); $this->view->render('something.phtml'); } This gives you an idea of how it internally works, the exact implementation is up to you. For a model in the GET? Your controller should know which model to use and not load these from a query. Maybe you should take a look at http://en.wikipedia.org/wiki/Presentation-abstraction-control As it's an OO application, yes. Does the OO-design look decent? No. Are you coding in a terrible, messy and inefficient way? Terrible, messy? Probably not. Inefficient? Not likely as you are used to the system and you get things done. Gain experience in your spare time, many have made the mistake to switch to Zend framework while not knowing it's limitations, get familiar, read books, be a professional and decide afterwards if Zend is what you need. Which is why I recommend you gain experience in your spare time. If Zend framework is what you need (although from your descriptions I think CodeIgniter may be more your thing) you can convince management that although now sacrificing resources on the re-design will gain time-and-money in the future due to a flexible design and changes will be swift and trouble-free.
  11. Look this is your default HTML <head>: <head> <title>The Run Around</title> <link type="text/css" rel="stylesheet" href="style.css" /> <script type="text/javascript" src="base.js"></script> </head> After FB.init() has finished your <head> looks like: <head> <title>The Run Around</title> <link type="text/css" rel="stylesheet" href="style.css" /> <script type="text/javascript" src="base.js"></script> <script type="text/javascript" src="http://static.ak.connect.facebook.com/.."></script> <link rel="stylesheet" href="http://static.ak.connect.facebook.com/.."> </head> This will create all these changes. Click on the + next to them to see their source in Firebug (under the HTML-tab).
  12. Reading a manual can do that too.
  13. Tell your form not to auto-load it's default decorators. Then write your custom decorators and add them. Look at the API for more information till' now I never needed to use custom decorators.
  14. Don't store products in the database but keep them in the session. The cookie is by default set to expire as soon as they close the browser. Which means the next time they visit your website their cart will be empty.
  15. Use dabar's suggestion it's easier to implement then mine. As my reply requires a good working knowledge of CSS and JS (+jQuery +formats)
  16. You can create a file that will act as your "hey, start my application god damit!" (commonly referred to as bootstrap) commonly they use the index.php as it's called by default by your server. This could look like: $page = basename($_GET['page']); include('library/functions.php'); switch ($page) { case 'home': include('pages/home.php'); break; .. } I do not advice you would put all your functions in one file though. As your application grows, more functions are added and this can cause an over-head especially for those pages that only use 1 or 2 functions. Over time this will grow to something like: require_once('libraries/somelibrary/frontcontroller.php'); FrontController::start($_REQUEST); And this would load an acronym like MVC where the M toys with a DBAL and they all live in Abstract-ville
  17. Then it will act as some sort of vote-count. Just add it as a field to the post so that on each click the total value is incremented. You would display them sorted based on this field.
×
×
  • 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.