unidox Posted July 29, 2008 Share Posted July 29, 2008 I have this code that updates the php site depending on whats in the sql. $tpl = file_get_contents("templates/" . $name . "/index.php"); $index = file_get_contents("pages/news.inc.php"); $site = get_tag("url", "templates/stk/", $tpl); $site = get_tag("content", $index, $site); file_put_contents("templates/" . $name . "/index.php", $site); include("templates/" . $name . "/index.php"); The only problem is, how do I make it so instead of updating the file, I can just print out the data. I tried using echo $site, but the php gets blocked out for some reason. Here is news.inc.php: <div id="center_head"> <div id="center_head_txt">News</div> </div> <?php $q2 = mysql_query("SELECT * FROM `pcp_news`") or die(mysql_error()); $limit = TABLE_LIMIT; if (!isset($_GET['g']) || (!is_numeric($_GET['g']))) { $group = 1; } else { $group = $_GET['g']; } $start = (($group * $limit) - $limit); $q = mysql_query("SELECT * FROM `pcp_news` ORDER BY `date` DESC LIMIT $start, $limit") or die(mysql_error()); $rows = mysql_num_rows($q2); $total_pages = ceil($rows / $limit); if (mysql_num_rows($q2) == 0) { echo "There are not any news posts!"; } else { while ($r = mysql_fetch_array($q)) { ?> <div id="center_title"> <div id="center_title_txt"> <div id="center_title_txt_title">Title: <?=$r['topic']?></div> <div id="center_title_txt_date">Posted By: <?=$r['author']?> on <?=$r['date']?></div> </div> </div> <div id="center_body"> <div id="center_body_txt"><?=$r['message']?></div> </div> <? } } ?> and the template has delimiters like {content} stuff like that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.