homepage Welcome to WebmasterWorld Guest from 54.226.80.196
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
The best way to use a VERY simple template?
With dynamic content
FuzzyLogik




msg:3206835
 2:51 pm on Jan 3, 2007 (gmt 0)

Right now, I am using the following:

require_once($page.php");
$output = ob_get_contents();
ob_end_clean();
...
echo $content;
echo $related;

mypage.php:
$content = "This is content";
$related = "Related to nothing";

-

This has been working well for me, but the problems are:

1) I have a huge structure inside of one of the $content variables, and while it's in comment form, I cannot preview it in dreamweaver.

2) I cannot use php functions within the variable (or at least have had no luck doing so)

So, what are the alternatives?

I don't want to have to learn a whole new templating system like smarty, I just want to be able to include content into index.php based on what is in the included page.

 

rjwmnews




msg:3206863
 3:14 pm on Jan 3, 2007 (gmt 0)

The 'Smarty' template system could be a good solution based upon your described needs. There is some overhead involved with using the rather monolithic class but the performance penalty may be insignificant compared to the benefits.

[smarty.php.net...]

FuzzyLogik




msg:3206866
 3:17 pm on Jan 3, 2007 (gmt 0)

As I said in my original post, I would prefer not to have to convert my site over to an entirely new templating system like smarty... I'm looking for a very simple solution.

FuzzyLogik




msg:3206941
 4:27 pm on Jan 3, 2007 (gmt 0)

also, the reason I'm not just putting th content in a php file and including it is due to having multiple "contents" in the file.

I have both meta descriptions and keywords in the file as well as the content.

[edited by: FuzzyLogik at 4:28 pm (utc) on Jan. 3, 2007]

jatar_k




msg:3207127
 6:50 pm on Jan 3, 2007 (gmt 0)

the problem seems to be design flaws within the original system and to correct these flaws you will need to redesign.

the only way I can see to possibly do it would be to change your echo's to includes, then you could have php functions etc in your files. I imagine this would cause a rather large redesign though.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved