Hi, Ive been doing google searches for this for hours but no luck. Was wanting to learn how to insert into templates information by using the tags such as {header}, {sidebar}, stuff like that where {sidebar} would bring up some info from a php page. Not sure what this process is even called for me to corectly search for it. Any help would be appreciated.
Hi, You're just like me, who loves thinking different and hard things. Just have a look at PHP Smarty Template Engine Documentation. It works in a similar way, what you're expecting... I'm giving a clue here. Hope, you can enhance it to your satisfaction. If further help required contact me via http://cheaphostindia.info Your HTML Code is read by a PHP File and stored in variable $content. Your HTML Code contains some custom tags like {HEADER} or {TITLE} <?php $content = file_get_contents("htmlfilename.html"); // $var array fetches dynamic data from PHP file, reads DB or contains user inputs, $var['TITLE'] contains the value for {TITLE} tag foreach($_vars as $key=>$value) { str_replace("{".$key."}",$value,$content); } Print $content; ?> PHP:
Thanks for the replies. I just checked out Smarty yesterday and found that was what I was talking about. I havent realy dug into smarty to much to see how easily it would be to pick up. I'm just getting started in php, sql, and css. Don't want to get to over whelmed at once. I think it would probably be best to finnish my first site that I am trying to build from scratch so I know all the code and how it works then convert it over to smarty. Can someone tell me if smarty is any more complicated than php, or is it as easy as html or css?
You can use Smarty in an easy way. But it gives you freedom to impart even complex codes also (like looping, decision making etc). All you need to understand at first is, the architecture of Smarty (it has got some folder structure specification) and how it works.