PHP
  Home arrow PHP arrow Page 7 - JV’s Power Tips for PHP (1)
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

JV’s Power Tips for PHP (1)
By: Justin Vincent
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 3
    2003-01-29

    Table of Contents:
  • JV’s Power Tips for PHP (1)
  • Never Breaking Out of PHP
  • Basic Template Theory
  • Refining the Previous
  • Accessing Other Variables from Within this Type of Template
  • Using Objects to Store Multiple Output Values
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    JV’s Power Tips for PHP (1) - Conclusion


    (Page 7 of 7 )

    During the course of this article, amongst other things, we have explored why it is important to abstract programming logic from layout and display. Here are the main tips broken down into bullet points:
    • Try not to combine PHP logic and static HTML in the same place.
    • Take note of how useful the print <<<END statement is
    • Put your static HTML into PHP templates to make it very easy to merge dynamic variables into it
    • Gather dynamic variables (at the beginning of your script) and then inject them into templates (at the end of your script)
    • Make your own function such as out() and use_template() to help you
    • Use define() to make short cut aliases for use with functions like out()
    • Structure your code into directories such as functions and templates
    • Refine a function like use_template() into something more useful like get_template()
    • Use a single global object such as $output to store your dynamic output into
    When I started writing this article I expected to cover a lot more ground. I haven’t even got to the reason why I mentioned turkeys. That will just have to wait until my next ‘power’ tips article. Power tips indeed. I have a website that offers amongst other things free scripts that can help to make a PHP programmers life just that little bit easier.

    Anyway, thanks for your time and perhaps I’ll see you in the next instalment of JV’s Power Tips for PHP (borrowed from the name ‘Kai’s power tools for Photoshop’).

    In the mean time I’m off to think about Turkeys...


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    PHP ARTICLES

    - Making Usage Statistics in PHP
    - Installing PHP under Windows: Further Config...
    - File Version Management in PHP
    - Statistical View of Data in a Clustered Bar ...
    - Creating a Multi-File Upload Script in PHP
    - Executing Microsoft SQL Server Stored Proced...
    - Code 10x More Efficiently Using Data Access ...
    - A Few Tips for Speeding Up PHP Code
    - The Modular Web Page
    - Quick E-Commerce with PHP and PayPal
    - Regression Testing With JMeter
    - Building an Iterator with PHP
    - PHP Frontend to ImageMagick
    - Using PEAR's mimeDecode Module
    - Incoming Mail and PHP






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT