View Full Version : php skinning system
VistaBoy
09-07-2008, 08:55 AM
hello can some one tell me they best why to make a skinning system for my script as i can not seem to make one that works were i can have {$something} and that $something is php if($hi == 1){echo 'blah'} i know it uses evil but how is it done?
VistaBoy
09-07-2008, 10:15 AM
sorry to post to times but i can not edit the other post :|
i have this code but it dose not work.
index.php
<?php
$template = file_get_contents( 'page.php' );
$array = array ( 'echo' => 'echo (\'hello\');'
);
// we have to somehow expand the $template variable, but how?
eval("$template");
?>
page.php
echo 'hello'; $array["echo"];
but the $array["echo"]; dose not show the word hello like it should :\
Protege
09-07-2008, 10:33 AM
What exactly are you tryin to acheive, if your first post was in-any sense to me I would of helped you. You can't do this -> $array = array ( 'echo' => 'echo (\'hello\');'
);
VistaBoy
09-07-2008, 10:37 AM
Okay i suck at this bit of php what i am trying to do is make a template system were you call the page eg: page.php and it has some txt in it like
are you logged in? {$logged}
and in the index or some were have the $logged set as a if($hi == 1) {echo'yes';} else { echo'no';} or some thing like that
Protege
09-07-2008, 10:40 AM
Okay i suck at this bit of php what i am trying to do is make a template system were you call the page eg: page.php and it has some txt in it like
are you logged in? {$logged}
and in the index or some were have the $logged set as a if($hi == 1) {echo'yes';} else { echo'no';} or some thing like that
<?php
include_once ( 'header.php' );
if ( $hi === true )
{
$logged = 'yes';
}
else
{
$logged = 'no';
}
include_once ( 'page.php' );
include_once ( 'footer.php' );
?>
Thats all I think you want...
VistaBoy
09-07-2008, 10:45 AM
okay thats one why of doing it but i am trying to make it small ish i have done it like the array why before and got it to work but i can not rememeber how i done it because i will have a lot of template pages or i could use smarty but do not know.
Protege
09-07-2008, 11:07 AM
I have no idea what you are trying to acheive... An echo inside an array?
Independent
09-07-2008, 04:22 PM
SMARTY?
http://www.smarty.net/
But it's a template engine.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.