Click here to Skip to main content
15,891,529 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
GeneralMagento e-commerce is a bloatware Pin
pandu web dev14-Aug-14 8:36
pandu web dev14-Aug-14 8:36 
GeneralRe: Magento e-commerce is a bloatware Pin
Richard Deeming14-Aug-14 8:57
mveRichard Deeming14-Aug-14 8:57 
GeneralRe: Magento e-commerce is a bloatware Pin
pandu web dev14-Aug-14 9:07
pandu web dev14-Aug-14 9:07 
GeneralRe: Magento e-commerce is a bloatware Pin
Richard Deeming14-Aug-14 9:10
mveRichard Deeming14-Aug-14 9:10 
GeneralRe: Magento e-commerce is a bloatware Pin
Syed M Hussain21-Oct-14 5:21
Syed M Hussain21-Oct-14 5:21 
GeneralHow to prevent html and PHP mixing up Pin
pandu web dev10-Aug-14 0:38
pandu web dev10-Aug-14 0:38 
GeneralRe: How to prevent html and PHP mixing up Pin
Kornfeld Eliyahu Peter10-Aug-14 2:11
professionalKornfeld Eliyahu Peter10-Aug-14 2:11 
GeneralRe: How to prevent html and PHP mixing up Pin
Weekendrockstar30-Aug-14 7:32
Weekendrockstar30-Aug-14 7:32 
This is to expand upon the previously given answer. Yes, HTML and PHP are mixed but there are methods you can follow to split design from content which is usually the way to go whether you are doing all of the site development and then maintaining it yourself or if you're developing the site to be handed over to content people.

Here is a VERY simple/rough sample of how I try to achieve this myself:

PHP
<?php include "modules.php >
<html>
 <head>
  <title>My Title</title>
  <!-- link to external css file to control the layout/design of DIVs
 </head>

 <body>
  <div class="menu_column">
   <?php user_menu(); >
  </div>
  <div class="content_column">
  <!-- content writer: Please enter all of your content in the section below -->


  <!-- End Content Section -->
  </div>
  

 </body>
</html>


Note: I had to remove the closing PHP tags in the example because it was messing up the rest of the entire post.

Now this is the PHP page which you would give to whomever handles the content of each page. They can just keep making copies of the file and name them how they wish to create the multiple pages that make up the site. Now you have:

MODULES.php
PHP
<?php

function user_menu() {
 echo '
  <!-- the PHP and HTML code that would make up your user menu which will then be 
       printed to the very spot where you called the function -->
 ';

}
?>


In some of my sites I have membership service. If the visitor is not logged into the site, the user_menu function will print out the HTML to create the login form. If they have an account and are logged in then the user_menu function will print a table of links involving their account. All of the checking whether or not someone is logged in is handled in the function located in modules.php.

Now, you could do this as many times as is necessary throughout your php files. Just tell the content manager to not touch anything around/within the PHP tags. This will GREATLY minimize the amount of code that you want the PHP interpretor to process being shown within each physical PHP file that someone else will be working with.

This is something of a cheap templating system. If you have PHP modules that do not print anything out to the browser then it isn't as important where you place the function calls amongst the HTML tags. But this will give you more solid control over placement of HTML elements/objects that are created by your PHP.

I believe that it is the easiest and most efficient way to separate design/content from program code without having to try to use a full-blown templating engine which would just create more headaches if you really do not need the kind of 'power' that SMARTY and other engines offer.

I hope this was not too difficult to understand and that it helps at least a bit.
GeneralRe: How to prevent html and PHP mixing up Pin
Alex Manolescu8-Jan-15 2:17
Alex Manolescu8-Jan-15 2:17 
Questionarray_diff to insert all unchecked checkbox Pin
Jelly Fish916-Aug-14 19:05
Jelly Fish916-Aug-14 19:05 
QuestionInvoicce in PHP Pin
FKM_16-Jul-14 17:06
FKM_16-Jul-14 17:06 
AnswerRe: Invoicce in PHP Pin
PIEBALDconsult16-Jul-14 17:32
mvePIEBALDconsult16-Jul-14 17:32 
GeneralRe: Invoicce in PHP Pin
FKM_16-Jul-14 17:35
FKM_16-Jul-14 17:35 
GeneralRe: Invoicce in PHP Pin
Richard MacCutchan16-Jul-14 22:51
mveRichard MacCutchan16-Jul-14 22:51 
QuestionCreating XML SOAP Request using PHP Pin
MICHAEL DENNIS JOSEPH9-Jul-14 6:36
MICHAEL DENNIS JOSEPH9-Jul-14 6:36 
Questiondemanded apps.... Pin
Akanksha Rawat7-Jul-14 20:21
Akanksha Rawat7-Jul-14 20:21 
AnswerRe: demanded apps.... Pin
Richard MacCutchan7-Jul-14 22:31
mveRichard MacCutchan7-Jul-14 22:31 
Questionhelp 4 coding Pin
Akanksha Rawat7-Jul-14 20:17
Akanksha Rawat7-Jul-14 20:17 
AnswerRe: help 4 coding Pin
Richard MacCutchan7-Jul-14 22:30
mveRichard MacCutchan7-Jul-14 22:30 
QuestionCalling PHP function and return array Pin
Member 1029700324-Jun-14 18:47
Member 1029700324-Jun-14 18:47 
AnswerRe: Calling PHP function and return array Pin
xiaoqiangdiandian27-Jun-14 21:01
xiaoqiangdiandian27-Jun-14 21:01 
QuestionPHP, Sql 2008, Web Services and JSON Pin
Member 1029700320-Jun-14 18:26
Member 1029700320-Jun-14 18:26 
AnswerRe: PHP, Sql 2008, Web Services and JSON Pin
vivekkamate7-Jul-14 1:42
vivekkamate7-Jul-14 1:42 
QuestionSQLServer2005 Pin
MianSaeedShahid19-Jun-14 5:23
MianSaeedShahid19-Jun-14 5:23 
Questionrecommended PHP Framework Pin
Jassim Rahma4-Jun-14 10:12
Jassim Rahma4-Jun-14 10:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.