Professional Web Applications Themes

Skin Template Handling - PHP Programming

Hey guys! Wow I haven't been here in a long time. Anyways, I need help deciding the best way to handle templates in PHP with MySQL. It is for a fairly large script / program I am making. I want to be able to add / edit / delete templetes from an ACP interface. I also want to be able to export and import templates (for skin sets). Very similar to IPB (you can add, edit, remove, import skin, export skin, etc), for those of you who have used it. So how should I store the templates? I don't want ...

  1. #1

    Default Skin Template Handling

    Hey guys! Wow I haven't been here in a long time.

    Anyways, I need help deciding the best way to handle templates in PHP with MySQL. It is for a fairly large script / program I am making. I want to be able to add / edit / delete templetes from an ACP interface. I also want to be able to export and import templates (for skin sets). Very similar to IPB (you can add, edit, remove, import skin, export skin, etc), for those of you who have used it.

    So how should I store the templates? I don't want it to be a big mess just to make a script that will export everything, etc. Should I store the templates in a MySQL database? Will that be too slow to load them on each load? Should I store them flat-file, if so, how?

    Any advice / help is greatly appreciated.

    Thanks so much!
    trytertqwr is offline Banned
    Join Date
    Aug 2011
    Posts
    23

  2. #2

    Arrow Re: Skin Template Handling

    I used to a big fan of admin panel based template system like IPB and vBulletin back in the day.

    But now I hate the database templates approach, It is so developer unfriendly. I love the PHP files based template system of WordPress and Drupal.

    I will discuss some pros and cons of both approaches.

    Database templates:
    Pros:
    • No PHP code in templates, it does not require PHP skills to be able to modify the templates.
    • You can export the templates, bundle them and redistribute.
    • Secure, since no PHP code can be included in the templates.


    Cons:
    • It is pain to modify the templates because you can only modify them from the admin panel. You cannot use any file / code editor to work on them.
    • Inflexible - you cannot use any PHP code, loops, conditions and functions in the templates.
    • Code is a big mess, you will have to create custom pr to p the templates. You will also have to develop an administration panel to manage and modify the templates.
    • Slow - the templates are stored in MySQL table which adds a lot of MySQL load and slows down the overall performance.





    File based templates:
    Pros:
    • Flexible - you can manipulate them and extend them using PHP code. It adds a lot of power in the templating system.
    • Easy to manage - you can fire your favourite HTML editor (Coda or DreamWeaver) and edit the templates conviniently.
    • Fast - since there is no MySQL involved, the template system is lightning fast.
    • Your code base will be a lot smaller because the templates are pd as PHP and do not require any additional template management system.
    • You can export the templates, bundle them and redistribute.


    Cons:
    • Unsecure because malacious PHP code could be embedded into the templates.
    • Requires basic PHP knowledge to edit the templates.



    To work around the problem, I created my template system which includes best of both worlds. It uses HTML template files instead of PHP files or database templates. The HTML templates are pd with my template pr, it does not require any PHP and is lightning fast.
    Ravish is offline S U P E R U S E R
    Join Date
    Aug 2006
    Location
    Internet
    Posts
    21

Similar Threads

  1. Replies: 1
    Last Post: June 22nd, 09:16 AM
  2. Handling Events Of DataGrid Template Item Controls - UNANSWERED
    By Scott M. in forum ASP.NET Data Grid Control
    Replies: 5
    Last Post: November 16th, 01:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139