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

Linux, Apache, MySQL, PHP

 
QuestionLittle help with my php code pls Pin
wartotojas11-Oct-09 2:34
wartotojas11-Oct-09 2:34 
AnswerRe: Little help with my php code pls Pin
fly90411-Oct-09 6:26
fly90411-Oct-09 6:26 
GeneralRe: Little help with my php code pls Pin
wartotojas11-Oct-09 9:54
wartotojas11-Oct-09 9:54 
GeneralRe: Little help with my php code pls Pin
fly90411-Oct-09 10:24
fly90411-Oct-09 10:24 
GeneralRe: Little help with my php code pls Pin
cjoki12-Oct-09 6:12
cjoki12-Oct-09 6:12 
GeneralRe: Little help with my php code pls Pin
fly90412-Oct-09 6:54
fly90412-Oct-09 6:54 
GeneralRe: Little help with my php code pls [modified] Pin
cjoki12-Oct-09 7:54
cjoki12-Oct-09 7:54 
GeneralRe: Little help with my php code pls Pin
fly90412-Oct-09 9:01
fly90412-Oct-09 9:01 
cjoki wrote:
This style of code allows me to separate PHP and HTML from css and js.


How is $pg = "<html>\n"; separating the two? You include the HTML IN your PHP.

CSS and JS can be separated from HTML into several separate files (using the link tags and the script src attribute, respectively), rather than being scripted in, so to say. I prefer having separate files. When separating JS and CSS there are always certain bits which have to overlap such ass the class attributes. Smarty does the same for PHP and HTML.


This is a very basic example of using Smarty.

index.php
<?
include('Smarty.class.php');
$Smarty = new Smarty();
$Smarty->assign( 'message' , 'Smarty Rocks!!!' );
$Smarty->display( 'index.tpl' );
?>


index.tpl
<html>
<head>
    <title>Smarty Example</title>
</head>
<body>

    {$message}

</body>
</html>



cjoki wrote:
Template engines just add another layer that IMHO is not needed and does little more than complicate a design and add to the learning.


After looking at the above code, you can't say that it's not insanely simple.



cjoki wrote:
and why are you asking me to look into a template system when your concern is performance?


Quite simply, I don't actually do the website design (I'm colour blind), I just worry about the functionality. The designer I hire designs the site and then writes the HTML and CSS and leaves me to do all the JS and server side, without having to get in my way. So if he wants to redesign the site then he just changes the templates, rather than having to troll through my PHP code, the same could be said if I want to redo the back-end of the site.

Have a read of this[^].

If at first you don't succeed, you're not Chuck Norris.

GeneralRe: Little help with my php code pls Pin
cjoki12-Oct-09 9:34
cjoki12-Oct-09 9:34 
GeneralRe: Little help with my php code pls Pin
fly90412-Oct-09 10:22
fly90412-Oct-09 10:22 
GeneralRe: Little help with my php code pls [modified] Pin
cjoki12-Oct-09 11:03
cjoki12-Oct-09 11:03 
GeneralRe: Little help with my php code pls Pin
fly90412-Oct-09 11:50
fly90412-Oct-09 11:50 
GeneralRe: Little help with my php code pls Pin
cjoki12-Oct-09 12:20
cjoki12-Oct-09 12:20 
GeneralRe: Little help with my php code pls Pin
fly90412-Oct-09 12:38
fly90412-Oct-09 12:38 
GeneralRe: Little help with my php code pls Pin
cjoki13-Oct-09 5:05
cjoki13-Oct-09 5:05 
Questioninstallation Pin
WilliamSimon8-Oct-09 12:07
WilliamSimon8-Oct-09 12:07 
Questioninstallation Pin
thangvel8-Oct-09 11:54
thangvel8-Oct-09 11:54 
AnswerRe: installation Pin
Richard MacCutchan14-Oct-09 6:07
mveRichard MacCutchan14-Oct-09 6:07 
AnswerRe: installation Pin
Iranian MM7-Sep-11 9:40
Iranian MM7-Sep-11 9:40 
Questiondownload php code Pin
udch7-Oct-09 1:24
udch7-Oct-09 1:24 
AnswerRe: download php code Pin
EliottA7-Oct-09 2:41
EliottA7-Oct-09 2:41 
QuestionI need some help Pin
robertbarzyk6-Oct-09 12:55
robertbarzyk6-Oct-09 12:55 
AnswerRe: I need some help Pin
Marc Firth6-Oct-09 22:02
Marc Firth6-Oct-09 22:02 
AnswerRe: I need some help Pin
fly9047-Oct-09 5:01
fly9047-Oct-09 5:01 
Questionfetch data Pin
udch6-Oct-09 3:18
udch6-Oct-09 3:18 

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.